notificationHandler method

Future<FlutterLocalNotificationsPlugin> notificationHandler(
  1. FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin, {
  2. BuildContext? context,
  3. void onDidRecieve(
    1. NotificationResponse
    )?,
})

Implementation

Future<FlutterLocalNotificationsPlugin> notificationHandler(
    FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin,
    {BuildContext? context,void Function(NotificationResponse)? onDidRecieve}) async {
  flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();

  DarwinInitializationSettings iosSetting = DarwinInitializationSettings(
      requestAlertPermission: true,
      requestBadgePermission: true,
      requestSoundPermission: true);

  var initializationSettingsAndroid = AndroidInitializationSettings('sellon');

  var initializationSettings = InitializationSettings(
      android: initializationSettingsAndroid, iOS: iosSetting);
  await flutterLocalNotificationsPlugin.initialize(
    initializationSettings,
    onDidReceiveNotificationResponse: onDidRecieve,
  );

  return flutterLocalNotificationsPlugin;
}