replaceLast method

bool replaceLast({
  1. String? str,
  2. LocaleName? localeName,
})

Replace last LocaleName in this list.

Implementation

bool replaceLast({String? str, LocaleName? localeName}) {
  LocaleName? entry = localeName;

  if (str != null) {
    entry ??= LocaleMatcher.byName(str);
  }
  if (entry != null) {
    locales.last = entry.locale;
    names.last = entry.name;
    entries.last = entry;
    return true;
  }
  return false;
}