newFileWithBytes method

File newFileWithBytes(
  1. String path,
  2. List<int> bytes
)

Implementation

File newFileWithBytes(String path, List<int> bytes) {
  _ensureAbsoluteAndNormalized(path);
  bytes = bytes is Uint8List ? bytes : Uint8List.fromList(bytes);

  var parentPath = pathContext.dirname(path);
  var parentData = _newFolder(parentPath);
  _addToParentFolderData(parentData, path);

  _pathToData[path] = _FileData(
    bytes: bytes,
    timeStamp: nextStamp++,
  );
  _notifyWatchers(path, ChangeType.ADD);

  return _MemoryFile(this, path);
}