taxifarefinder 2.0.0 copy "taxifarefinder: ^2.0.0" to clipboard
taxifarefinder: ^2.0.0 copied to clipboard

A Dart wrapper for the TaxiFareFinder API <https://www.taxifarefinder.com/api.php>

example/taxifarefinder_example.dart

import 'package:taxifarefinder/taxifarefinder.dart';

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

  try {
    final 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);

    final 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);

    for (final extraCharge in fare.extraCharges) {
      print(extraCharge.charge);
      print(extraCharge.description);
    }

    for (final flatRate in fare.flatRates) {
      print(flatRate.charge);
      print(flatRate.description);
    }

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

    for (final taxiCompany in taxiCompanies) {
      print(taxiCompany.name);
      print(taxiCompany.phone);
      print(taxiCompany.type);
    }
  } on TffException catch (e) {
    print('TffException: ${e.message()}');
  } catch (e) {
    print('Exception: $e');
  }
}
0
likes
130
pub points
0%
popularity

Publisher

verified publishertomoehlrich.com

A Dart wrapper for the TaxiFareFinder API <https://www.taxifarefinder.com/api.php>

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

http, json_annotation

More

Packages that depend on taxifarefinder