State.fromJson constructor

State.fromJson({
  1. required dynamic jsonObject,
})

Implementation

factory State.fromJson({
  required dynamic jsonObject,
}) {
  return State(
    id: jsonObject["id"]?.toString() ?? "",
    code: jsonObject["code"] ?? "",
    name: jsonObject["name"] ?? "",
    countryId: jsonObject["countryId"],
    country: jsonObject["country"] != null ? Country.fromJson(jsonObject: jsonObject["country"]) : Country(),
    provinces: (jsonObject["Province"] as List<dynamic>?)?.map((province) => Province.fromJson(jsonObject: province)).toList() ?? [],
  );
}