Currency.parse
The simplest variant of Currency.parse relies on the default pattern of the currency.
1
test('parse with Currency', () {
2
/// Parse using a currency.
3
var t1 = CommonCurrencies().aud.parse(r'$10.00');
4
expect(t1.toString(), equals(r'$10.00'));
5
expect(t1.currency.code, equals('AUD'));
6
});
Copied!
You can also pass an explict pattern.
1
var t2 = CommonCurrencies().aud.parse(r'10.00#x27;, pattern: '0.00S');
2
expect(t2.toString(), equals(r'$10.00'));
3
expect(t2.currency.code, equals('AUD'));
Copied!
Copy link