forex 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new61

A Dart plugin for retrieving currency exchange rates.

pub package Build Status

This package provides a set of high-level functions and classes that make it easy to retrieve currency exchange rates. It's platform-independent, supports iOS and Android.

Using #

The easiest way to use this library is via the top-level functions. They allow you to make currency exchange rate requests with minimal hassle:

  Map<String, num> quotes = await Forex.fx(
      quoteProvider: QuoteProvider.yahoo,
      base: 'USD',
      quotes: <String>['EUR']);

  print('Number of quotes retrieved: ${quotes.keys.length}.');
  print('Exchange rate USDEUR: ${quotes['USDEUR']}.');

If you're making multiple quote requests to the same server, you can request all of them in a single function call:

  quotes = await Forex.fx(
      quoteProvider: QuoteProvider.ecb,
      base: 'JPY',
      quotes: <String>['EUR', 'USD']);

  print('Number of quotes retrieved: ${quotes.keys.length}.');
  print('Exchange rate JPYEUR: ${quotes['JPYEUR']}.');
  print('Exchange rate JPYUSD: ${quotes['JPYUSD']}.');

Supported providers #

  • European Central Bank (ECB)
  • Yahoo

TERMS & CONDITIONS

Quote information fetched through this module is bound by the quote providers terms and conditions.

[0.1.0] - 5/10/19

  • Initial implementation of forex plugin.

example/main.dart

import 'package:forex/forex.dart';

Future<void> main(List<String> arguments) async {
  Map<String, num> quotes = await Forex.fx(
      quoteProvider: QuoteProvider.yahoo,
      base: 'USD',
      quotes: <String>['EUR', 'JPY']);

  print('Number of quotes retrieved: ${quotes.keys.length}.');
  print('Exchange rate USDEUR: ${quotes['USDEUR']}.');
  print('Exchange rate USDJPY: ${quotes['USDJPY']}.');

  quotes = await Forex.fx(
      quoteProvider: QuoteProvider.ecb,
      base: 'JPY',
      quotes: <String>['EUR', 'USD']);

  print('Number of quotes retrieved: ${quotes.keys.length}.');
  print('Exchange rate JPYEUR: ${quotes['JPYEUR']}.');
  print('Exchange rate JPYUSD: ${quotes['JPYUSD']}.');
}

Use this package as a library

1. Depend on it

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


dependencies:
  forex: ^0.1.0

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:forex/forex.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
23
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
98
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:forex/forex.dart with components: io.

Maintenance suggestions

The package description is too short. (-2 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
finance_quote ^0.1.2 0.1.2
http ^0.12.0 0.12.0+2
logger ^0.7.0+2 0.7.0+2
meta ^1.1.7 1.1.7
xml ^3.5.0 3.5.0
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
csslib 0.16.1
html 0.14.0+3
http_parser 3.1.3
intl 0.16.0
path 1.6.4
petitparser 2.4.0
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
mockito ^4.1.0
pedantic ^1.8.0+1 1.8.0+1
test >=1.3.0 <1.6.8