привет
я получил ошибку во флаттере
он просто получил статус загрузки от провайдера У меня такая же ошибка у всех провайдеров, которые я использовал
Получатель loadStatus был вызван при нулевом флаттере
Эта ошибка появляется только в консоли, но приложение работает нормально -_-
class _DoctorInfoPageState extends State<DoctorInfoPage> {
GeneralService _generalService;
ProfileService _profileService;
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_generalService = Provider.of<GeneralService>(context);
_profileService = Provider.of<ProfileService>(context);
loadingReviews();
});
}
loadingReviews() async {
_generalService.setLoadingState(true);
await _profileService.getReviews(context);
_generalService.setLoadingState(false);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0.0,
centerTitle: true,
backgroundColor: Colors.white,
leading: IconButton(
icon:
Icon(Icons.chevron_left, size: 30, color: Const.appMainBlueColor),
onPressed: () {
print('test');
},
),
title: Text(
"Doctor Info",
style: TextStyle(
color: Const.appMainBlueColor,
fontWeight: FontWeight.w600,
fontSize: 18),
),
),
body: _generalService.loadingStatus != null &&
_generalService.loadingStatus
? Center(child: PumpHeart(size: 35.0))
: SafeArea()
);
}
}
Я пробовал все больше и больше, но ничего не изменилось, так что может кто-нибудь сказал мне, где ошибка, пожалуйста?
Это код провайдера
class GeneralService with ChangeNotifier {
bool _isLoading = false;
// Change Loading Status
void setLoadingState(bool value) {
_isLoading = value;
notifyListeners();
}
// Get Loading Status
bool get loadingStatus => _isLoading;
}