newSource method

Future<Source?> newSource(
  1. int index
)

Returns an unbuffered input stream to read the last committed value, or null if no value has been committed.

Implementation

Future<Source?> newSource(int index) {
  return _cache._lock.synchronized(() async {
    if (_done) throw StateError('editor was done');
    if (!_entry.readable || _entry.currentEditor != this || _entry.zombie) {
      return null;
    }
    try {
      return await _cache.fileSystem.openSource(_entry.getCleanFile(index));
    } on FileSystemException {
      return null;
    }
  });
}