TimeZoneFormatter.genericLongWithProvider constructor

TimeZoneFormatter.genericLongWithProvider(
  1. DataProvider provider,
  2. Locale locale
)

Creates a zoned formatter based on a non-zoned formatter.

Caution: The locale provided here must match the locale used to construct the non-zoned formatter, or else unexpected behavior may occur!

See the Rust documentation for GenericLong for more information.

Throws DateTimeFormatterLoadError on failure.

Implementation

factory TimeZoneFormatter.genericLongWithProvider(DataProvider provider, Locale locale) {
  final result = _icu4x_TimeZoneFormatter_create_generic_long_with_provider_mv1(provider._ffi, locale._ffi);
  if (!result.isOk) {
    throw DateTimeFormatterLoadError.values.firstWhere((v) => v._ffi == result.union.err);
  }
  return TimeZoneFormatter._fromFfi(result.union.ok, []);
}