0

error is:

Closure call with mismatched arguments: function '[]'
Receiver: Closure: () => Map<String, dynamic> from Function 'data':.
Tried calling: []("quizImgUrl")
Found: []() => Map<String, dynamic>

trying to get image url in my code from:

ListView.builder(
                  itemCount: snapshot.data.documents.length,
                  itemBuilder: (context, index) {
                    return QuizTile(
                      imgUrl: snapshot.data.documents[index].data["quizImgUrl"],
                      desc: snapshot.data.documents[index].data["quizDesc"],
                      title: snapshot.data.documents[index].data["quizTitle"],
                    );
                  });

getting data from firebase as:

getQuizData() async {
    return await Firestore.instance.collection("Quiz").snapshots();
  }
3
  • There is a get method for accessing the data in firestore plugin like snapshot.data.documents[index].data.get("quizImgUrl"). Commented Sep 6, 2020 at 14:38
  • Thank you @ShahryarRafique for your suggestions. I can access the data using: snapshot.data.document[index].get("quizImgUrl") Commented Sep 9, 2020 at 6:36
  • thanks for correcting my comment for future use.:-) Commented Sep 9, 2020 at 14:22

1 Answer 1

1

user snapshot.data.docs instead. They had many breaking changes in the latest updates to firebase packages.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.