'Logging out from different routes don't change screen
My Top level widgets are providers and their child is Material App. In Material app as home route I am checking from my auth provider Whether user is logged in so I show different screen then. And in my drawer I have a logout button to logout user and notify listener. If I just start the app logout works but if I navigate to some other routes then logout didnt take me to auth screen.
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
fontFamily: 'IBM Plex Sans',
textTheme: const TextTheme(
headline1: TextStyle(
color: primaryColor,
fontSize: 20,
fontWeight: FontWeight.w400,
),
caption: TextStyle(
fontSize: 15,
color: Colors.grey,
fontWeight: FontWeight.w600,
),
),
appBarTheme: const AppBarTheme(
backgroundColor: Color(0xFFFCAA32),
),
),
home: authData.isAuth ? CatagoriesScreen() : AuthScreen(),
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
