Money class

This class models a reference to a money.

Implemented types
Annotations

Constructors

Money({required double amount, required Currency currency})
A reference to a money.
const
Money.fromMap(Map<String, dynamic> map)
Creates an Money instance starting from a Map<String, dynamic> map.

Properties

amount double
The amount or, the value, of this money.
final
currency Currency
The currency of this money.
final
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

compareTo(covariant Money other) int
The order of the comparisons is:
override
convert({required ExchangeRate rate}) Money
Converts the value of this money to the currency expressed by rate.to.
copyWith({double? amount, Currency? currency}) Money
Creates a copy of this Money instance where the only changes are those specified in the parameters of this method.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
show({bool k = false, String? locale}) String
Returns the money representation in order to show it in the UI.
showK({String? locale}) String
This is a shorthand for show(k: true).
toMap() Map<String, dynamic>
Creates a Map<String, dynamic> map representation of this instance.
toString() String
A string representation of this object.
override

Operators

operator *(covariant num number) Money
Defines the multiplication operator between a num number and a Money.
operator +(covariant Money other) Money
Defines the sum operator.
operator -(covariant Money other) Money
Defines the subtraction operator.
operator /(covariant num number) Money
It defines the division operator, of a Money by a num number.
operator <(covariant Money other) bool
Returns if this instance is less than the other.
operator <=(covariant Money other) bool
Return if this instance is less than or equal to the other.
operator ==(covariant Money other) bool
The equality operator.
override
operator >(covariant Money other) bool
Return if this instance is greater than the other.
operator >=(covariant Money other) bool
Return if this instance is greater than or equal to the other.