getAllGroups method

  1. @override
Future<List<NotificationChannelGroup>> getAllGroups()
override

Implementation

@override
Future<List<NotificationChannelGroup>> getAllGroups() async {
  var result = await methodChannel.invokeMethod<List>('getGroups') ?? [];
  if (result.isEmpty) return [];
  result = result.map((e) => Map<String, dynamic>.from(e)).toList();
  for (var json in result) {
    json['channels'] =
        (json['channels'] as List).map((e) => Map<String, dynamic>.from(e)).toList();
  }
  return result.map((json) => NotificationChannelGroup.fromJson(json)).toList();
}