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.
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.
- drift_dev
Generates Dart database code from Drift table definitions as a dev‑dependency.
84Compare - json_serializable
Automatically generate code for converting Dart classes to and from JSON.
94Compare - dart_mappable
JSON serialization and data classes generator supporting generics, inheritance, and customization.
89Compare - copy_with_extension
Annotation for generating copyWith extensions code using copy_with_extension_gen.
87Compare
Works with
Packages commonly used together with scratch_space: ones it builds on, ones built on it, and its own family.
- cryptoscratch_space depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- poolscratch_space depends on itManage a finite pool of resources to control concurrent operations.
- buildscratch_space depends on itPackage for authoring build_runner compatible code generators.
- sseSame familyBidirectional Server Sent Events client and server for Dart.
- dwdsSame familyProxies between the Chrome debug protocol and the Dart VM service protocol.
- build_runnerSame familyA build system for Dart code generation and modular compilation.
- build_daemonSame familyDaemon for running Dart builds in the background
- dart_mcp_serverSame familyAn MCP server for Dart projects, exposing developer tools to AI models.