Answers for "flutter json to class"

1

flutter json to class

//insideclass
ClassName.fromJson(Map<String, dynamic> json) {
    variable1 = json['variable11'];
    variable2 = json['variable12'];
    variable3 = json['variable13']['variable14'];
}

//uses
//after http request or whatever
Map<dynamic, dynamic> res = await jsonDecode(response.body.toString());
Classname.fromJson(res);
Posted by: Guest on March-20-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language