getInitialMessage method

  1. @override
Future<Map<String, dynamic>?> getInitialMessage()
override

Gets any data associated to a Push Notification when opening the app by taping on it.

Example Usage

function someAsyncFunction() async {
  final message = await PusherBeams.instance.getInitialMessage();
}

In order to receive data you need to send the pusher message in the following format:

{
  "interests":["hello"],
  "apns": {
    "aps": {
      "alert": {"title":"Hello", "body":"Hello, world!"},
    },
   "data": {
      "info": { "name": "george" }
    }
  },
  "fcm": {
    "notification": {"title":"Hello", "body":"Hello, world!"},
    "data": {
      "info": { "name": "george" }
    }
  }
}

Throws an Exception in case of failure.

Implementation

@override
Future<Map<String, dynamic>?> getInitialMessage() async {
  return await _pusherBeamsApi.getInitialMessage();
}