writeBytes method

  1. @override
void writeBytes(
  1. String filePath,
  2. List<int> content,
  3. {bool allowOverwrite = false}
)
override

Writes content to a file at filePath.

If a file is to be overwritten, a warning will be reported, unless allowOverwrite is true.

Implementation

@override
void writeBytes(
  String filePath,
  List<int> content, {
  bool allowOverwrite = false,
}) {
  _validateMaxWriteStats(filePath, content.length);
  // Replace '/' separators with proper separators for the platform.
  var outFile = path.joinAll(filePath.split('/'));

  if (!allowOverwrite) {
    _warnAboutOverwrite(outFile, null);
  }
  _fileElementMap[outFile] = null;

  var file = _getFile(outFile);
  file.writeAsBytesSync(content);
  writtenFiles.add(outFile);
  logProgress(outFile);
}