passo_mobile_app/lib/model/location/barangay.dart

42 lines
1022 B
Dart
Raw Normal View History

2023-02-15 03:40:12 +00:00
// To parse this JSON data, do
//
// final barangay = barangayFromJson(jsonString);
import 'package:meta/meta.dart';
import 'dart:convert';
2023-02-20 07:48:24 +00:00
import 'city.dart';
import 'provinces.dart';
2023-02-15 03:40:12 +00:00
Barangay barangayFromJson(String str) => Barangay.fromJson(json.decode(str));
String barangayToJson(Barangay data) => json.encode(data.toJson());
class Barangay {
Barangay({
required this.code,
required this.description,
required this.cityMunicipality,
});
final String? code;
final String? description;
final CityMunicipality? cityMunicipality;
2023-02-15 03:40:12 +00:00
factory Barangay.fromJson(Map<String, dynamic> json) => Barangay(
code: json["code"],
description: json["description"],
cityMunicipality: json['city_municipality'] == null? null: CityMunicipality.fromJson(json["city_municipality"]),
2023-02-15 03:40:12 +00:00
);
Map<String, dynamic> toJson() => {
"code": code,
"description": description,
"city_municipality": cityMunicipality!.toJson(),
2023-02-15 03:40:12 +00:00
};
}