getNotificationAppLaunchDetails method

  1. @override
Future<NotificationAppLaunchDetails?> getNotificationAppLaunchDetails()
inherited

Returns info on if a notification had been used to launch the application.

Implementation

@override
Future<NotificationAppLaunchDetails?>
    getNotificationAppLaunchDetails() async {
  final Map<dynamic, dynamic>? result =
      await _channel.invokeMethod('getNotificationAppLaunchDetails');
  final Map<dynamic, dynamic>? notificationResponse =
      result != null && result.containsKey('notificationResponse')
          ? result['notificationResponse']
          : null;
  return result == null
      ? null
      : NotificationAppLaunchDetails(
          result['notificationLaunchedApp'],
          notificationResponse: notificationResponse == null
              ? null
              : NotificationResponse(
                  id: notificationResponse['notificationId'],
                  actionId: notificationResponse['actionId'],
                  input: notificationResponse['input'],
                  notificationResponseType: NotificationResponseType.values[
                      notificationResponse['notificationResponseType']],
                  payload: notificationResponse.containsKey('payload')
                      ? notificationResponse['payload']
                      : null,
                  data: Map<String, dynamic>.from(
                    notificationResponse['data'] ?? <String, dynamic>{},
                  ),
                ),
        );
}