PushNotificationService constructor

PushNotificationService(
  1. Getter<BuildContext?> context,
  2. AppInfo appInfo, {
  3. required Stream<AuthUserProfile> userStateStream,
  4. required Future<bool> sendDevicePushToken(
    1. BuildContext context,
    2. User user,
    3. String token
    ),
  5. required dynamic convertMessage(
    1. String? envelopeType,
    2. String? body
    ),
})

Implementation

PushNotificationService(
  Getter<BuildContext?> context,
  this.appInfo, {
  required this.userStateStream,
  required this.sendDevicePushToken,
  required this.convertMessage,
}) : _platform = pushPlatform() {
  onLogout(() async {
    /// Reset the state by copying the current token to _pendingToken.  That way
    /// when the next user logs in, they can immediately register for notifications
    _pendingToken = _pushNotificationToken;
  });

  initialize(context, context()!.userChanges).whenComplete(() {
    _bindListeners(context);
  });
}