file
7.0.1, released 2 years ago by tools.dart.dev
Pluggable, mockable file system abstraction for Dart with in-memory support.
Quiet but busy
What it does
Provides a generic file system abstraction mimicking `dart:io`. It allows you to use different implementations such as local disk access, in-memory file systems, or custom file systems interchangeably.
AI-written summary of version 7.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to write unit tests that interact with the file system without touching the actual disk.
- You want to build custom file system wrappers or chroot file systems in Dart.
Skip it when
- You only need high-level file picking utilities, which are better served by a file picker plugin.
Strengths
- Comes with a ready-to-use in-memory file system implementation.
- Allows using multiple file systems simultaneously as first-class objects.
- Drop-in API compatibility with `dart:io`.
Weaknesses
- Does not include platform file picker UI out of the box.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
import 'package:file/memory.dart';
var fs = MemoryFileSystem();Works with
Packages commonly used together with file: ones it builds on, ones built on it, and its own family.
- globBuilt on fileA file and directory globbing library that supports Bash-style path matching and listing.
- processBuilt on filePluggable, mockable process invocation abstraction for Dart.
- devtools_sharedBuilt on fileShared Dart structures and server classes between devtools_app and other tools.
- dwdsBuilt on fileProxies between the Chrome debug protocol and the Dart VM service protocol.
- shared_preferences_windowsBuilt on fileWindows platform implementation for shared_preferences
- share_plusBuilt on fileShare text, files, or URIs via native share dialogs on mobile, web, and desktop.
- device_info_plusBuilt on fileProvides detailed information about the current device, make, model, and OS version.
- flutter_cache_managerBuilt on fileGeneric cache manager for saving web files and cache info on device storage.