AdhubFcm class
Firebase Cloud Messaging setup for adhub apps.
options must come from the consuming app's own generated
firebase_options.dart (via flutterfire configure) - unlike OneSignal's
app ID, this can't be fetched from the remote config JSON at runtime,
it has to be baked into the app at build time.
Constructors
- AdhubFcm()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- isInitialized → bool
-
Whether
initialize()has actually run for this app (i.e. it hasfirebaseOptionsconfigured) - lets callers know whether FCM's own state is meaningful yet, or whether they should fall back to another channel.no setter -
isOptedIn
→ Future<
bool> -
Whether the user has granted notification permission.
no setter
Static Methods
-
disableNotifications(
) → Future< void> -
Disables push notifications for the end user. No-op if
initialize()hasn't run yet, mirroringenableNotifications(). -
enableNotifications(
) → Future< bool> -
Enables push notifications for the end user. No-op if
initialize()hasn't run yet (e.g. this app has nofirebaseOptionsconfigured) - there's no topic to (re)subscribe to in that case. -
initialize(
FirebaseOptions options, String appId) → Future< void> -
maybeReRequestPermission(
) → Future< void> -
Call on every app open. If the user is already opted in, does nothing.
Otherwise, checks in at most once every
_reaskIntervalDaysdays: if the OS will still show its native permission popup (mainly an Android possibility - iOS essentially never re-shows it after an explicit answer), triggers that; otherwise shows adhub's own custom dialog, which deep-links to the device's app-settings screen since that's the only way back in once permanently denied.