baato_api 1.0.3 copy "baato_api: ^1.0.3" to clipboard
baato_api: ^1.0.3 copied to clipboard

Flutter package to consume Baato APIs. You can search for places, reverse geo code and request for directions for several modes of transportation, including bike, foot and car.

Pub

baato-api #

Flutter library to help you consume Baato APIs.

Features #

  • Search
  • Reverse Geocoding
  • Places
  • Directions

Implementation #

This library is available at pub.dev. You can get the latest version from there. To get started, add the following to your package's pubspec.yaml file:

dependencies: baato_api: ^1.0.2 //use latest version

You can install packages from the command line:

with Flutter: flutter pub get

Now in your Dart code, you can use : import 'package:baato_api/baato_api.dart';

After initializing Baato with your access token and the query, the searchQuery method can be used to make requests to the Search API.

import 'package:baato_api/baato_api.dart';
import 'package:baato_api/models/search.dart';

void main() async {
  String baatoAccessToken = "your-baato-access-token";

  BaatoSearch baatoSearch = BaatoSearch.initialize(
    query: 'your-query',
    accessToken: baatoAccessToken,
    type: 'school', //optional parameter
    limit: 5, //optional parameter
  );

  //perform Search
  SearchResponse response = await baatoSearch.searchQuery();
  print(response);
}

2. Reverse GeoCode

import 'package:baato_api/baato_api.dart';
import 'package:baato_api/models/place.dart';

void main() async {
 String baatoAccessToken = "your-baato-access-token";

 BaatoReverse baatoReverse = BaatoReverse.initialize(
   latLon: GeoCoord(lat, lon),
   accessToken: baatoAccessToken,
 );

 //perform reverse Search
 PlaceResponse reverse = await baatoReverse.reverseGeocode();
 print(reverse);
}

3. Places

import 'package:baato_api/baato_api.dart';
import 'package:baato_api/models/place.dart';

void main() async {
 String baatoAccessToken = "your-baato-access-token";

 BaatoPlace baatoPlace = BaatoPlace.initialize(
   placeId: placeId, //placeId is required parameter
   accessToken: baatoAccessToken, //accessToken is required parameter
 );

 //perform the place lookup
 PlaceResponse placeResponse = await baatoPlace.getPlaceDetails();
 print(placeResponse);
}

4. Directions

import 'package:baato_api/baato_api.dart';
import 'package:baato_api/models/route.dart';

void main() async {
 var points = [];
 points.add("27.717844,85.3248188");
 points.add("27.6876224,85.33827");

 String baatoAccessToken = "your-baato-access-token";

 BaatoRoute baatoRoute = BaatoRoute.initialize(
     accessToken: baatoAccessToken,
     points: points,
     mode: "car", //can be 'bike', 'car', 'foot'
     alternatives: false, //optional parameter
     instructions: false); //optional parameter

 //get routes between start and destination point
 RouteResponse response = await baatoRoute.getRoutes();
 print(response);
}

6
likes
130
pub points
63%
popularity

Publisher

verified publisherbaato.io

Flutter package to consume Baato APIs. You can search for places, reverse geo code and request for directions for several modes of transportation, including bike, foot and car.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

crypto, dio, flutter

More

Packages that depend on baato_api