Every thing was working good but when i upgraded my cloud firestore dependecy. I started getting an error "The operator '[]' isn't defined for the type 'Object'. ". This error is coming in front of all the 4 userData.data()[""],
class BaseProvider with ChangeNotifier {
//instances of firebase
final FirebaseAuth _auth = FirebaseAuth.instance;
final CollectionReference postsCollection =
FirebaseFirestore.instance.collection("posts");
final CollectionReference userCollection =
FirebaseFirestore.instance.collection("users");
//Creating post
Future addPost(
) async {
DocumentSnapshot userData =
await userCollection.doc(_auth.currentUser.uid).get();
return await postsCollection.doc().set({
"id": _auth.currentUser.uid,
"sellername": userData.data()["name"], //Error
"sellercontact": userData.data()["phone"], //Error
"sellercity": userData.data()["city"], //Error
"sellerstate": userData.data()["state"], //Error
});
}