Skip to content

Deserialization fails for listMatches #154

@tiptobi

Description

@tiptobi

I have the problem, that the NakamaBaseClient.listMatches() always throws an exception as soon as there are actually matches on the server. So I tried to debug the issue. What I found is:

In nakama_api_client.dart line 1418 we have in the listMatches() function:
return res.matches?.map((e) => model.Match.fromJson(e.toJson())).toList(growable: false) ?? [];

So i checked, what toJson() and Match.fromJson() is actually doing.

toJson() is pointing to this function in api_client.gen.g.dart line 474-481 (sorry for using screenshots, I couldn't get the formatting work):

Image

And this is the Match.fromJson() in match.freezed.dart line 17-28

Image

So in my opinion, this will always throw, because the toJson() doesn't set the key 'runtimeType' and the fromJson does throw when this key is not set.
Just for the sake of completeness, this is also the error I get:

Image

I am not sure how this should be fixed, because the whole code generation library is new to me, maybe someone know how it should be?
I am using nakama 1.3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions