InheritedWidget - The getter was called on null after navigator.push
InheritedWidget
should wrap the full MatrialApp widget (root widget)
In the code you've provided, LoginScreen
is not a descendant of LoginBlocProvider
which is why it can't find the ancestor widget. Your code wraps the WelcomeScreen
route in LoginBlocProvider
, but not the whole navigator. The solution is to wrap your MaterialApp
in LoginBlocProvider
and then you will have access to it everywhere in your app.
class App extends StatelessWidget {
@override
Widget build(context) {
return LoginBlocProvider(
child: MaterialApp(
title: 'Iniciar Sesion',
home: WelcomeScreen(),
),
);
}
}