of method

String of(
  1. String region
)

Returns the locale specific display name of a region. Note that the function returns an empty string in case the display name for a given region code is not found.

See the Rust documentation for of for more information.

Throws LocaleParseError on failure.

Implementation

String of(String region) {
  final temp = _FinalizedArena();
  final write = _Write();
  final result = _icu4x_RegionDisplayNames_of_mv1(_ffi, region._utf8AllocIn(temp.arena), write._ffi);
  if (!result.isOk) {
    throw LocaleParseError.values[result.union.err];
  }
  return write.finalize();
}