64 lines
1.7 KiB
Dart
64 lines
1.7 KiB
Dart
// To parse this JSON data, do
|
|
//
|
|
// final barangay = barangayFromJson(jsonString);
|
|
|
|
import 'dart:convert';
|
|
|
|
Brgy barangayFromJson(String str) => Brgy.fromJson(json.decode(str));
|
|
|
|
String barangayToJson(Brgy data) => json.encode(data.toJson());
|
|
|
|
class Brgy {
|
|
final int? id;
|
|
final int? barangayId;
|
|
final String? barangayCode;
|
|
final String? cityCode;
|
|
final String? barangayDescription;
|
|
|
|
Brgy({
|
|
this.id,
|
|
this.barangayId,
|
|
this.barangayCode,
|
|
this.cityCode,
|
|
this.barangayDescription,
|
|
});
|
|
|
|
Brgy copy(
|
|
{int? id,
|
|
int? barangayId,
|
|
String? barangayCode,
|
|
String? cityCode,
|
|
String? barangayDescription}) {
|
|
return Brgy(
|
|
id: id ?? this.id,
|
|
barangayId: barangayId ?? this.barangayId,
|
|
barangayCode: barangayCode ?? this.barangayCode,
|
|
cityCode: cityCode ?? this.cityCode,
|
|
barangayDescription: barangayDescription ?? this.barangayDescription);
|
|
}
|
|
|
|
factory Brgy.fromJson(Map<String, dynamic> json) => Brgy(
|
|
id: json["id"],
|
|
barangayId: json["barangay_id"],
|
|
barangayCode: json["barangay_code"],
|
|
cityCode: json["city_code"],
|
|
barangayDescription: json["barangay_description"],
|
|
);
|
|
|
|
factory Brgy.fromJson2(Map<String, dynamic> json) => Brgy(
|
|
id: json["id"],
|
|
barangayId: json["barangayId"],
|
|
barangayCode: json["barangayCode"],
|
|
cityCode: json["cityCode"],
|
|
barangayDescription: json["barangayDescription"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"barangay_id": barangayId,
|
|
"barangay_code": barangayCode,
|
|
"city_code": cityCode,
|
|
"barangay_description": barangayDescription,
|
|
};
|
|
}
|