onMessage property

Stream<RemoteMessage> onMessage

Returns a Stream that is called when an incoming FCM payload is received whilst the Flutter instance is in the foreground.

The Stream contains the RemoteMessage.

To handle messages whilst the app is in the background or terminated, see onBackgroundMessage.

Implementation

static Stream<RemoteMessage> get onMessage =>
    FirebaseMessagingPlatform.onMessage.stream;