i have encountered this error :
The argument type 'Object' can't be assigned to the parameter type 'Map<String, dynamic>?
in this line of code :
listMakans = query.docs.map((m) => Makan.fromSnapshot(m.data()!)).toList();
and here is the code for (Makan.fromSnapshot):
Makan.fromSnapshot(Map<String, dynamic>? snapshot)
: id = snapshot!['id'],
owner = snapshot['owner'],
category = snapshot['category'],
hobby = snapshot['hobby'],
business = snapshot['business'],
title = snapshot['title'],
details = snapshot['details'],
latlng = snapshot['latlng'],
from = snapshot['from'].toDate(),
to = snapshot['to'].toDate(),
created = snapshot['created'].toDate(),
updated = snapshot['updated'].toDate();
i didn't understand where the Object here?
listMakans = query.docs.map((m) => Makan.fromSnapshot(m.data() as Map<String, dynamic>?)).toList();
Remove ?
from
Makan.fromSnapshot(Map<String, dynamic>
This (m.data()!))
is the Object in the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With