Configuration
API key
This plugin bridges straight to the native initialize() on each platform, so the API key
resolves exactly the way it does natively: a manifest/plist entry, optionally overridden by
setApiKey() in code. See Install for the
AndroidManifest.xml/Info.plist snippets.
To override in code, call setApiKey() before initialize():
await OneSygnal().setApiKey('YOUR_API_KEY');
await OneSygnal().initialize();setApiKey() overrides whatever the natives would otherwise read from
AndroidManifest.xml/Info.plist — the same override relationship as on native Android/iOS.
It isn’t the only way to configure the key; it’s useful when the key needs to be resolved at
runtime (e.g. per-environment) rather than baked into the manifest/plist at build time.
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.