Reputation: 1379
This fails silently in Dart:
Map<String,String> dartMap = doc.data['keyForFieldthatContainsMap'];
doc is a firebase document (type DocumentSnapshot) that has a field "keyForFieldthatContainsMap" which contains a Map.
doc.data is of type:
Map<String,dynamic>
At runtime doc.data['keyForFieldthatContainsMap'] has the type:
_InternalLinkedHashMap<dynamic, dynamic>
from which I don't know how to access the keys and values.
I'm using the package:
import 'package:cloud_firestore/cloud_firestore.dart';
I'm looking for a way to read map fields just like I can read string, number, boolean,... fields from firebase.
Upvotes: 1
Views: 1118
Reputation: 182
Try to change your dartMap to Map<dynamic,dynamic>
. Your error might occour cause you cant now which types your Map in Firestore has.
Upvotes: 1