Home > front end >  The method 'IOSInitializationSettings' isn't defined using local notification plugin
The method 'IOSInitializationSettings' isn't defined using local notification plugin

Time:09-23

flutter_local_notifications: ^11.0.0

I used this library but I can find IOSInitializationSettings please help me. I m trying to integrate push notifications into my flutter app.

CodePudding user response:

Here is the code for initializing for iOS and android.


  Future<void> intialize() async {
    tz.initializeTimeZones();
    const AndroidInitializationSettings androidInitializationSettings =
        AndroidInitializationSettings('@drawable/ic_stat_android');

    IOSInitializationSettings iosInitializationSettings =
        IOSInitializationSettings(
      requestAlertPermission: true,
      requestBadgePermission: true,
      requestSoundPermission: true,
      onDidReceiveLocalNotification: onDidReceiveLocalNotification,
    );

    final InitializationSettings settings = InitializationSettings(
      android: androidInitializationSettings,
      iOS: iosInitializationSettings,
    );

    await _localNotificationService.initialize(
      settings,
      onSelectNotification: onSelectNotification,
    );
  }

I did the code in flutter_local_notifications: ^9.6.0

CodePudding user response:

[iOS][macOS] Breaking changes iOS and macOS classes have been renamed and refactored as they are based on the same operating system and share the same notification APIs. Rather than having a prefix of either IOS or MacOS, these are now replaced by classes with a Darwin prefix. For example, IOSInitializationSettings can be replaced with DarwinInitializationSettings

CodePudding user response:

https://pub.dev/packages/flutter_local_notifications/versions/11.0.0

IOSInitializationSettings --> DarwinInitializationSettings

IOSNotificationDetails --> DarwinNotificationDetails

  • Related