An exception was throw by _MapStream<QuerySnapshot> #4434
Unanswered
jeswinjessor
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I was trying to fetch data from firestore using provider and this exception was thrown, have no idea what went wrong.
The following assertion was thrown:
> listened byAn exception was throw by _MapStream<QuerySnapshot, List
StreamProvider<List>, but no
catchError
was provided.Exception:
type 'int' is not a subtype of type 'double'
ADDRESS CLASS
Address.fromFirestore(Map<String, dynamic> firestore)
: addressID = firestore['addressID'],
streetNumber = firestore['streetNumber'],
streetName = firestore['streetName'],
city = firestore['city'],
province = firestore['province'],
customerContact = firestore['customerContact'],
numberOfBedrooms = firestore['numberOfBedrooms'],
numberOfFamilyRooms = firestore['numberOfFamilyRooms'],
squareFeet = firestore['squareFeet'],
customerName = firestore['customerName'],
appointmentDate = DateFormat("yyyy-MM-dd").parse(firestore['appointmentDate']),
nextAppointmentDate = DateFormat("yyyy-MM-dd").parse(firestore['nextAppointmentDate']),
price = firestore['price'];
DATABASE SERVICE
> getAddress(){Stream<List
return _db.collection('addressCollection').snapshots().map((snapshot) =>
snapshot.docs.map((document) => Address.fromFirestore(document.data())).toList());
}
WIDGET CLASS
>(context, listen: false);@OverRide
Widget build(BuildContext context) {
final address = Provider.of<List
}
MAIN
providers: [
ChangeNotifierProvider(create: (context) => AddressProvider(),),
StreamProvider(create: (context) => firestoreService.getAddress()),
],
**I have used another provider in the same project for different collection and it worked fine, just the address is giving hard time
Beta Was this translation helpful? Give feedback.
All reactions