Giter VIP home page Giter VIP logo

location_data_bj_dart's Introduction

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>

API Usage:

  1. Get all departments
List<Department> departments = LocationData.departmentList(sortBy: 'asc');
  1. Get all towns
List<Town> towns = LocationData.townsList(sortBy: 'asc');
  1. Get all districts
List<District> districts = LocationData.districtList(sortBy: 'asc');
  1. Get all neighborhoods
List<Neighborhood> neighborhoods = LocationData.neighborhoodList(sortBy: 'asc');
  1. Get department by code
Department? department = LocationData.department('cot');
  1. Get town by code
Town? town = LocationData.town('cot');
  1. Get district by code
District? district = LocationData.district('cot');
  1. Get neighborhood by code
Neighborhood? neighborhood = LocationData.neighborhood('cot');
  1. Get towns of department
List<Town> towns = LocationData.townsOfDepartment('cot', sortBy: 'asc');
  1. Get districts of town
List<District> districts = LocationData.districtsOfTown('cot', sortBy: 'asc');
  1. Get neighborhoods of district
List<Neighborhood> neighborhoods = LocationData.neighborhoodsOfDistrict('cot', sortBy: 'asc');
  1. Search data
List<LocationEntity> result = LocationData.searchData('cot', sortBy: 'asc');
  1. Search departments
List<Department> result = LocationData.searchDepartments('cot', sortBy: 'asc');
  1. Search towns
List<Town> result = LocationData.searchTowns('cot', sortBy: 'asc');
  1. Search districts
List<District> result = LocationData.searchDistricts('cot', sortBy: 'asc');
  1. Search neighborhoods
List<Neighborhood> result = LocationData.searchNeighborhoods('cot', sortBy: 'asc');

Data Model:

  1. Base LocationEntity
abstract class LocationEntity {
  String code;
  String name;

  LocationEntity({
    required this.code,
    required this.name,
  });
}
  1. Department
class Department implements LocationEntity {
  @override
  final String code;
  @override
  final String name;

  Department({
    required this.code,
    required this.name,
  });
}
  1. 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,
  });
}
  1. 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,
  });
}
  1. 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 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:

location_data_bj_dart's People

Contributors

dahkenangnon avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.