185-advanced-flutter-firestore
185-advanced-flutter-firestore copied to clipboard
The method 'map' was called on null.
Hi, I'm posting the issue to learn the best way to implement a solution. It seems the Container widget in WeaponsList class is rendered before the provider returns the actual list from the DB, hence The method 'map' is being called on null.
I/flutter ( 7218): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 7218): The following NoSuchMethodError was thrown building WeaponsList(dirty, dependencies:
I/flutter ( 7218): [_Provider<FirebaseUser>, _Provider<List<Weapon>>]):
I/flutter ( 7218): The method 'map' was called on null.
I/flutter ( 7218): Receiver: null
I/flutter ( 7218): Tried calling: map<Card>(Closure: (Weapon) => Card)
I/flutter ( 7218):
I/flutter ( 7218): When the exception was thrown, this was the stack:
I/flutter ( 7218): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
I/flutter ( 7218): #1 WeaponsList.build (package:qodorat/main.dart:136:27)