taxifarefinder 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

taxifarefinder #

A wrapper for the TaxiFareFinder API. Documentation of the API can be found at https://www.taxifarefinder.com/api.php.

The required TaxiFareFinder API key can be requested at https://www.taxifarefinder.com/contactus.php.

Usage #

import 'package:taxifarefinder/taxifarefinder.dart';

var taxiFareFinder = TaxiFareFinder('<YOUR API KEY>');

// Find the nearest city supported by the TaxiFareFinder API
// A complete list if supported entities can be found at 
// https://www.taxifarefinder.com/api.php#entities
TffCity nearestCity = await taxiFareFinder.getNearestCity(13.736717, 100.523186);


// Get fare information like total fare, distance or tip information
TffFare fare = await taxiFareFinder.getFare(
    3.147948, 101.710347, 3.144169, 101.718519,
    traffic: TffTraffic.light);


// Retrieve a list of taxi companies in a supported city
List<TffTaxiCompany> companies = await taxiFareFinder.getTaxiCompanies('London');

1.0.1 #

  • Updated json_serializable and json_annotiation packages.

1.0.0 #

  • Intitial release

example/taxifarefinder_example.dart

import 'package:taxifarefinder/taxifarefinder.dart';

main() async {
  var taxiFareFinder = TaxiFareFinder('<YOUR API KEY>');

  try {
    TffCity nearestCity =
        await taxiFareFinder.getNearestCity(42.356261, -71.065334);

    print(nearestCity.distance);
    print(nearestCity.fullName);
    print(nearestCity.handle);
    print(nearestCity.howFound);
    print(nearestCity.locale);
    print(nearestCity.name);

    TffFare fare = await taxiFareFinder.getFare(
        3.147948, 101.710347, 3.144169, 101.718519,
        traffic: TffTraffic.light);

    print(fare.currencySymbol);
    print(fare.distance);
    print(fare.duration);
    print(fare.initialFare);
    print(fare.locale);
    print(fare.meteredFare);
    print(fare.rateArea);
    print(fare.tipAmount);
    print(fare.tipPercentage);
    print(fare.totalFare);
    print(fare.totalFareWithoutTip);

    fare.extraCharges.forEach((extraCharge) {
      print(extraCharge.charge);
      print(extraCharge.description);
    });
    fare.flatRates.forEach((flatRate) {
      print(flatRate.charge);
      print(flatRate.description);
    });

    List<TffTaxiCompany> taxiCompanies =
        await taxiFareFinder.getTaxiCompanies('London');

    taxiCompanies.forEach((taxiCompany) {
      print(taxiCompany.name);
      print(taxiCompany.phone);
      print(taxiCompany.type);
    });
  } on TffException catch (e) {
    print('TffException: ${e.message()}');
  } catch (e) {
    print('Exception: $e');
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  taxifarefinder: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:taxifarefinder/taxifarefinder.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Dec 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
http ^0.12.0+2 0.12.0+2
json_annotation ^3.0.0 3.0.0
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
meta 1.1.8
path 1.6.4
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_runner ^1.0.0
json_serializable ^3.2.0
pedantic ^1.0.0 1.9.0
test ^1.6.5