我收到错误消息,指出所需类中找不到方法
onExpRemoved(Event e){
setState(() {
expenseDatas.remove(ExpenseData.fromSnapshot(e.snapshot));
});
}
此行显示一条错误,指出在类expireData中找不到fromSnapshot。
我的费用数据类如下:
class expenseData{
String key;
String category;
int exp;
expenseData(this.category, this.exp);
expenseData.fromSnapshot(DataSnapshot snapshot)
: key = snapshot.key,
category = snapshot.value['category'],
exp = snapshot.value['exp'];
expJason(){
return {
"category": category,
"exp": exp,
};
}
}