writeBytes method

  1. @override
Future<void> writeBytes(
  1. String path,
  2. List<int> bytes
)
override

Writes bytes to the file at path, creating or replacing it.

The parent directory must exist; throws when it does not.

Implementation

@override
Future<void> writeBytes(String path, List<int> bytes) async {
  final String normalized = _resolve(path);
  if (!_directories.contains(_parentOf(normalized))) {
    throw StateError('no parent directory of "$path"');
  }
  _directories.remove(normalized);
  _files[normalized] = Uint8List.fromList(bytes);
}