showCallNotification static method

Future<void> showCallNotification(
  1. Map<String, dynamic> data
)

Implementation

static Future<void> showCallNotification(Map<String, dynamic> data) async {
  try {
    int? notificationId = data['notificationId'];

    if (notificationId != null) {
      String lastNotificationId = await NotificationStorageHelper.getLastNotificationId();

      if (lastNotificationId == notificationId.toString()) {
        debugPrint("Duplicate notification detected in plugin, skipping call.");
        return;
      }

      await NotificationStorageHelper.storeLastNotificationId(notificationId.toString());
    }

    await _channel.invokeMethod('showCallNotification', data);
  } on PlatformException catch (e) {
    print("Error invoking showCallNotification: ${e.message}");
  }
}