findCurrenciesByCode method

List<Currency> findCurrenciesByCode(
  1. List<String> codes
)

Returns a list with all the currencies that mach the given codes list.

Implementation

List<Currency> findCurrenciesByCode(List<String> codes) {
  final List<String> _codes =
      codes.map((code) => code.toUpperCase()).toList();
  final List<Currency> currencies = [];
  for (final code in _codes) {
    final Currency? currency = findByCode(code);
    if (currency != null) {
      currencies.add(currency);
    }
  }
  return currencies;
}