Skip to content
pubscout

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
$ flutter pub add file
Source repository

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.