Skip to content

Best way to deserialize a list with generic argument factory #1138

Answered by rrousselGit
vware asked this question in Q&A
Discussion options

You must be logged in to vote

Do:

final list = json as List<Object?>;

return list.map(UserNotification.fromJson).toList();

There's little value in that ApiResponse class if you don't return it anyway

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by vware
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants