remoteMessagingMessages function
Access to RemoteMessaging.messages
.
Whenever a new RemoteMessage
is receieved via RemoteMessaging.messages
, this provider will be updated.
The first execution of this will return the initial message from RemoteMessaging.getInitialMessage
.
Implementation
@riverpod
Stream<RemoteMessage> remoteMessagingMessages(Ref ref) async* {
final tRemoteMessaging = ref.watch(remoteMessagingProvider);
final tInitialMessage = await tRemoteMessaging.getInitialMessage();
if (tInitialMessage != null) {
yield tInitialMessage;
}
yield* tRemoteMessaging.messages;
}