I am trying to get a list from firebase document and then set to another empty List of maps then add a map to this list of maps and pass it back to Firebase.
This is My method:
Future logFinalWorkout(user, finalWorkout) async{
List<Map<dynamic, dynamic>> result = List<Map<dynamic, dynamic>>();
await users.document(user.uid).get().then((doc){
result = doc.data['finalWorkouts'];
result.addAll(finalWorkout);
});
return await users.document(user.uid).updateData({
'finalWorkouts' : result,
});
}
finalWorkout parameter is of type Map<dynamic,dynamic>
final workouts represents the list coming from Firebase. I keep getting the above error
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…