I'm trying to navigate user when user tap the notification.
It is working as I want but one situation(application is not opened), I mean application is not on the background, it is completely closed. User tap the notification and application firstly see the splash sceren after that load some initial news on initial page and do not navigating. I tried to add some delay but not worked. How can I fix this?
My main function
main() async {
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
setupLocator();
await Hive.initFlutter();
Hive.registerAdapter(UserDataAdapter());
await Hive.openBox<UserData>('userData');
await dotenv.load();
await GetStorage.init();
Get.put(MainController());
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
runApp(const MyApp());
}
Running notification tap function when user click the notification
Future<void> onTapNotification(RemoteMessage message) async {
log('Notification tapped', name: 'TAP NOTIFICATION');
inspect(message);
Get.toNamed(
'/notification-news',
parameters: {
"news_id": message.data['news_id'],
},
);
}