FirebasePushProvider class
Firebase Cloud Messaging, HTTP v1.
The recipient is an FCM registration token. A stale token surfaces as a DVPushProviderException whose DVPushProviderException.isUnregisteredToken is true, which is the signal to drop it rather than retry.
FirebasePushProvider.fromSecrets is the usual way to build one: the
service-account key file in the FCM_SERVICE_ACCOUNT_JSON secret is the
only credential. sendTopic reaches every device subscribed to a topic and
sendData sends a data-only message the app handles itself.
- Implemented types
Constructors
-
FirebasePushProvider({required String projectId, required DVAccessTokenSupplier accessToken, Uri? baseUrl, DVHttpSend transport = dvSendHttpRequest, FirebasePushOptions options = const FirebasePushOptions(), Future<
void> onUnauthorized()?}) - FirebasePushProvider.fromSecrets({DVHttpSend transport = dvSendHttpRequest, FirebasePushOptions options = const FirebasePushOptions(), Uri? baseUrl, DateTime clock()?})
-
A provider whose credentials are the service account in the
FCM_SERVICE_ACCOUNT_JSONsecret. The private key is read through DVSecrets, so it is redacted from logs, and is not part of any error.factory
Properties
- accessToken → DVAccessTokenSupplier
-
final
- baseUrl → Uri
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- kind → DVNotificationProviderKind
-
no setteroverride
-
Called when FCM answers 401, before one retry with a fresh token. Drop
the cached token here; FirebasePushProvider.fromSecrets does.
final
- options → FirebasePushOptions
-
final
- projectId → String
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transport → DVHttpSend
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
send(
String recipient, DVNotificationMessage message) → Future< void> -
override
-
sendData(
String token, Map< String, String> data, {bool highPriority = false}) → Future<void> -
Sends a data-only message to
token: no notification is shown, the app receivesdataand decides.highPrioritywakes a sleeping device, at a battery cost, so it is opt-in. -
sendTopic(
String topic, DVNotificationMessage message) → Future< void> -
Sends
messageto every device subscribed totopic. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited