fromCode static method

Currency? fromCode(
  1. String code
)

Get currency from its code

Implementation

static Currency? fromCode(String code) {
  try {
    return Currency.values.firstWhere(
      (currency) => currency.code.toUpperCase() == code.toUpperCase(),
    );
  } catch (_) {
    return null;
  }
}