calcRange method

void calcRange()

Implementation

void calcRange() {
  // During loading, dataset may not be set yet. (original comment kept as-is)
  final ds = dataSet;
  if (ds == null) {
    _firstRecord = 0;
    return;
  }
  var aMin = ds._activeRecord - _bufferCount + 1;
  if (aMin < 0) aMin = 0;
  var aMax = ds._bufferCount - _bufferCount;
  if (aMax < 0) aMax = 0;

  if (aMax > ds._activeRecord) aMax = ds._activeRecord;

  if (_firstRecord < aMin) _firstRecord = aMin;
  if (_firstRecord > aMax) _firstRecord = aMax;

  if (_firstRecord != 0 &&
      ds._activeRecord - _firstRecord < _bufferCount - 1) {
    _firstRecord -= 1;
  }
}