BJ Location Data
Benin Republic location data for web and mobile apps
For javacript version, please visit location_data_bj npm package
For raw data version, please visit bj_location_data_raw repository
Data Snapshot (As of 2023-12-21)
Department: 12
Town: 77
District: 546
Neighborhood: 5303
The
code
used in the dataset is an auto generated code. Please refer to the bj_location_data_raw repository for more information.
Note: This package is pure dart package. It can be used in in all platforms supported by dart.
Installation
In the dependencies: section of your pubspec.yaml, add the following line:
dependencies:
location_data_bj: <latest_version>
API Usage:
- Get all departments
List<Department> departments = LocationData.departmentList(sortBy: 'asc');
- Get all towns
List<Town> towns = LocationData.townsList(sortBy: 'asc');
- Get all districts
List<District> districts = LocationData.districtList(sortBy: 'asc');
- Get all neighborhoods
List<Neighborhood> neighborhoods = LocationData.neighborhoodList(sortBy: 'asc');
- Get department by code
Department? department = LocationData.department('cot');
- Get town by code
Town? town = LocationData.town('cot');
- Get district by code
District? district = LocationData.district('cot');
- Get neighborhood by code
Neighborhood? neighborhood = LocationData.neighborhood('cot');
- Get towns of department
List<Town> towns = LocationData.townsOfDepartment('cot', sortBy: 'asc');
- Get districts of town
List<District> districts = LocationData.districtsOfTown('cot', sortBy: 'asc');
- Get neighborhoods of district
List<Neighborhood> neighborhoods = LocationData.neighborhoodsOfDistrict('cot', sortBy: 'asc');
- Search data
List<LocationEntity> result = LocationData.searchData('cot', sortBy: 'asc');
- Search departments
List<Department> result = LocationData.searchDepartments('cot', sortBy: 'asc');
- Search towns
List<Town> result = LocationData.searchTowns('cot', sortBy: 'asc');
- Search districts
List<District> result = LocationData.searchDistricts('cot', sortBy: 'asc');
- Search neighborhoods
List<Neighborhood> result = LocationData.searchNeighborhoods('cot', sortBy: 'asc');
Data Model:
- Base LocationEntity
abstract class LocationEntity {
String code;
String name;
LocationEntity({
required this.code,
required this.name,
});
}
- Department
class Department implements LocationEntity {
@override
final String code;
@override
final String name;
Department({
required this.code,
required this.name,
});
}
- Town
class Town implements LocationEntity {
@override
final String code;
@override
final String name;
final String departmentCode;
Town({
required this.code,
required this.name,
required this.departmentCode,
});
}
- District
class District implements LocationEntity {
@override
final String code;
@override
final String name;
final String townCode;
District({
required this.code,
required this.name,
required this.townCode,
});
}
- Neighborhood
class Neighborhood implements LocationEntity {
@override
final String code;
@override
final String name;
final String districtCode;
Neighborhood({
required this.code,
required this.name,
required this.districtCode,
});
}
Disclaimer
Please note that the dataset used is not official. It is based on the work done by the Junior Gantin at this repos.
License
Bj Location Data is crafted with ❤️ by Dah-Kenangnon Justin and is open-sourced software licensed under the MIT license.
These person has helped me for cleaning the data and making it easier to use in dart and javascript:
- Big thanks to Jude AGBODOYETIN
- Big thanks to Yanel Aïna