Skip to main content

Overview

As soon as your app launches, configure the SDK with your API Key. This initializes the native Encore SDK on whichever platform the app is running on (iOS or Android).

Initialize Encore in Your App

Call configure early in your app lifecycle — before identifying users or presenting offers. The recommended place is in main() or your root widget’s initState:
import 'package:flutter/material.dart';
import 'package:encore/encore.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Encore.shared.configure(apiKey: 'pk_your_api_key_here');

  runApp(const MyApp());
}
Replace pk_your_api_key_here with your public API key.
If you don’t have access to your API key, please contact your Encore representative or visit dashboard.encorekit.com.

Enable Debug Logging

During development, enable debug logging to see SDK activity in your console:
await Encore.shared.configure(
  apiKey: 'pk_your_api_key_here',
  logLevel: LogLevel.debug,
);
Set logLevel back to LogLevel.none (the default) before shipping to production.

Next Steps

Now that Encore is configured, you’re ready to: