Skip to content
pubscout

scratch_space

1.2.2, released 5 months ago by tools.dart.dev

Manages running external executables within package:build via a temporary directory wrapper.

$ flutter pub add scratch_space
Source repository

What it does

A tool to manage running external executables within package:build by providing a thin wrapper around a temporary directory. It helps add assets to a scratch space, get actual File objects for external binaries, and copy back outputs from the temp directory to the build system.

AI-written summary of version 1.2.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are writing a custom builder that needs to run external command-line executables.
  • You need to manage temporary directories and asset staging within package:build.

Skip it when

  • You are building a standard app without custom build_runner builders.
  • You do not need to interact with external binaries or temporary files.

Strengths

  • Simplifies integration of external binaries into package:build
  • Provides asset synchronization via digests and helper methods for copying outputs back

Weaknesses

  • Cannot delete individual assets from a scratch space currently, only the entire space
  • Requires proper handling of temporary resources to avoid filling up the disk

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4

Use as a Resource within package:build builders.

final myScratchSpaceResource =
    Resource(() => ScratchSpace(), dispose: (old) => old.delete());

class MyBuilder extends Builder {
  Future<void> build(BuildStep buildStep) async {
    var scratchSpace = await buildStep.fetchResource(myScratchSpaceResource);
  }
}

Alternatives

Packages that do the same job and could replace scratch_space.

Works with

Packages commonly used together with scratch_space: ones it builds on, ones built on it, and its own family.