Install
Get your API key from your project settings at dash.1sygnal.app .
pub.dev
flutter pub add onesygnalThis is a Flutter plugin, not a pure-Dart package — it ships native Android (Kotlin)
and iOS (Swift) code alongside the Dart API, and flutter pub get pulls both in
automatically. There’s nothing to add to pubspec.yaml beyond the dependency itself.
Native-side setup
This plugin is a thin bridge straight to the same native initialize() the Android/iOS SDKs
use, so the API key can be set the same two ways as on native — whichever fits your setup:
Option A — manifest/plist (matches native Android/iOS):
<!-- android/app/src/main/AndroidManifest.xml -->
<application>
<meta-data
android:name="app.onesygnal.API_KEY"
android:value="YOUR_API_KEY" />
</application><!-- ios/Runner/Info.plist -->
<key>OneSygnalApiKey</key>
<string>YOUR_API_KEY</string>Option B — code, via setApiKey():
await OneSygnal().setApiKey('YOUR_API_KEY');setApiKey() overrides the manifest/plist value, same relationship as on native Android/iOS
— see Configuration. Beyond the API key, no other
AndroidManifest.xml/Info.plist changes are needed — the native plugin registers itself
through Flutter’s normal plugin-registration mechanism (GeneratedPluginRegistrant), and
surveys render as a native window overlay that doesn’t require an Activity/ViewController
handoff from your app.
Platform floors
See the SDK overview for the exact Dart/Flutter/Android/iOS version floors this plugin requires.