Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

The named parameter 'onSelectNotification' isn't defined

ErrorThe named parameter 'onSelectNotification' isn't defined

Short answer

The plugin replaced its callbacks in version 10. Replace onSelectNotification with onDidReceiveNotificationResponse, and add onDidReceiveBackgroundNotificationResponse for actions handled in the background. On iOS settings, delete onDidReceiveLocalNotification, which was removed in version 18.

  • Applies to Flutter 3.35, flutter_local_notifications current release
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find which version of the plugin you resolved, then match the error to the cause below.

    flutter pub deps | grep flutter_local_notifications
  2. 2Match what you see, then jump to its fix

    1. 1The named parameter 'onSelectNotification' isn't definedonSelectNotification was replaced in version 10Fix
    2. 2The named parameter 'onDidReceiveLocalNotification' isn't defined, in the iOS settingsonDidReceiveLocalNotification was removed in version 18Fix

What does the error look like?

  • The named parameter 'onSelectNotification' isn't defined
  • The named parameter 'onDidReceiveLocalNotification' isn't defined

Cause 1 of 2

onSelectNotification was replaced in version 10

1Check

Your code was written for the old API, and the plugin version in pubspec.lock is newer.

grep -rn "onSelectNotification" lib/

2Fix

Use onDidReceiveNotificationResponse in initialize. It runs while the app is running. Actions that do not show the UI go to onDidReceiveBackgroundNotificationResponse, which runs on a background isolate and needs a function marked as an entry point.

@pragma('vm:entry-point')
void notificationTapBackground(NotificationResponse response) {
  // handle the action without UI
}

await flutterLocalNotificationsPlugin.initialize(
  settings: initializationSettings,
  onDidReceiveNotificationResponse: (NotificationResponse response) {
    // open the screen for response.payload
  },
  onDidReceiveBackgroundNotificationResponse: notificationTapBackground,
);

3Verify

Analyze, then tap a notification and check that the callback runs.

flutter analyze

Confirmed by pub.dev

Did this fix it?

Cause 2 of 2

onDidReceiveLocalNotification was removed in version 18

1Check

The callback only mattered on iOS older than 10, so the plugin dropped it with no replacement.

grep -rn "onDidReceiveLocalNotification" lib/

2Fix

Delete the argument from DarwinInitializationSettings.

const DarwinInitializationSettings iosSettings =
    DarwinInitializationSettings(
  requestAlertPermission: true,
  requestBadgePermission: true,
  requestSoundPermission: true,
);

3Verify

Analyze again.

flutter analyze

Confirmed by pub.dev

Did this fix it?

How do I stop it coming back?

  • Read the plugin's changelog before raising its major version.
  • Pin the major version in pubspec.yaml and upgrade on purpose.
  • Keep notification setup in one file.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Google Play says the app does not support 16 KB memory pages

check_elf_alignment.sh reports UNALIGNED for a library under lib/arm64-v8a

Google Play requires apps that target Android 15 or higher and ship native .so libraries to run on devices with 16 KB memory pages; from 1 February 2027 it will block updates that do not.

5 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.