'When app is opened from deep link, the app should be opened from the beginning and not from from where it was left off- flutter

When the app is running in the background and the deep link is clicked it continues from where it was in the background. How should I start the app from the beginning in flutter?

(Should have only one instance)

Thanks



Solution 1:[1]

create a navigator key:

GlobalKey<NavigatorState> navigatorKey = GlobalKey();

then in the onGenerate use the key to pop until the desired page.

 navigatorKey.currentState!.popUntil(((route) => route.isFirst));

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Elie Saad