money2
Search…
Overview
Common Currencies
Creating a Currency
Registering a Currency
Parsing
Find a currency
Default format
Symbols
Separators
Creating Money
Money.parse
Currency.parse
Money.from
Currencies.parse
Scale
Formatting
Storing and Send
Exchange Rates
Comparison
Currency Predicates
Value Sign Predicates
Arithmetic Operations
Allocation
Money encoding/decoding
Powered By
GitBook
Money.parse
Money.parse parses a string containing a monetary value.
Money.fromInt
is faster if you already have the value represented as an integer in minor units.
The simplest variant of
Money.parse
relies on the default
pattern
of the passed currency.
1
import
'package:money2/money2.dart'
;
2
final
Currency
usd
=
Currency
.
create
(
'USD'
,
2
);
3
final
Money
amount
=
Money
.
parse
(
r'
$
10
.25'
,
usd
);
Copied!
You can also pass an explicit pattern.
1
import
'money2.dart'
;
2
final
Currency
usd
=
Currency
.
create
(
'USD'
,
2
);
3
final
Money
amount
=
Money
.
parse
(
r'
$
10
.25'
,
usd
,
'S0.00'
);
Copied!
Previous
Creating Money
Next
Currency.parse
Last modified
6mo ago
Copy link