I have a problem when I fetch data using provider in Flutter.
I’ve tried changing it to NULL (UserBiodata?) without using LATE but the error occurs again in other parts.
Here is the code I wrote:
class UserBiodataProfile with ChangeNotifier {
late UserBiodata _userBiodata;
UserBiodata get userBiodata => _userBiodata;
set userBiodata(UserBiodata newUserBiodata) {
_userBiodata = newUserBiodata;
notifyListeners();
}
}
I call the data here:
Text(
userBiodataProvider.userBiodata.data.name,
style: bold5,
),
How do I solve it?
2
Answers
Try the following code:
While loding the data is null.
try this code