formatIsoDatetimeWithCustomTimeZone method

String formatIsoDatetimeWithCustomTimeZone(
  1. IsoDateTime datetime,
  2. TimeZoneInfo timeZone
)

Formats a `IsoDateTime` and `TimeZoneInfo` to a string.

Throws DateTimeFormatError on failure.

Implementation

String formatIsoDatetimeWithCustomTimeZone(IsoDateTime datetime, TimeZoneInfo timeZone) {
  final write = _Write();
  final result = _icu4x_ZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone_mv1(_ffi, datetime._ffi, timeZone._ffi, write._ffi);
  if (!result.isOk) {
    throw DateTimeFormatError.values.firstWhere((v) => v._ffi == result.union.err);
  }
  return write.finalize();
}