Configuration
API key
Set via setApiKey(), called before initialize():
await OneSygnal().setApiKey('YOUR_API_KEY');
await OneSygnal().initialize();This overrides the API key the natives would otherwise read from
AndroidManifest.xml/Info.plist config. On Android/iOS as native platforms,
setApiKey() is an override of the manifest/plist value; on Flutter it’s the primary
mechanism — there’s no manifest/plist entry to fall back to, so setApiKey() is
effectively required.
initialize() itself takes no arguments — there’s no options object. Everything that
would be an “init option” on another platform is its own method call, made before
initialize():
| Call | Type | Notes |
|---|---|---|
setApiKey(String apiKey) | Future<void> | Must be called before initialize(). |
setLocale(String locale) | Future<void> | Optional — defaults to the device’s locale if never called. Live-reactive: calling it after initialize() immediately triggers a fresh config/surveys fetch under the new locale, no restart needed. |
There is no Flutter-level equivalent of web’s apiUrl option — the natives default to
https://sdk-api.1sygnal.app internally, and nothing in the Dart API exposes a way to
override that from this package.
reset(), setApiKey(), setLocale() — all bridged
Unlike web (which has none of these three — see the Web SDK’s configuration page), all three are bridged on Flutter, because both natives implement them and the bridge just forwards:
setApiKey(String apiKey)— see above.setLocale(String locale)— see above; live-reactive both natively and through the bridge.reset()—Future<void>. Fully resets local device/user state (mints a new anonymous ID) and re-fetches surveys. Resolves once the native reset has actually finished, not just once the call was dispatched.
Debug logging
Debug logging is handled by the underlying native SDKs. On Android, filter Logcat for the
OneSygnal tag. On iOS, filter Console.app or Xcode’s console for the OneSygnal
subsystem. See the Android and
iOS configuration pages for details.
Other pre/post-init calls
setSurveysEnabled(bool enabled)—Future<void>. Globally suppresses (or re-enables) survey overlays without affecting event tracking.areSurveysEnabled()—Future<bool>. Reads back the flag above.
See API Reference for the complete signature list and Platform Parity for how every operation compares across web, Android, iOS, and the Flutter bridge.