dartclub/firestore_dart

[firestore_serialize] Serialize Maps?

Opened this issue · 3 comments

Exception has occurred.
_TypeError (type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'Map<String, List<String>>')

This is the generated code:
selectedTags: data["selectedTags"]

It's just lacking a .cast<...>()

My workaround for now:

  MyModel({
    this.selfRef,
    selectedTags,
  }) {
    this.selectedTags = (selectedTags as Map).cast<String, List<String>>();
  }

The problem is that dart analyzer looses the type information of nested generic type annotations.

It’s a thing I wanted to investigate more in depth

} else if (el is TypeParameterElementImpl) {