getLastRemotePushNotification method

  1. @override
Future<RemoteNotificationData?> getLastRemotePushNotification()
override

Implementation

@override
Future<RemoteNotificationData?> getLastRemotePushNotification() async {
  try {
    var notification = await methodChannel.invokeMethod('getLastRemotePushNotification');

    if (notification == null || notification['id'] == null || notification['title'] == null) { return null; }

    return RemoteNotificationData(notification['id'] as String, notification['title'] as String);
  }
  on PlatformException catch(exception) {
    log.severe('Exception when displaying last received notification: ${exception.message}');
    return null;
  }
}