onMessage property

StreamController<RemoteMessage> onMessage
final

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

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

Implementation

// ignore: close_sinks, never closed
static final StreamController<RemoteMessage> onMessage =
    StreamController<RemoteMessage>.broadcast();