Compilation error

Resolved

When I use the Test Function I get the following error:

Screenshot 2024-01-22 12.41.01 PM.png
13.12KB

Compilation error: Info: Compiling with sound null safety lib/main.dart:15:10: Error: Undefined name 'FirebaseFirestore'. return FirebaseFirestore.instance ^^^^^^^^^^^^^^^^^ Error: Compilation failed.

Here's my code:

dynamic generateHistory(DocumentReference id) {
  /// MODIFY CODE ONLY BELOW THIS LINE
  return FirebaseFirestore.instance
      .collection('chat_messages')
      .where('chat', isEqualTo: id)
      .orderBy('timestamp')
      .snapshots()
      .map((snapshot) => snapshot.docs
          .map((doc) => {'role': doc['role'], 'text': doc['text']})
          .toList());
  /// MODIFY CODE ONLY ABOVE THIS LINE
}
3
6 replies