fromCode static method

CurrencyCode? fromCode(
  1. String code
)

Retrieves a CurrencyCode enum value from a given currency code string. Returns null if no matching currency code is found.

Implementation

static CurrencyCode? fromCode(String code) {
  return CurrencyCode.values.firstWhere(
    (currency) => currency.code == code.toUpperCase(),
    orElse: () => CurrencyCode.inr, // Default to INR if not found
  );
}