toJson method

Map<String, dynamic> toJson(
  1. Platform platform
)

Implementation

Map<String, dynamic> toJson(Platform platform) {
  final Map<String, dynamic> json = {
    'serviceId': serviceId,
    ...foregroundTaskOptions.toJson(),
    'notificationContentTitle': notificationContentTitle,
    'notificationContentText': notificationContentText,
    'iconData': notificationIcon?.toJson(),
    'buttons': notificationButtons?.map((e) => e.toJson()).toList(),
  };

  if (platform.isAndroid) {
    json.addAll(androidNotificationOptions.toJson());
  } else if (platform.isIOS) {
    json.addAll(iosNotificationOptions.toJson());
  }

  if (callback != null) {
    json['callbackHandle'] =
        PluginUtilities.getCallbackHandle(callback!)?.toRawHandle();
  }

  return json;
}