Last updated:
0 purchases
location data bj
BJ Location Data #
Benin Republic location data for web and mobile apps
For javascript 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 all platforms supported by dart.
For flutter users, note that we don't provide any widget for now. Feel free to contribute.
Installation #
In the dependencies: section of your pubspec.yaml, add the following line:
dependencies:
location_data_bj: <latest_version>
copied to clipboard
API Usage: #
Get all departments
List<Department> departments = LocationData.departmentList(sortBy: 'asc');
copied to clipboard
Get all towns
List<Town> towns = LocationData.townsList(sortBy: 'asc');
copied to clipboard
Get all districts
List<District> districts = LocationData.districtList(sortBy: 'asc');
copied to clipboard
Get all neighborhoods
List<Neighborhood> neighborhoods = LocationData.neighborhoodList(sortBy: 'asc');
copied to clipboard
Get department by code
Department? department = LocationData.department('cot');
copied to clipboard
Get town by code
Town? town = LocationData.town('cot');
copied to clipboard
Get district by code
District? district = LocationData.district('cot');
copied to clipboard
Get neighborhood by code
Neighborhood? neighborhood = LocationData.neighborhood('cot');
copied to clipboard
Get towns of department
List<Town> towns = LocationData.townsOfDepartment('cot', sortBy: 'asc');
copied to clipboard
Get districts of town
List<District> districts = LocationData.districtsOfTown('cot', sortBy: 'asc');
copied to clipboard
Get neighborhoods of district
List<Neighborhood> neighborhoods = LocationData.neighborhoodsOfDistrict('cot', sortBy: 'asc');
copied to clipboard
Search data
List<LocationEntity> result = LocationData.searchData('cot', sortBy: 'asc');
copied to clipboard
Search departments
List<Department> result = LocationData.searchDepartments('cot', sortBy: 'asc');
copied to clipboard
Search towns
List<Town> result = LocationData.searchTowns('cot', sortBy: 'asc');
copied to clipboard
Search districts
List<District> result = LocationData.searchDistricts('cot', sortBy: 'asc');
copied to clipboard
Search neighborhoods
List<Neighborhood> result = LocationData.searchNeighborhoods('cot', sortBy: 'asc');
copied to clipboard
Data Model:
Base LocationEntity
abstract class LocationEntity {
String code;
String name;
LocationEntity({
required this.code,
required this.name,
});
}
copied to clipboard
Department
class Department implements LocationEntity {
@override
final String code;
@override
final String name;
Department({
required this.code,
required this.name,
});
}
copied to clipboard
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,
});
}
copied to clipboard
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,
});
}
copied to clipboard
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,
});
}
copied to clipboard
Disclaimer #
Please note that the dataset used is not official. It is based on the work done by Junior Gantin at this repo.
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.