Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firestore_serialize] Serialize Maps? #36

Open
ciriousjoker opened this issue Aug 24, 2020 · 3 comments
Open

[firestore_serialize] Serialize Maps? #36

ciriousjoker opened this issue Aug 24, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@ciriousjoker
Copy link
Contributor

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<...>()

@ciriousjoker
Copy link
Contributor Author

My workaround for now:

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

@ciriousjoker ciriousjoker changed the title Serialize Maps? [firestore_serialize] Serialize Maps? Aug 24, 2020
@lukas-h
Copy link
Member

lukas-h commented Aug 28, 2020

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

@lukas-h
Copy link
Member

lukas-h commented Aug 28, 2020

} else if (el is TypeParameterElementImpl) {

@lukas-h lukas-h added the bug Something isn't working label Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants