Luca
Luca
Top Bug Hunter
 · Founder | CTO

Local Push Notifications - Navigate to another screen

Resolved

Hey guys, I have an app that receives local push notifications. I implemented this with the package flutter_local_notifications.

I would like to redirect the user to a page other than the start page when he clicks on the push notification.

This seems to be possible with the package, but I don't understand how this works in FlutterFlow.
https://pub.dev/packages/flutter_local_notifications#getting-details-on-if-the-app-was-launched-via-a-notification-created-by-this-plugin

I give the scheduled notification a payload and it contains an ID and the name of the route.

If I have understood it correctly, then I have to use onDidReceiveBackgroundNotificationResponse and onDidReceiveNotificationResponse to define a function that forwards the user appropriately.

I have stored the functionality for this as a custom action in the main.dart.

When I work with the navigator, I need the build context, but I can't use it in a custom action if I link it in the main.dart.

Does anyone have an example?

2
9 replies