onNotificationLaunch property

NotificationRouteCallback? onNotificationLaunch
final

Optional callback to determine route and payload based on notification launch. This callback is used for both initial notification launches and notifications received while the app is running. Return a SwiftRouting object with route and payload, or null to skip navigation.

Example:

onNotificationLaunch: ({required isFromNotification, required payload}) {
  if (isFromNotification) {
    return SwiftRouting(
      route: '/chatPage',
      payload: {
        'chatId': payload['chatId'],
        'userId': payload['userId'],
      },
    );
  }
  return null; // Use initialRoute from MaterialApp/GetMaterialApp or skip navigation
}

Implementation

final NotificationRouteCallback? onNotificationLaunch;