open_exchange_rates 0.0.2 open_exchange_rates: ^0.0.2 copied to clipboard
A dartlang wrapping for openexchangerates api requests.
open_exchange_rates #
The open_exchange_rates library is a dartlang wrapping and make it easy to use.
It's still under development #
Any suggestions are welcome.
How to use? #
- Registry and get an app key from open_exchange_rates
- Example Code Here:
#
import 'package:open_exchange_rates/open_exchange_rates.dart';
// example code
main() async {
String api_key = 'api_key';
// Query Latest
QueryLatest latest = QueryLatest.get();
latest.query.add(Params(api_key: api_key));
latest.results.forEach(
(item) => item.forEach((val) => print('${val.currency}: ${val.ratio}')));
latest.dispose();
// Query Currencies
QueryCurrencies currencies = QueryCurrencies.get();
currencies.query.add(Params(api_key: api_key));
currencies.results.forEach(
(item) => item.forEach((val) => print('${val.currency}: ${val.name}')));
currencies.dispose();
// Query Historical
QueryHistorical historical = QueryHistorical.get();
historical.query.add(Params(api_key: api_key, date: '2018-07-01'));
historical.results.forEach(
(item) => item.forEach((val) => print('${val.currency}: ${val.ratio}')));
historical.dispose();
}