I am trying to get data from Firestore and the data type is a number. I want to assign it to a double variable in my code. Here is the Firestore methods.
Future getPercentage(FirebaseUser user, String packageCode) async{
await users.document(user.uid).collection('myPackages').document(packageCode).get().then((doc) {
return doc.data['percentCompleted'];
});
} }
So the returned value from get() 'percentCompleted' is a number and I am trying to assign to a double variable 'percent',
percent: _db.getPercentage(user, packageCode),
then i get the above error.