newFileWithBytes method

File newFileWithBytes(
  1. String path,
  2. List<int> bytes, [
  3. @Deprecated('This parameter is not used and will be removed') int? stamp
])

Implementation

File newFileWithBytes(
  String path,
  List<int> bytes, [
  @Deprecated('This parameter is not used and will be removed') int? stamp,
]) {
  _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);
}