Dart - how _InternalLinkedHashMap<String, dynamic> convert to Map<String, dynamic>?
Try this:
Map<String, dynamic>.from(yourData)
You don't need to do any conversion. _InternalLinkedHashMap<K, V>
is already a type of Map<K, V>
.
void main() async {
final map = <String, int>{};
print(map.runtimeType);
print('${map is Map<String, int>}');
}
prints:
_InternalLinkedHashMap<String, int>
true
(Map
's default constructor is a factory constructor that constructs a LinkedHashMap
. LinkedHashMap
's default constructor is also a factory constructor, and the implementation for the Dart VM constructs and returns an internal _InternalLinkedHashMap
object.)