设置Firebase

时间:2019-03-03 17:05:03

标签: firebase-realtime-database flutter

我收到错误消息,指出所需类中找不到方法

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,
  };
 }
}

0 个答案:

没有答案