A Flutter package to quickly fetch Forex prices and perform currency cinversions.

Features

  • List of all forex prices in the open market.
  • Convert money from one currency to another using open market prices.

Getting started

import 'package:forex_conversion/forex_conversion.dart';

Usage

If you want the latest prices of all currencies with respect to price of USD, you can do it with minimal hassle.

  final fx = Forex();
  Map<String, double> allPrices = await fx.getAllCurrenciesPrices();
  print("Exchange rate of PKR: ${allPrices['PKR']}");
  print("Exchange rate of EUR: ${allPrices['EUR']}");
  print("Exchange rate of TRY: ${allPrices['TRY']}");

If you want to check the list of all the supported currencies, you can do it easily.

  final fx = Forex();
  List<String> availableCurrencies = await fx.getAvailableCurrencies();
  print("The list of all available currencies: ${availableCurrencies}");

For a simple currency conversion, you can use the following method for instant conversion. You must make sure you are entering only supported currencies, which can be obtained through the method provided above.

  final fx = Forex();
  double myPriceInPKR = await fx.getCurrencyConverted("USD", "PKR", 252.5);
  print("252.5 USD in PKR: ${myPriceInPKR}");

Additional information

This package uses real-time currency rates from a third-party prices provider convertmymoney.com. The forex prices are bound to their terms and conditions.

Libraries

forex_conversion