TzdbZoneLocation constructor

TzdbZoneLocation(
  1. int latitudeSeconds,
  2. int longitudeSeconds,
  3. String countryName,
  4. String countryCode,
  5. String zoneId,
  6. String comment,
)

Creates a new location.

This constructor is only for the sake of testability. Non-test code should usually obtain locations from a TzdbDateTimeZoneSource.

latitudeSeconds: Latitude of the location, in seconds. longitudeSeconds: Longitude of the location, in seconds. countryName: English country name of the location, in degrees. Must not be null. countryCode: ISO-3166 country code of the location. Must not be null. zoneId: Time zone identifier of the location. Must not be null. comment: Optional comment. Must not be null, but may be empty. ArgumentOutOfRangeException: The latitude or longitude is invalid.

Implementation

factory TzdbZoneLocation(int latitudeSeconds, int longitudeSeconds,
    String countryName, String countryCode, String zoneId, String comment) {
  Preconditions.checkArgumentRange(
      'latitudeSeconds', latitudeSeconds, -90 * 3600, 90 * 3600);
  Preconditions.checkArgumentRange(
      'longitudeSeconds', longitudeSeconds, -180 * 3600, 180 * 3600);
  var CountryName = Preconditions.checkNotNull(countryName, 'countryName');
  var CountryCode = Preconditions.checkNotNull(countryCode, 'countryCode');
  Preconditions.checkArgument(
      CountryName.isNotEmpty, 'countryName', "Country name cannot be empty");
  Preconditions.checkArgument(CountryCode.length == 2, 'countryCode',
      "Country code must be two characters");
  var ZoneId = Preconditions.checkNotNull(zoneId, 'zoneId');
  var Comment = Preconditions.checkNotNull(comment, 'comment');

  return TzdbZoneLocation._(Comment, CountryCode, CountryName,
      latitudeSeconds, longitudeSeconds, ZoneId);
}