getInitialMessage method

  1. @override
Future<RemoteMessage?> getInitialMessage()
override

If the application has been opened from a terminated state via a RemoteMessage (containing a Notification), it will be returned, otherwise it will be null.

Once the Notification has been consumed, it will be removed and further calls to getInitialMessage will be null.

This should be used to determine whether specific notification interaction should open the app with a specific purpose (e.g. opening a chat message, specific screen etc).

on Android, if the message was received in the foreground, and the notification was pressed whilst the app is in a background/terminated state, this will return null.

Implementation

@override
Future<RemoteMessage?> getInitialMessage() {
  return super.noSuchMethod(
    Invocation.method(#getInitialMessage, []),
    returnValue: Future.value(null),
    returnValueForMissingStub: Future.value(null),
  );
}