In my app, notifyListeners() works correctly by notifying an email change on a second view (when the user logs in to the app).
However, I am trying to do the same in a side menu using context.watch().email, but it has no effect. notifyListeners() is called, but the text does not change. The ChangeNotifierProvider is present in the main file as:
runApp(
ChangeNotifierProvider(
create: (context) => TextProvider(),
child: const MyApp(),
),
);
and in my NavBar class:
class NavBar extends StatelessWidget {
NavBar({super.key});
@override
Widget build(BuildContext context) {
var email = context.watch<TextProvider>().email; <-- email not change
...
Any help about that?