CachedRateProvider class

An in-memory cached rate provider that wraps another provider.

PkCurrencyFormatter.configureRates(
  CachedRateProvider(
    ExchangeRateApiProvider(),
    ttl: Duration(hours: 1),
  ),
);
Implemented types

Constructors

CachedRateProvider(CurrencyRateProvider _inner, {Duration ttl = const Duration(hours: 1)})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
ttl Duration
final

Methods

clearCache() → void
getAllRates(String base) Future<Map<String, double>>
Returns all rates relative to base currency.
override
getRate(String from, String to) Future<double>
Returns the exchange rate from from to to.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited