StackRun.script constructor

const StackRun.script(
  1. String path, {
  2. List<String> args,
})

A Dart script in this project, run with the SDK flutterware is running under.

StackRun.script('tool/local_env.dart', args: ['status', '--json'])

path is relative to the stack's workingDirectory, and the script runs there — so it is written exactly as you would type it, having cd'd to the directory the stack's other commands already run in. That differs from DefineSource.script, which is relative to the worktree root, and the difference is the workingDirectory this plugin has and that one does not.

Run as dart <path>, not dart run <path>. run re-resolves the package graph and executes every build hook in it, every time — a cost a probe would pay on every poll, and one that grows with the project. The tradeoff is that build hooks do not run, so a script whose imports need native assets built will not find them. Declare that one as a StackRun.command naming its own interpreter.

Implementation

const factory StackRun.script(String path, {List<String> args}) = ScriptRun;