【发布时间】:2020-12-15 05:38:24
【问题描述】:
这最初可以工作,但在 firebase 更新后,它现在给了我这个错误。我在给出错误的部分添加了星号。错误信息已添加到代码下方。
import 'package:cloud_firestore/cloud_firestore.dart';
class Record {
final String name;
final int totalVotes;
final DocumentReference reference;
Record.fromMap(Map<String, dynamic> map, {this.reference})
: assert(map['name'] != null),
assert(map['totalVotes'] != null),
name = map['name'],
totalVotes = map['totalVotes'];
Record.fromSnapshot(DocumentSnapshot snapshot)
: this.fromMap(**snapshot.data**, reference: snapshot.reference);
@override
String toString() => "Record<$name:$totalVotes>";
}
class Voters {
String uid;
String voteId;
String markedVoteOption;
}
参数类型“Map
【问题讨论】:
-
你从哪里得到这个错误?
-
我在哪里添加了星号。 *** 就是这个。 Record.fromSnapshot(DocumentSnapshot 快照) : this.fromMap(snapshot.data, 参考:snapshot.reference);
标签: firebase flutter dart google-cloud-firestore