I get the error below when I compile the app.
The following NoSuchMethodError was thrown building MyApp(dirty, state: _MyAppState#73713):
The method 'call' was called on null.
Receiver: null
Tried calling: call(Instance of 'ChangeNotifierProvider<UserLoggedIn>')
The error points me to the 'MyApp' part of the code and so I have no idea how to tackle this one. My app ran with no error before migrating. This is a part of my code where the cause for this error is. I went through the code with and I can't find a possible syntax error.
void main() {
runApp(ProviderScope(child: MyApp()));
}
class MyApp extends StatefulHookWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool _amplifyConfigured = false;
bool checkAuthStatus = false;
late AmplifyAuthCognito auth;
var userLoggedIn;
var useProvider;
@override
void initState() {
// TODO: implement initState
super.initState();
_configureAmplify();
}
void _configureAmplify() async {
if (!mounted) return;
auth = AmplifyAuthCognito();
await Amplify.addPlugin(auth);
try {
await Amplify.configure(amplifyconfig);
} on AmplifyAlreadyConfiguredException {
print('Already configured');
}
try {
getUserStatus();
setState(() {
_amplifyConfigured = true;
});
} catch (e) {
print(e);
}
}
@override
Widget build(BuildContext context) {
userLoggedIn = useProvider(userLoggedInProvider);
```