Currency.code constructor
Currency.code(
- String code
Implementation
factory Currency.code(
/// XXX code to look for
String code,
) {
final upperCode = code.toUpperCase();
final info = Iso4217.firstWhere((currency) => currency['code'] == upperCode,
orElse: () => <String, dynamic>{});
if (!info.containsKey('code')) return UnknownCurrency(code);
return Currency(
info['code'] as String,
info['number'] as int,
info['digits'] as int,
);
}