Currency class
Allows you to create a Currency which is then used to construct Money instances.
NOTE: This is a value type, do not extend or re-implement it.
Money2 does not create a default set of currencies instead you need to explicitly create each currency type you want to use.
Normally you create one global currency instance for each currency type. If you wish you can register each Currency instance with the CommonCurrencies class which then is able to provides a global directory of Currency instances.
- Annotations
-
- @immutable
Constructors
Properties
- country → String
-
Full name of the currency. e.g. Australian Dollar
final
- decimalDigits → int
-
The number of decimals for the currency (zero or more).
final
- decimalSeparator → String
-
The character used for the decimal place
final
- groupSeparator → String
-
The character used for the group separator.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isoCode → String
-
The isoCode of the currency (e.g. 'USD').
final
- name → String
-
The name of the currency. e.g. Australian Dollar
final
- pattern → String
-
the default pattern used to format and parse monetary amounts for this
currency.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleFactor → BigInt
-
The factor of 10 to divide a minor value by to get the intended
currency value.
final
- symbol → String
-
The currency symbol (e.g. $)
final
- unit → String
-
The major units of the currency. e.g. 'Dollar'
final
Methods
-
copyWith(
{String? isoCode, int? precision, String? symbol, String? pattern, String? groupSeparator, String? decimalSeparator}) → Currency - Creates a Currency from an existing Currency with changes.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parse(
String monetaryAmount, {String? pattern}) → Money - Takes a monetary amount encoded as a string and converts it to a Money instance.
-
toMinorUnits(
BigInt majorUnits, BigInt minorUnits) → BigInt -
Takes a
majorUnits
and aminorUnits
and returns a BigInt which represents the two combined values inminorUnits
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
covariant Currency other) → bool -
Two currencies are considered equivalent if the
isoCode and decimalDigits are the same.
override
Constants
- defaultPattern → const String