loadAddressData static method
Implementation
static Future<List<AddressProvince>> loadAddressData (
BuildContext context) async {
if (_provinces != null && _provinces.isNotEmpty) {
return _provinces;
}
var address = await rootBundle.loadString('packages/fl_address_picker/assets/address.json');
var data = json.decode(address);
var provinces = <AddressProvince>[];
if (json != null && data is List) {
data.forEach((v) {
var province = AddressProvince.fromJson(v);
_provinceMap[province!.provinceid!] = province;
provinces.add(province);
});
_provinces = provinces;
return _provinces;
}
return <AddressProvince>[];
}