Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

im learning how to connect flutter app to firebase from this video

https://youtu.be/ggYTQn4WVuw

For me everything is exactly the same, but in Android Studio there is an error.

error: The operator '[]' isn't defined for the type 'Object'. (undefined_operator at [firebase_test] libservicesdatabase.dart:24)

Code where is error:

List<Brew> _brewListFromSnapshot(QuerySnapshot snapshot) {
return snapshot.docs.map((doc) {
  return Brew(
    name: doc.data()['name'] ?? '',
    strength: doc.data()['strength'] ?? 0,
    sugars: doc.data()['sugars'] ?? '0',
  );
}).toList();}

Brew Class:

class Brew {
  final String name;
  final String sugars;
  final int strength;

  Brew({ this.name, this.sugars, this.strength });
}

Can someone help me fix this? Is this a problem with Android Studio?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.5k views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...