Stream<QueryDocumentSnapshot<List>> get userData {
return userDataCollection.snapshots()
.map(_userDataListFromSnapshot);
}
}
lib/screens/home/home.dart:16:32: Error: The argument type 'Stream<QueryDocumentSnapshot<List>>' can't be assigned to the parameter type 'Stream<QuerySnapshot
'Stream' is from 'dart:async'.
'QueryDocumentSnapshot' is from 'package:cloud_firestore/cloud_firestore.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.4.0/lib/cloud_firestore.dart').
'List' is from 'dart:core'.
'UserDataList' is from 'package:googletestconnection/models/userData.dart' ('lib/models/userData.dart').
'QuerySnapshot' is from 'package:cloud_firestore/cloud_firestore.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.4.0/lib/cloud_firestore.dart').
'Object' is from 'dart:core'.
value: DatabaseService().userData,
^
lib/services/database.dart:35:10: Error: The argument type 'List Function(QueryDocumentSnapshot
'List' is from 'dart:core'.
'UserDataList' is from 'package:googletestconnection/models/userData.dart' ('lib/models/userData.dart').
'QueryDocumentSnapshot' is from 'package:cloud_firestore/cloud_firestore.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.4.0/lib/cloud_firestore.dart').
'Object' is from 'dart:core'.
'QuerySnapshot' is from 'package:cloud_firestore/cloud_firestore.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.4.0/lib/cloud_firestore.dart').
.map(_userDataListFromSnapshot);
^
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:googletestconnection/models/userData.dart';
class DatabaseService{
final String uid; DatabaseService ({this.uid}); //collection Refferences
final CollectionReference userDataCollection = FirebaseFirestore.instance.collection('userData');
Future updateUserData(String sugars, String name, int strength) async { return await userDataCollection.doc(uid).set({ 'sugars': sugars, 'name': name, 'strength': strength, }); } //User data collection List _userDataListFromSnapshot(QueryDocumentSnapshot snapshot) {
return snapshot.get('doc').map((doc) {
return UserDataList(
name: doc.data['name'] ?? '',
strength: doc.data['strength'] ?? 0,
sugars: doc.data['sugars'] ?? '0'
);
} //get user profile data
Stream<QueryDocumentSnapshot<List>> get userData {
return userDataCollection.snapshots()
.map(_userDataListFromSnapshot);
}
}
lib/screens/home/home.dart:16:32: Error: The argument type 'Stream<QueryDocumentSnapshot<List>>' can't be assigned to the parameter type 'Stream<QuerySnapshot