getActiveNotificationMessagingStyle method

Future<MessagingStyleInformation?> getActiveNotificationMessagingStyle(
  1. int id, {
  2. String? tag,
})

Returns the messaging style information of an active notification shown by the application that hasn't been dismissed/removed.

This method is only applicable to Android 6.0 or newer and will throw an PlatformException when called on a device with an incompatible Android version.

Only DrawableResourceAndroidIcon and ContentUriAndroidIcon are supported for AndroidIcon fields.

Implementation

Future<MessagingStyleInformation?> getActiveNotificationMessagingStyle(
  int id, {
  String? tag,
}) async {
  final Map<dynamic, dynamic>? m = await _channel
      .invokeMethod('getActiveNotificationMessagingStyle', <String, Object?>{
    'id': id,
    'tag': tag,
  });
  if (m == null) {
    return null;
  }

  return MessagingStyleInformation(
    _personFromMap(m['person'])!,
    conversationTitle: m['conversationTitle'],
    groupConversation: m['groupConversation'],
    messages:
        // ignore: always_specify_types
        m['messages']?.map<Message>((m) => _messageFromMap(m))?.toList(),
  );
}