open_exchange_rates 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 39

open_exchange_rates #

The open_exchange_rates library is a dartlang wrapping and make it easy to use.

pub package

How to use? #

  1. Registry and get an app key from open_exchange_rates
  2. Example Code Here:
import 'package:open_exchange_rates/open_exchange_rates.dart' as Oxr;

void main(List<String> args) async {
  Oxr.New oxr = new Oxr.New(args[0]);
  var latest = await oxr.latest.Get(base: 'TWD', symbols: 'JPY,USD,SEK,GBP');
  var currencies = await oxr.currencies.Get();
  var historical = await oxr.historical
      .Get(date: '2018-07-01', base: 'TWD', symbols: 'JPY,USD,SEK,GBP');
  var timeseries = await oxr.timeseries.Get(
      start: '2018-07-01',
      end: '2018-07-14',
      base: 'TWD',
      symbols: 'JPY,USD,SEK,GBP');
  var convert = await oxr.convert.Get(value: '100', from: 'TWD', to: 'USD');
  var ohlc =
      await oxr.ohlc.Get(start_time: '2018-07-01T00:00:00Z', period: '1mo');
  var usage = await oxr.usage.Get();

  print(latest);
  print(currencies);
  print(historical);
  print(timeseries);
  print(convert);
  print(ohlc);
  print(usage);
}

Run example #

dart example/main.dart ${api_key}

1.0.0 #

  • Add error handling
  • First release

0.1.0 #

  • Refactor code structure
  • All api will return json object(Map) instead of class
  • All api provided from openchangerates are implemented.
  • Update example code

0.0.5 #

  • fix uri query parameters error

0.0.4 #

  • add null item to stop stream

0.0.3 #

  • Cleanup unused package
  • Refactor some parts of code
  • Update example
  • Add TODO list

0.0.2 #

Supported API Endpoints

  • /latest.json
  • /currencies.json
  • /historical/${date}.json

Update API usage example.

0.0.1 #

Supported API Endpoints

  • /latest.json
  • /currencies.json

example/main.dart

import 'package:open_exchange_rates/open_exchange_rates.dart' as Oxr;

void main(List<String> args) async {
  Oxr.New oxr = new Oxr.New(args[0]);
  var latest = await oxr.latest.Get(base: 'TWD', symbols: 'JPY,USD,SEK,GBP');
  var currencies = await oxr.currencies.Get();
  var historical = await oxr.historical
      .Get(date: '2018-07-01', base: 'TWD', symbols: 'JPY,USD,SEK,GBP');
  var timeseries = await oxr.timeseries.Get(
      start: '2018-07-01',
      end: '2018-07-14',
      base: 'TWD',
      symbols: 'JPY,USD,SEK,GBP');
  var convert = await oxr.convert.Get(value: '100', from: 'TWD', to: 'USD');
  var ohlc =
      await oxr.ohlc.Get(start_time: '2018-07-01T00:00:00Z', period: '1mo');
  var usage = await oxr.usage.Get();

  print(latest);
  print(currencies);
  print(historical);
  print(timeseries);
  print(convert);
  print(ohlc);
  print(usage);
}

Use this package as a library

1. Depend on it

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


dependencies:
  open_exchange_rates: ^1.0.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:open_exchange_rates/open_exchange_rates.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
92
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
58
Overall:
Weighted score of the above. [more]
39
Learn more about scoring.

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

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:open_exchange_rates/open_exchange_rates.dart.

Health issues and suggestions

Document public APIs. (-1 points)

17 out of 17 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/api/oxr_base.dart. (-3.45 points)

Analysis of lib/src/api/oxr_base.dart reported 7 hints, including:

line 4 col 24: Unnecessary new keyword.

line 6 col 28: Unnecessary new keyword.

line 8 col 28: Unnecessary new keyword.

line 10 col 28: Unnecessary new keyword.

line 12 col 25: Unnecessary new keyword.

Fix lib/src/oxr_export.dart. (-3.45 points)

Analysis of lib/src/oxr_export.dart reported 7 hints, including:

line 18 col 14: Unnecessary new keyword.

line 19 col 18: Unnecessary new keyword.

line 20 col 18: Unnecessary new keyword.

line 21 col 15: Unnecessary new keyword.

line 22 col 12: Unnecessary new keyword.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (http).

Package is getting outdated. (-32.05 points)

The package was last published 68 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.55.0 <3.0.0
http ^0.11.3+17 0.11.3+17 0.12.0+2
uri ^0.11.3 0.11.3+1
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
matcher 0.12.6
meta 1.1.8
path 1.6.4
quiver 2.1.2+1
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
utf 0.9.0+5