initialize method
Future<bool?>
initialize(
- IOSInitializationSettings initializationSettings, {
- SelectNotificationCallback? onSelectNotification,
Initializes the plugin.
Call this method on application before using the plugin further.
Initialisation may also request notification permissions where users will see a permissions prompt. This may be fine in cases where it's acceptable to do this when the application runs for the first time. However, if your applicationn needs to do this at a later point in time, set the IOSInitializationSettings.requestAlertPermission, IOSInitializationSettings.requestBadgePermission and IOSInitializationSettings.requestSoundPermission values to false. requestPermissions can then be called to request permissions when needed.
To handle when a notification launched an application, use
getNotificationAppLaunchDetails
.
Implementation
Future<bool?> initialize(
IOSInitializationSettings initializationSettings, {
SelectNotificationCallback? onSelectNotification,
}) async {
_onSelectNotification = onSelectNotification;
_onDidReceiveLocalNotification =
initializationSettings.onDidReceiveLocalNotification;
_channel.setMethodCallHandler(_handleMethod);
return await _channel.invokeMethod(
'initialize', initializationSettings.toMap());
}