下面的代码给出了子类型的错误
代码
StreamBuilder(
stream: _database.orderByKey().onValue,
builder: (context, snapshot) {
final valudisp = <Card>[];
if (snapshot.hasData) {
final firstdata = snapshot.data! as Map<String, dynamic>;
firstdata.forEach((key, value) {
final datalast = new Map<String, dynamic>.from(value);
final coinname = datalast.keys;
final displaycard = Card(...);
valudisp.add(displaycard);
});
}
return Expanded(...);
});
}
现在我得到以下错误
type 'DatabaseEvent' is not a subtype of type 'Map<String,dynamic>' in typecast