Currency.parse
The simplest variant of
Currency.parse
relies on the default pattern of the currency. test('parse with Currency', () {
/// Parse using a currency.
var t1 = CommonCurrencies().aud.parse(r'$10.00');
expect(t1.toString(), equals(r'$10.00'));
expect(t1.currency.code, equals('AUD'));
});
You can also pass an explict pattern.
var t2 = CommonCurrencies().aud.parse(r'10.00$', pattern: '0.00S');
expect(t2.toString(), equals(r'$10.00'));
expect(t2.currency.code, equals('AUD'));
Last modified 1yr ago