Flutter · colveor
Notifications
Push notifications through Firebase Cloud Messaging, registered with your Colveor Core backend.
Setup
- Generate Firebase options with FlutterFire and return them from
VoConfig.firebaseConfig. - Optionally pass
backgroundMessageHandlertoVoBootstrap.initialize. - Listen to
VoBootstrap.onMessageandonMessageOpenedAppfor foreground messages and taps.
Note
Without Firebase every notification feature is a no-op and the permission status reads unavailable.
Asking for permission
Dart
WidgetsBinding.instance.addPostFrameCallback(
(_) => requestNotificationPermission(context),
);The user is only asked once; later calls just re-sync the token. Pass force: true to ask again. Customize the dialog with title, description, enableButtonLabel, notNowButtonLabel, bodyBuilder and footerBuilder.
VoNotificationController
Read it with ref.read(voNotificationControllerProvider.notifier) or context.voControllers.notification.
| Name | Description |
|---|---|
requestAndRegister() | Ask for permission, fetch the FCM token and register the device. Returns granted, denied or unavailable. |
syncTokenIfAuthorized() | Register the current token if permission was already granted. |
unregister() | Remove this device's token from the backend. |
hasAskedPermission() / markPermissionAsked() | Read or set the asked-once flag. |
state | VoNotificationState: permissionStatus, fcmToken, isRegistering, error, isGranted, isDenied. |
Registration lifecycle
- On sign-in, an authorized device is registered automatically.
- On sign-out, the device is unregistered.
- When FCM rotates the token, the new one is registered.
These listeners start once the controller is first read — for example by requestNotificationPermission. Registration sends the FCM token, platform, device ID and device name.