The application has the following screens,
- Tab Screen (Main/Home Screen)
- CategoriesScreen( 1st tab Screen)
- Favorite Screen (2nd Tab screen)
- CategoryMealsScreen(child Screen of CategoriesScreen)
I have added print statement for each screen Build method to check on the navigation,
When I navigate back from "CategoryMealsScreen" to "CategoriesScreen", I can see that "CategoryMealsScreen" is once again being called why is that so?
Logs :
I/flutter (30320): TabsScreen ( parent screen )
I/flutter (30320): CategoriesScreen
I/flutter (30320): CategoryMealsScreen ( child screen, pressed back in this screen)
I/flutter (30320): CategoryMealsScreen ( child screen, once again it's being called after landing in CategoriesScreen)
I/flutter (30320): TabsScreen ( parent screen )
I/flutter (30320): CategoriesScreen
I/flutter (30320): CategoryMealsScreen ( child screen)
I/flutter (30320): CategoryMealsScreen ( child screen, once again it's being called after landing in CategoriesScreen)
I/flutter (30320): TabsScreen ( parent screen )
I/flutter (30320): CategoriesScreen
I/flutter (30320): TabsScreen
I/flutter (30320): FavoritesScreen
I/flutter (30320): TabsScreen ( parent screen )
I/flutter (30320): CategoriesScreen
I/flutter (30320): CategoryMealsScreen ( child screen)
I/flutter (30320): CategoryMealsScreen ( i pressed back button in-app bar and navigated back to parent screen but once again child screen was printed in logs )
Below is the code that pushes the CategoryMealsScreen from CategoriesScreen,
Navigator.of(ctx).pushNamed(
CategoryMealsScreen.routeName,
arguments: {
'id': id,
'title': title,
},
);
My expectation was "CategoryMealsScreen" would not be called again when I navigate back to "TabsScreen"
Thanks in Advance.