// To parse this JSON data, do // // final stateResponse = stateResponseFromJson(jsonString); import 'dart:convert'; StateResponse stateResponseFromJson(String str) => StateResponse.fromJson(json.decode(str)); String stateResponseToJson(StateResponse data) => json.encode(data.toJson()); class StateResponse { List data; StateResponse({ required this.data, }); factory StateResponse.fromJson(Map json) => StateResponse( data: List.from(json["data"].map((x) => StateInfo.fromJson(x))), ); Map toJson() => { "data": List.from(data.map((x) => x.toJson())), }; } class StateInfo { int countryId; int id; String name; bool isActive; StateInfo({ required this.countryId, required this.id, required this.name, required this.isActive, }); factory StateInfo.fromJson(Map json) => StateInfo( countryId: json["country_id"], id: json["id"], name: json["name"], isActive: json["is_active"], ); Map toJson() => { "country_id": countryId, "id": id, "name": name, "is_active": isActive, }; }