I have my own navigator implementation in my Flutter project. My top level widget is like this:
MaterialApp.router(
restorationScopeId: "NavigatorRestorationScope",
routerDelegate: routerDelegate,
routeInformationParser: routeInformationParser,
localizationsDelegates: localizationsDelegates,
supportedLocales: supportedLocales,
localeListResolutionCallback: localeListResolutionCallback,
),
In one of my screens, I'm using the RestorationMixin, exactly like the Flutter's doc exemple but RestorableInt is not been restored after restore my app using "don't keep activities". I tried to add a RestorationScope and/or a RootRestorationScope as a parent of MaterialApp, din't work. I also tried those widgets between my screen and my navigator, din't work.
BUT, when I replaced the MaterialApp.router by MaterialApp, passing the screen directly as home parameter, like this:
MaterialApp(
restorationScopeId: "NavigatorRestorationScope",
home: const MainScreen(),
localizationsDelegates: localizationsDelegates,
supportedLocales: supportedLocales,
localeListResolutionCallback: localeListResolutionCallback,
),
The restoration worked!
I'm confused. It seems like the RestorationScope disappears from the context if I use my own navigator, witch doesn't make sense since the tree is the same, right?
My navigator is recovering its state normally. All screen that navigated through in the previous section are restored so I don't think the problem is in the Navigator it self.
Any thoughts? Thank U ♥️