每次我在项目的任何地方添加这个 (Provider.of<NutritionState>(context, listen: true).ChangeCalories = 4;)
时,我都会收到这个错误
The following _TypeError was thrown building StreamBuilder<QuerySnapshot<Object?(dirty, state: _StreamBuilderBaseState<QuerySnapshot<Object?>, AsyncSnapshot<QuerySnapshot<Object?>>>#345e0):
type 'Null' is not a subtype of type 'String' of 'function result'
这里是通知程序
class NutritionState extends ChangeNotifier {
double _calories = 15;
double get Calories => _calories;
void set calorieChange(double newCal) {
_calories = newCal;
notifyListeners();
}
}
请帮忙