Skip to content

Commit

Permalink
Add listFromJson method to fix #4887 (#5355)
Browse files Browse the repository at this point in the history
  • Loading branch information
selankon authored May 2, 2020
1 parent 7d5695e commit 6439990
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class {{classname}} {
static {{classname}} fromJson({{dataType}} value) {
return new {{classname}}TypeTransformer().decode(value);
}

static List<{{classname}}> listFromJson(List<dynamic> json) {
return json == null ? new List<{{classname}}>() : json.map((value) => {{classname}}.fromJson(value)).toList();
}
}

class {{classname}}TypeTransformer {
Expand Down

0 comments on commit 6439990

Please sign in to comment.