zuke.tools.dart
@zuke/dart 1.0.0: @zuke/dart — typed DartTasks wrappers for the [Dart](https://dart.dev) CLI, for use in Zuke builds: analyze, format, fix and test Dart code, compile it to every target, generate docs, scaffold and run programs, and manage pub dependencies.
zuke on PyPI ↗ 19 symbols
Symbols
class DartAnalyzeSettings(DartSettings) Settings for dart analyze.
-
path(path: str) -> SelfA file or directory to analyze (defaults to the current one); repeatable.
-
fatal_infos() -> SelfTreat info-level issues as fatal (
--fatal-infos). -
no_fatal_warnings() -> SelfDo not fail on warnings (
--no-fatal-warnings). -
format(name: Literal['default', 'json', 'machine']) -> SelfThe output format:
default,jsonormachine(--format). -
packages(path: str) -> SelfThe package resolution file to use (
--packages).
class DartCreateSettings(DartSettings) Settings for dart create.
-
dir(path: str) -> SelfThe directory to create the project in; required.
-
template(name: Literal['cli', 'console', 'package', 'server-shelf', 'web']) -> SelfThe project template, instead of
console(--template). -
no_pub() -> SelfSkip the implicit
dart pub get(--no-pub). -
force() -> SelfCreate into a directory that already exists (
--force).
class DartDocSettings(DartSettings) Settings for dart doc.
-
dir(path: str) -> SelfThe package directory to document (defaults to the current one).
-
output(path: str) -> SelfWhere to write the generated docs, instead of
doc/api(--output). -
validate_links() -> SelfCheck the generated docs for broken links (
--validate-links). -
dry_run() -> SelfReport what would be documented without writing files (
--dry-run).
class DartFixSettings(DartSettings) Settings for dart fix.
-
dir(path: str) -> SelfThe directory to fix (defaults to the current one).
-
apply() -> SelfApply the proposed fixes (
--apply). Without it or.dryRun(),dart fixonly prints usage. -
dry_run() -> SelfList the proposed fixes without applying them (
--dry-run). -
code(code: str) -> SelfApply only the fix for one diagnostic code (
--code); repeatable.
class DartFormatSettings(DartSettings) Settings for dart format. With no .path() the current directory is formatted: dart format itself would read stdin instead, and in CI — no terminal, empty stdin — a .setExitIfChanged() check would pass vacuously.
-
path(path: str) -> SelfA file or directory to format (defaults to
.); repeatable. -
output(mode: Literal['write', 'show', 'json', 'none']) -> SelfWhat to do with formatted code:
write(default),show,jsonornone(--output). -
set_exit_if_changed() -> SelfExit with code 1 when any file would change — the CI check (
--set-exit-if-changed). -
line_length(columns: float) -> SelfWrap lines longer than this (
--line-length). -
show(which: Literal['all', 'changed', 'none']) -> SelfWhich files to list:
all,changed(default) ornone(--show). -
summary(kind: Literal['line', 'profile', 'none']) -> SelfThe summary to print:
line(default),profileornone(--summary). -
follow_links() -> SelfFollow symbolic links into directories (
--follow-links). -
language_version(version: str) -> SelfThe language version to parse as, e.g.
3.3(--language-version). -
enable_experiment(name: str) -> SelfEnable an experimental language feature (
--enable-experiment); repeatable.
class DartInfoSettings(DartSettings) Settings for dart info, which prints diagnostic details about the SDK.
-
no_remove_file_paths() -> SelfKeep file paths in the output instead of redacting them (
--no-remove-file-paths).
class DartPubDepsSettings(DartSettings) Settings for dart pub deps.
-
style(name: Literal['compact', 'tree', 'list']) -> SelfThe layout:
compact,tree(default) orlist(--style). -
no_dev() -> SelfLeave dev dependencies out (
--no-dev). -
executables() -> SelfList the executables the dependencies expose instead (
--executables). -
json() -> SelfPrint the dependency graph as JSON (
--json).
class DartPubDowngradeSettings(DartSettings) Settings for dart pub downgrade.
-
package(name: str) -> SelfDowngrade only this package (defaults to all); repeatable.
-
offline() -> SelfResolve from the local pub cache only (
--offline). -
dry_run() -> SelfReport what would change without changing it (
--dry-run). -
tighten() -> SelfLower the constraints in
pubspec.yamlto the resolved versions (--tighten).
class DartPubGetSettings(DartSettings) Settings for dart pub get.
-
offline() -> SelfResolve from the local pub cache only (
--offline). -
enforce_lockfile() -> SelfFail rather than change
pubspec.lock(--enforce-lockfile). -
dry_run() -> SelfReport what would change without changing it (
--dry-run). -
no_precompile() -> SelfSkip precompiling executables (
--no-precompile).
class DartPubOutdatedSettings(DartSettings) Settings for dart pub outdated.
-
json() -> SelfPrint machine-readable JSON (
--json). -
show_all() -> SelfInclude packages that are already up to date (
--show-all). -
no_dev_dependencies() -> SelfLeave dev dependencies out (
--no-dev-dependencies). -
no_transitive() -> SelfLeave transitive dependencies out (
--no-transitive). -
prereleases() -> SelfInclude prereleases when looking for newer versions (
--prereleases).
class DartPubPackagesSettings(DartSettings) Settings for dart pub add and dart pub remove.
-
package(spec: str) -> SelfA package to add or remove; repeatable, at least one is required. For
addit takes pub's descriptor syntax:http,http:^1.2.0, ordev:mocktailfor a dev dependency. -
offline() -> SelfResolve from the local pub cache only (
--offline). -
dry_run() -> SelfReport what would change without changing it (
--dry-run).
class DartPubPublishSettings(DartSettings) Settings for dart pub publish.
-
dry_run() -> SelfValidate the package without uploading it (
--dry-run). -
force() -> SelfPublish without the confirmation prompt — what CI needs (
--force). -
skip_validation() -> SelfPublish even when validation reports warnings (
--skip-validation).
class DartPubUpgradeSettings(DartSettings) Settings for dart pub upgrade.
-
package(name: str) -> SelfUpgrade only this package (defaults to all); repeatable.
-
offline() -> SelfResolve from the local pub cache only (
--offline). -
dry_run() -> SelfReport what would change without changing it (
--dry-run). -
major_versions() -> SelfAlso raise constraints in
pubspec.yamlacross majors (--major-versions). -
tighten() -> SelfRaise lower bounds in
pubspec.yamlto the resolved versions (--tighten). -
unlock_transitive() -> SelfAlso upgrade the transitive dependencies of the named packages (
--unlock-transitive).
class DartRunSettings(DartVmSettings) Settings for dart run. The entry point is the last token the settings build, so anything passed through .args() lands after it and reaches the program, not the VM — without an .entry(), the first .args() token is what dart run takes as the program, exactly as on the command line.
-
entry(file_or_target: str) -> SelfThe Dart file to run, or a package executable such as
build_runnerortest:test. Without one,dart runruns the current package's own executable. -
observe(bind: str | None=None) -> SelfStart the VM service with the debugging conveniences and pause on start (
--observe=<port>[/<bind-address>]). The value is attached with=becausedart runreads the option's value from the next token, which would otherwise be the entry point. -
enable_vm_service(bind: str | None=None) -> SelfStart the VM service without pausing (
--enable-vm-service=<port>[/<bind-address>]).
class DartSettings(ToolSettings) Base for all dart settings: the binary is dart, found on PATH.
class DartTasks Typed task functions for the dart CLI.
-
static async analyze(ctx: ServiceContext, configure: Callable[[DartAnalyzeSettings], DartAnalyzeSettings] | None=None) -> ExecResultAnalyze the project's Dart code:
dart analyze. -
static async format(ctx: ServiceContext, configure: Callable[[DartFormatSettings], DartFormatSettings] | None=None) -> ExecResultFormat Dart code, or check it with
.setExitIfChanged():dart format. -
static async fix(ctx: ServiceContext, configure: Callable[[DartFixSettings], DartFixSettings] | None=None) -> ExecResultApply analyzer fixes:
dart fix. -
static async test(ctx: ServiceContext, configure: Callable[[DartTestSettings], DartTestSettings] | None=None) -> ExecResultRun the tests:
dart test. -
static async run(ctx: ServiceContext, configure: Callable[[DartRunSettings], DartRunSettings] | None=None) -> ExecResultRun a Dart program or package executable:
dart run. -
static async doc(ctx: ServiceContext, configure: Callable[[DartDocSettings], DartDocSettings] | None=None) -> ExecResultGenerate API documentation:
dart doc. -
static async create(ctx: ServiceContext, configure: Callable[[DartCreateSettings], DartCreateSettings]) -> ExecResultScaffold a project:
dart create. -
static async pub_get(ctx: ServiceContext, configure: Callable[[DartPubGetSettings], DartPubGetSettings] | None=None) -> ExecResultResolve dependencies:
dart pub get. -
static async pub_upgrade(ctx: ServiceContext, configure: Callable[[DartPubUpgradeSettings], DartPubUpgradeSettings] | None=None) -> ExecResultUpgrade dependencies:
dart pub upgrade. -
static async pub_downgrade(ctx: ServiceContext, configure: Callable[[DartPubDowngradeSettings], DartPubDowngradeSettings] | None=None) -> ExecResultDowngrade dependencies to their lowest allowed versions:
dart pub downgrade. -
static async pub_outdated(ctx: ServiceContext, configure: Callable[[DartPubOutdatedSettings], DartPubOutdatedSettings] | None=None) -> ExecResultList outdated dependencies:
dart pub outdated. -
static async pub_deps(ctx: ServiceContext, configure: Callable[[DartPubDepsSettings], DartPubDepsSettings] | None=None) -> ExecResultPrint the dependency graph:
dart pub deps. -
static async pub_add(ctx: ServiceContext, configure: Callable[[DartPubPackagesSettings], DartPubPackagesSettings]) -> ExecResultAdd dependencies to
pubspec.yaml:dart pub add. -
static async pub_remove(ctx: ServiceContext, configure: Callable[[DartPubPackagesSettings], DartPubPackagesSettings]) -> ExecResultRemove dependencies from
pubspec.yaml:dart pub remove. -
static async pub_publish(ctx: ServiceContext, configure: Callable[[DartPubPublishSettings], DartPubPublishSettings] | None=None) -> ExecResultPublish the package to pub.dev:
dart pub publish. -
static async info(ctx: ServiceContext, configure: Callable[[DartInfoSettings], DartInfoSettings] | None=None) -> ExecResultPrint diagnostic details about the SDK:
dart info. -
static async version(ctx: ServiceContext, configure: Callable[[DartVersionSettings], DartVersionSettings] | None=None) -> ExecResultPrint the Dart SDK version:
dart --version.
class DartTestSettings(DartSettings) Settings for dart test.
-
path(path: str) -> SelfA test file or directory to run (defaults to
test/); repeatable. -
name(pattern: str) -> SelfRun only tests whose name matches a regular expression (
--name); repeatable. -
plain_name(text: str) -> SelfRun only tests whose name contains a string (
--plain-name); repeatable. -
tags(expression: str) -> SelfRun only tests with a tag expression (
--tags). -
exclude_tags(expression: str) -> SelfSkip tests matching a tag expression (
--exclude-tags). -
preset(name: str) -> SelfApply a preset from
dart_test.yaml(--preset); repeatable. -
run_skipped() -> SelfRun skipped tests too (
--run-skipped). -
fail_fast() -> SelfStop after the first failure (
--fail-fast). -
platform(name: str) -> SelfRun on a platform, e.g.
vm,chromeornode(--platform); repeatable. -
compiler(name: str) -> SelfThe compiler for a platform, e.g.
dart2js,dart2wasmorkernel(--compiler); repeatable. -
concurrency(count: float) -> SelfHow many test suites to run at once (
--concurrency). -
timeout(value: str) -> SelfThe default per-test timeout, e.g.
30sor2x(--timeout). -
coverage(dir: str) -> SelfCollect coverage into a directory of JSON reports (
--coverage). -
reporter(name: str) -> SelfThe console reporter:
compact,expanded,failures-only,github,jsonorsilent(--reporter). -
file_reporter(spec: str) -> SelfAlso write a reporter's output to a file, e.g.
json:report.json(--file-reporter). -
randomize_ordering_seed(seed: str | float) -> SelfShuffle test order with a seed, or
random(--test-randomize-ordering-seed). -
ignore_timeouts() -> SelfDo not stop a test at its timeout (
--ignore-timeouts). -
no_color() -> SelfPrint stack traces without colour codes (
--no-color). -
shard(index: float, total: float) -> SelfRun one shard of the suite:
shard(index, total)renders--total-shards total --shard-index index, withindexfrom 0.
class DartVersionSettings(DartSettings) Settings for dart --version.
class DartVmSettings(DartSettings) Flags shared by the commands that load Dart code into the VM — compile and run: --define, --enable-asserts, --enable-experiment, --packages and --verbosity. Valued options render as --flag=value: dart compile js hands its argv to dart2js, whose parser accepts only that spelling, and Dart's args package accepts it everywhere else.
-
define(name: str, value: str) -> SelfDefine an environment declaration (
--define=name=value); repeatable. -
enable_asserts() -> SelfEnable assert statements (
--enable-asserts). -
enable_experiment(name: str) -> SelfEnable an experimental language feature (
--enable-experiment); repeatable. -
packages(path: str) -> SelfThe package resolution file to use (
--packages). -
verbosity(level: Literal['error', 'warning', 'info', 'all']) -> SelfHow much to print:
error,warning,infoorall(--verbosity).