addOnMessage method

VoidCallback addOnMessage(
  1. MessageHandler handler
)

Called when notification is received when app is in the foreground. Remember to unsubscribe. Multiple listeners can be listening.

Implementation

VoidCallback addOnMessage(MessageHandler handler) {
  _sendAndroidReadyToProcessMessages();
  _onMessageHandlers.add(handler);
  return () {
    _onMessageHandlers.remove(handler);
  };
}