ExchangePlatform class
The ExchangePlatform allows you to register a set of ExchangeRate which you can then use to do currency conversions.
We allow multiple ExchangePlatforms to exist to reflect the fact that there multiple exchanges around the world.
To use an ExchangePlatform call register for each exchange rate. If you only provide an exchange rate in one direction (AUD -> USD) then it will calculate the inverse exchange rate if required. In the real world you will probably need to provide exchange rates in both directions as they are rarely the recipricol of each other.
Constructors
Properties
-
exchangeMap
→ Map<
_CodePair, ExchangeRate> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
exchangeTo(
Money from, CurrencyIsoCode to, {bool useInversion = true}) → Money -
Converts
from
to theto
currency using a regisetered exhange rate. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register(
ExchangeRate exchangeRate) → void - Register an exchange rate with this platform.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited