toJson method
Map<String, dynamic>
toJson(
- Platform platform
)
Implementation
Map<String, dynamic> toJson(Platform platform) {
final Map<String, dynamic> json = {
'serviceId': serviceId,
'serviceTypes': serviceTypes?.map((e) => e.rawValue).toList(),
...foregroundTaskOptions.toJson(),
'notificationContentTitle': notificationContentTitle,
'notificationContentText': notificationContentText,
'icon': notificationIcon?.toJson(),
'buttons': notificationButtons?.map((e) => e.toJson()).toList(),
'initialRoute': notificationInitialRoute,
};
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;
}