getNotifications method

  1. @override
Future<List<Ringtone>?> getNotifications()
override

invokes the getNotifications method on the native platform, which returns a list of hashmaps that get converted to Ringtone objects containing platform notification sounds.

Implementation

@override
Future<List<Ringtone>?> getNotifications() async {
  var notifications = await methodChannel.invokeMethod<List>('getNotifications');
  notifications =
      notifications?.map((notification) => Map<String, dynamic>.from(notification)).toList();
  return notifications?.map((map) => Ringtone.fromJson(map)).toList();
}