createFile method

  1. @override
void createFile(
  1. String path, {
  2. bool errorIfNotExists = false,
  3. bool errorIfAlreadyExists = false,
})
override

Creates an empty file at path.

If errorIfAlreadyExists is set to true, and a file already exists at path, a FileSystemException is thrown.

Implementation

@override
void createFile(
  String path, {
  bool errorIfNotExists = false,
  bool errorIfAlreadyExists = false,
}) {
  _checkClosed();
  final existsBefore = _memory.exists(path);
  _memory.createFile(
    path,
    errorIfAlreadyExists: errorIfAlreadyExists,
    errorIfNotExists: errorIfNotExists,
  );

  if (!existsBefore) {
    _submitWork(_CreateFileWorkItem(this, path));
  }
}