reachbell is the Flutter client SDK — the mobile counterpart to the browser SDK. It acquires the OS push token via firebase_messaging and registers the device with ReachBell, then lets you link the subscription to your own user id and attach tags. Sending pushes and building campaigns happen server-side with the Node server SDK.
Preview: this package is newly released and has not yet been compiled or analyzed against a Dart/Flutter toolchain. Verify register() / identify() / tag() on a real device before shipping — emulators and the iOS Simulator cannot deliver real push tokens reliably.
ReachBell delivers Android and iOS push through Firebase Cloud Messaging, so the device token is obtained via firebase_messaging. You must set up a Firebase project first:
Place google-services.json in android/app/ (the FlutterFire CLI does this).
Apply the Google Services Gradle plugin (com.google.gms.google-services).
On Android 13+ (API 33) the app must hold the POST_NOTIFICATIONS permission. register() requests it at runtime, but you should also declare it in android/app/src/main/AndroidManifest.xml:
Add GoogleService-Info.plist to the Runner target in Xcode.
Enable the Push Notifications capability and the Background Modes → Remote notifications capability for the Runner target.
Upload your APNs authentication key (or certificate) to the Firebase console (Project Settings → Cloud Messaging). Without this, FCM cannot mint a token and register() will throw.
Push notifications do not work on the iOS Simulator — test on a physical device.
register() requests notification permission, reads the device push token via firebase_messaging, then POSTs it to ReachBell. It returns a RegisterResult and caches the token in memory for later identify() / tag() calls.
final result = await ReachBell.register();print('Registered: ${result.token}');
RegisterResult exposes the registered subscription:
Field
Type
Description
token
String
The registered device push token.
tokenType
TokenType
TokenType.fcm (Android) or TokenType.apns (iOS).
platform
Platform
Platform.android or Platform.ios.
subscriberId
String?
The subscriber id, when the API returns one.
The token from the last successful register() in this process is also available as ReachBell.token (or null if you haven't registered yet).
The token is kept in memory only and is not persisted across app restarts. Because registration is safe to repeat — the server upserts by token, and FCM may rotate tokens anyway — the recommended pattern is to call register() on every launch. You can also listen to FirebaseMessaging.instance.onTokenRefresh and re-run register() when the token rotates.
Every method throws a ReachBellException when something goes wrong:
init() not called, or register() not run before identify() / tag().
Notification permission denied, or no device token could be obtained.
A non-2xx API response — statusCode and body are populated.
A network failure or timeout — statusCode is null.
try { final result = await ReachBell.register(); await ReachBell.identify('user_42'); await ReachBell.tag(['pro', 'beta']);} on ReachBellException catch (e) { // Permission denied, no token, or a non-2xx API response. print('${e.statusCode}: ${e.message}');}