length method

  1. @override
Future<int> length()
override

returns the length of the file. If needed this method may be removed but the length check must be done in the individual read-methods then.

Implementation

@override
Future<int> length() async {
  if (_length != null) return _length!;
  _ReadBufferFileResource resourceAt = _resourceAts.isNotEmpty ? _resourceAts.removeFirst() : _ReadBufferFileResource(filename);
  _length = await resourceAt.length();
  _resourceAts.addLast(resourceAt);
  assert(_length! >= 0);
  //_log.info("length needed ${DateTime.now().millisecondsSinceEpoch - time} ms");
  return _length!;
}