I'm getting the 'null check operator used on a null value' when I try to access specific screens.
I blocked out my 'user_provider' custom class as well as parts of the code where it's used and it displays normally (no red screen) but without those screens.
This is the custom class
import 'package:flutter/widgets.dart';
import 'package:purple/models/user.dart';
import 'package:purple/resources/auth_methods.dart';
class UserProvider with ChangeNotifier {
User? _user;
final AuthMethods _authMethods = AuthMethods();
User get getUser => _user!;
Future<void> refreshUser() async {
User user = await _authMethods.getUserDetails();
_user = user;
notifyListeners();
}
}
I underdertand this could be as a result of the bang operator in line 9 but I'm new to fluttr and have no idea how to go about it.