adar2378 / barikoi_api_flutter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

barikoi

A dart package for barikoi API. Barikoi is a Bangladeshi local data provider about places. Their API Helps us to find address, geocode and reverse geocode place in Dhaka in our local context.

Usage

Creating the instance:

BarikoiApi api = BarikoiApi(apiKey: <API_KEY>);

API_KEY can be obtained from https://barikoi.com/home

Supported API methods

  • Reverse GeoCoding
  • GeoCoding
  • Distance
  • Nearby
  • Auto-complete

Reverse GeoCoding

It takes 2 inputs, lat and lon. Short for latitude and longitude. Both has to be string. It will return a list of PlaceRCG. Which will contain the locations from that lat-lon.

await api.reverseGeoCoding(lat: "23.7833522", lon: "93.4248978")

GeoCoding

It takes a string which is the placeId of the location. You can directly access the details of a place using it's id. It will return an object which will contain all the information regarding that place.

await api.geoCoding(placeId: "5")

Nearby

It takes 2 inputs, lat and lon. Short for latitude and longitude. Both has to be string. Will return all the places nearby that coordinate in a list of PlaceNearby object.

await api.nearby(lat: "23.7833522", lon: "90.4248978");

AutoComplete

It takes a string, basically the query which the user want to search for. Then it will return a list of suggested places based on that query string.

await api.autoComplete(query: "barikoi")

Distance

It takes the coordinate of the source and target then returns a string which contains the distance.

await api.distance(
                      sourceLatitude: "90.4178546",
                      sourceLongitude: "23.7619058",
                      targetLatitude: "90.4178546",
                      targetLongitude: "23.5619058");

Exceptions

  • NotFoundException (If the data was empty)
  • OutSideDhakaException (If the coordinate is out of Dhaka)
  • LimitExceededException (If the limit of api calls is over)
  • TimeoutException (If the api call takes more than 15 seconds to complete)

About

License:MIT License


Languages

Language:Dart 94.7%Language:Objective-C 3.6%Language:Java 1.7%