commit | 4b4892735f007c053c59ae385b2aac3c837959f9 | [log] [tgz] |
---|---|---|
author | Todd Volkert <tvolkert@users.noreply.github.com> | Wed Dec 14 09:38:11 2016 -0800 |
committer | GitHub <noreply@github.com> | Wed Dec 14 09:38:11 2016 -0800 |
tree | 997ef877648aca4010f359b93281ee765f793da5 | |
parent | f289ad5967515ff8a26012de5d5cc996e5619808 [diff] |
Support browser contexts in package:file (#18) This change uses conditional imports to support browser-based Dart usage of this package. For non-VM users, this will export the subset of the dart:io interface that is required by this package, whereas VM users will simply get dart:io itself.
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
:
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();
The synchronous counterparts can be imported from:
// API and in-memory implementation import `package:file/sync.dart`; // Implementation based on "dart:io" import `package:file/sync_io.dart`;