A generic file system abstraction for Dart.
This package is currently experimental and subject to change
Like dart:io
, package:file
supplies a rich Dart idiomatic API for accessing
a file system.
Unlike dart:io
, package:file
:
- Has an entirely async public interface (no
fooSync
methods). - Has explicit factory classes for different implementations.
- Can be used to implement custom file systems.
Implement your own custom file system:
import 'package:file/file.dart';
class FooBarFileSystem implements FileSystem { ... }
Use the in-memory file system:
import 'package:file/file.dart';
var fs = new InMemoryFileSystem();
Use the local file system (requires dart:io access):
import 'package:file/io.dart';
var fs = const LocalFileSystem();