Location constructor

Location(
  1. String name,
  2. List<int> transitionAt,
  3. List<int> transitionZone,
  4. List<TimeZone> zones,
)

Implementation

Location(this.name, this.transitionAt, this.transitionZone, this.zones) {
  // Fill in the cache with information about right now,
  // since that will be the most common lookup.
  for (var i = 0; i < transitionAt.length; i++) {
    final tAt = transitionAt[i];

    if ((tAt <= _cacheNow) &&
        ((i + 1 == transitionAt.length) ||
            (_cacheNow < transitionAt[i + 1]))) {
      _cacheStart = tAt;
      _cacheEnd = maxTime;
      if (i + 1 < transitionAt.length) {
        _cacheEnd = transitionAt[i + 1];
      }
      _cacheZone = zones[transitionZone[i]];
    }
  }
}