tom_file_system 0.1.0
tom_file_system: ^0.1.0 copied to clipboard
One file-system contract for every Tom application — atomic writes, revision-checked saves, delete to the platform's trash, links that never leave the root, values instead of dart:io objects — with an [...]
example/tom_file_system_example.dart
import 'package:tom_file_system/tom_file_system.dart';
Future<void> main() async {
final fs = TomMemoryFileSystem(seed: {'/notes.txt': 'first line\n'});
final read = await fs.read(fs.uriOf('notes.txt'));
// Refused with a TomFileConflict if somebody changed the file since.
await fs.writeText(
fs.uriOf('notes.txt'),
'second line\n',
expected: read.revision,
);
print(await fs.readText(fs.uriOf('notes.txt')));
}