commit | 1c2ed7e611acd955fea2a843ab610904e1030316 | [log] [tgz] |
---|---|---|
author | Todd Volkert <tvolkert@users.noreply.github.com> | Fri Jan 06 10:31:14 2017 -0800 |
committer | GitHub <noreply@github.com> | Fri Jan 06 10:31:14 2017 -0800 |
tree | f24a91570d57a78692d39ed70abc29e49bbf881e | |
parent | ec0202743c15c3db5f2277e2bdf14233d18c68b4 [diff] |
Ensure covariant return types (#52) Starting to use the library in Flutter, I ran into an issue whereby the following code would produce an analyzer error: ``` dir.listSync().forEach((FileSystemEntity entity) { ... }); ``` It was due to the fact that Directory.listSync() was declared to return `List<io.FileSystemEntity>` instead of `List<FileSystemEntity>`. This change ensures that we declare all such methods to return the appropriate covariant types, and it adds tests to that effect.
A generic file system abstraction for Dart.
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/memory.dart'; var fs = new MemoryFileSystem();
Use the local file system (requires dart:io access):
import 'package:file/local.dart'; var fs = const LocalFileSystem();