rate static method

Future<Paisa> rate(
  1. Currency from,
  2. Currency to
)

Return the currency conversion rate for the given from and to currencies
Example:

CurrencyConvertor.rate(Currency.USD, Currency.INR);

Implementation

static Future<Paisa> rate(Currency from, Currency to) async {
  try {
    final rate = await _getConversionRate(from.name, to.name, 1);

    return Paisa(amount: 1, rate: rate, from: from, to: to);
  } catch (e) {
    rethrow;
  }
}