Map Firestore documents in Flutter

Map Firestore documents in Flutter into a custom object can be tricky, but it doesn’t have to be. Let’s say you have a firestore collection query like this inside your initState for listening on changes from a collection: Then you have a function like this to handle each document in a map function My TalkSession …

method ‘[]’ can’t be unconditionally invoked because the receiver can be ‘null’ with Firestore

If you are working with null safety in Dart and Flutter then I recommend checking this documentation out which explains various small fixes if you have problems working with null values and null safety. Usually you can just simply use the exclamation mark just before a property to check any other value if it also …