@zuke/flutter

← API reference

`@zuke/flutter` — typed `FlutterTasks` wrappers for the

Symbols

#

FlutterAnalyzeSettings

class
class FlutterAnalyzeSettings extends FlutterSettings

Settings for flutter analyze.

MemberSignatureDoc
path path(path: PathLike): this A file or directory to analyze (defaults to the project); repeatable.
noFatalInfos noFatalInfos(): this Do not fail on info-level issues (--no-fatal-infos).
noFatalWarnings noFatalWarnings(): this Do not fail on warnings (--no-fatal-warnings).
write write(path: PathLike): this Also write the analysis results to a file (--write).
#

FlutterAppSettings

class
class FlutterAppSettings extends FlutterCompileSettings

Compile flags plus the build mode and the entry point (--target), shared by flutter build and flutter drive.

MemberSignatureDoc
mode mode(mode: FlutterBuildMode): this The build mode (--debug, --profile or --release).
release release(): this Build in release mode (--release).
target target(path: PathLike): this The main entry-point file, instead of lib/main.dart (--target).
#

FlutterBuildMode

type
type FlutterBuildMode = debug | profile | release

A Flutter build mode, rendered as --debug, --profile or --release.

#

FlutterBuildSettings

class
class FlutterBuildSettings extends FlutterAppSettings

Settings for flutter build <target>. Flags that only one target accepts say so; flutter rejects them for the others.

MemberSignatureDoc
buildName buildName(name: string): this The version name, e.g. 1.4.0 (--build-name).
buildNumber buildNumber(number: string | number): this The build number, e.g. the CI run number (--build-number).
obfuscate obfuscate(): this Obfuscate Dart symbols (--obfuscate); needs splitDebugInfo.
splitDebugInfo splitDebugInfo(dir: PathLike): this Write split debug symbols to a directory (--split-debug-info).
noTreeShakeIcons noTreeShakeIcons(): this Keep every icon font glyph (--no-tree-shake-icons).
targetPlatform targetPlatform(platform: string): this The platform to build for (--target-platform). Android takes several ABIs, e.g. android-arm64, joined into one list; linux and windows take one, e.g. linux-arm64.
splitPerAbi splitPerAbi(): this apk: one APK per ABI (--split-per-abi).
noCodesign noCodesign(): this ios: build without code signing (--no-codesign).
exportMethod exportMethod(method: string): this ipa: the export method, e.g. app-store or ad-hoc (--export-method).
exportOptionsPlist exportOptionsPlist(path: PathLike): this ipa: the export options plist (--export-options-plist).
baseHref baseHref(href: string): this web: the base href of the app, e.g. /app/ (--base-href).
wasm wasm(): this web: compile to WebAssembly (--wasm).
sourceMaps sourceMaps(): this web: emit source maps (--source-maps).
output output(dir: PathLike): this web: the output directory, instead of build/web (--output).
#

FlutterBuildTarget

type
type FlutterBuildTarget = aar | apk | appbundle | ios | ipa | linux | macos | web | windows

The artifact flutter build produces — its subcommand.

#

FlutterBuildTask

type
type FlutterBuildTask = unknown

A task that runs flutter build <target>.

#

FlutterCommandSettings

class
class FlutterCommandSettings extends FlutterSettings

Settings for a flagless command: flutter clean, or flutter gen-l10n (configured by l10n.yaml). Extra flags go through .args().

#

FlutterCompileSettings

class
class FlutterCompileSettings extends FlutterSettings

Flags shared by the commands that compile Dart code: --no-pub, --dart-define, --dart-define-from-file and --flavor.

MemberSignatureDoc
noPub noPub(): this Skip the implicit flutter pub get (--no-pub).
dartDefine dartDefine(name: string, value: string): this Define a compile-time constant (--dart-define=name=value); repeatable.
dartDefineFromFile dartDefineFromFile(path: PathLike): this Read compile-time constants from a JSON or .env file (--dart-define-from-file); repeatable.
flavor flavor(name: string): this The build flavor, for apps with product flavors or schemes (--flavor).
#

FlutterConfigSettings

class
class FlutterConfigSettings extends FlutterSettings

Settings for flutter config.

MemberSignatureDoc
enable enable(feature: string): this Turn a feature on, e.g. web → --enable-web; repeatable.
disable disable(feature: string): this Turn a feature off, e.g. web → --no-enable-web; repeatable.
androidSdk androidSdk(dir: PathLike): this The Android SDK directory (--android-sdk).
noAnalytics noAnalytics(): this Turn analytics reporting off (--no-analytics).
clearFeatures clearFeatures(): this Reset every feature flag to its default (--clear-features).
#

FlutterCreateSettings

class
class FlutterCreateSettings extends FlutterSettings

Settings for flutter create.

MemberSignatureDoc
dir dir(path: PathLike): this The directory to create the project in; required.
org org(org: string): this The reverse-domain organization, e.g. com.example (--org).
projectName projectName(name: string): this The Dart package name, instead of the directory's (--project-name).
description description(text: string): this The project description (--description).
template template(name: string): this The template: app, module, package, plugin, … (--template).
platform platform(name: string): this A platform to scaffold, e.g. android or web (--platforms); repeatable.
empty empty(): this Scaffold a minimal app without the counter sample (--empty).
#

FlutterDevicesSettings

class
class FlutterDevicesSettings extends FlutterSettings

Settings for flutter devices.

MemberSignatureDoc
machine machine(): this Print the devices as JSON (--machine).
#

FlutterDoctorSettings

class
class FlutterDoctorSettings extends FlutterSettings

Settings for flutter doctor.

MemberSignatureDoc
verbose verbose(): this Show full details for every check (--verbose).
#

FlutterDriveSettings

class
class FlutterDriveSettings extends FlutterAppSettings

Settings for flutter drive, which runs integration tests on a device.

MemberSignatureDoc
driver driver(path: PathLike): this The test driver file, e.g. test_driver/integration_test.dart (--driver).
deviceId deviceId(id: string): this The device to run on, e.g. chrome or an emulator id (--device-id).
screenshot screenshot(dir: PathLike): this Save a screenshot to this directory if the run fails (--screenshot).
#

FlutterInstallSettings

class
class FlutterInstallSettings extends FlutterSettings

Settings for flutter install, which installs a built app on a device.

MemberSignatureDoc
mode mode(mode: FlutterBuildMode): this Install the build of this mode (--debug, --profile or --release).
flavor flavor(name: string): this Install this build flavor (--flavor).
deviceId deviceId(id: string): this The device to install on (--device-id).
useApplicationBinary useApplicationBinary(path: PathLike): this Install this prebuilt binary instead (--use-application-binary).
uninstallOnly uninstallOnly(): this Only uninstall the app (--uninstall-only).
#

FlutterPlainCommand

type
type FlutterPlainCommand = clean | gen-l10n

A flutter command that a build runs without flags.

#

FlutterPrecacheSettings

class
class FlutterPrecacheSettings extends FlutterSettings

Settings for flutter precache, which downloads platform artifacts.

MemberSignatureDoc
platform platform(name: string): this Fetch a platform's artifacts, e.g. android → --android; repeatable.
force force(): this Re-download even when cached (--force).
#

FlutterPubDepsSettings

class
class FlutterPubDepsSettings extends FlutterSettings

Settings for flutter pub deps.

MemberSignatureDoc
json json(): this Print the dependency graph as JSON (--json).
#

FlutterPubGetSettings

class
class FlutterPubGetSettings extends FlutterSettings

Settings for flutter pub get.

MemberSignatureDoc
offline offline(): this Resolve from the local pub cache only (--offline).
enforceLockfile enforceLockfile(): this Fail rather than change pubspec.lock (--enforce-lockfile).
#

FlutterPubOutdatedSettings

class
class FlutterPubOutdatedSettings extends FlutterSettings

Settings for flutter pub outdated.

MemberSignatureDoc
json json(): this Print machine-readable JSON (--json).
showAll showAll(): this Include packages that are already up to date (--show-all).
#

FlutterPubPackagesSettings

class
class FlutterPubPackagesSettings extends FlutterSettings

Settings for flutter pub add and flutter pub remove.

MemberSignatureDoc
package package(spec: string): this A package to add or remove; repeatable, at least one is required. For add it takes pub's descriptor syntax: http, http:^1.2.0, or dev:mocktail for a dev dependency.
#

FlutterPubUpgradeSettings

class
class FlutterPubUpgradeSettings extends FlutterSettings

Settings for flutter pub upgrade.

MemberSignatureDoc
package package(name: string): this Upgrade only this package (defaults to all); repeatable.
majorVersions majorVersions(): this Also raise constraints in pubspec.yaml across majors (--major-versions).
tighten tighten(): this Raise lower bounds in pubspec.yaml to the resolved versions (--tighten).
#

FlutterSettings

class
class FlutterSettings extends ToolSettings

Base for all flutter settings: the binary is flutter, found on PATH.

#

FlutterTasks

const
const FlutterTasks: FlutterTasksApi

Typed task functions for the flutter CLI.

#

FlutterTasksApi

interface
interface FlutterTasksApi

The shape of FlutterTasks.

MemberSignatureDoc
analyze analyze(configure?: Configure<FlutterAnalyzeSettings>): Promise<CommandOutput> Analyze the project's Dart code: flutter analyze.
test test(configure?: Configure<FlutterTestSettings>): Promise<CommandOutput> Run the unit and widget tests: flutter test.
pubGet pubGet(configure?: Configure<FlutterPubGetSettings>): Promise<CommandOutput> Resolve dependencies: flutter pub get.
pubUpgrade pubUpgrade(configure?: Configure<FlutterPubUpgradeSettings>): Promise<CommandOutput> Upgrade dependencies: flutter pub upgrade.
pubOutdated pubOutdated(configure?: Configure<FlutterPubOutdatedSettings>): Promise<CommandOutput> List outdated dependencies: flutter pub outdated.
pubDeps pubDeps(configure?: Configure<FlutterPubDepsSettings>): Promise<CommandOutput> Print the dependency graph: flutter pub deps.
pubAdd pubAdd(configure: Configure<FlutterPubPackagesSettings>): Promise<CommandOutput> Add dependencies to pubspec.yaml: flutter pub add.
pubRemove pubRemove(configure: Configure<FlutterPubPackagesSettings>): Promise<CommandOutput> Remove dependencies from pubspec.yaml: flutter pub remove.
clean clean(configure?: Configure<FlutterCommandSettings>): Promise<CommandOutput> Delete the build and .dart_tool directories: flutter clean.
create create(configure: Configure<FlutterCreateSettings>): Promise<CommandOutput> Scaffold a project: flutter create.
genL10n genL10n(configure?: Configure<FlutterCommandSettings>): Promise<CommandOutput> Generate localizations from l10n.yaml: flutter gen-l10n.
drive drive(configure?: Configure<FlutterDriveSettings>): Promise<CommandOutput> Run integration tests on a device: flutter drive.
install install(configure?: Configure<FlutterInstallSettings>): Promise<CommandOutput> Install a built app on a device: flutter install.
devices devices(configure?: Configure<FlutterDevicesSettings>): Promise<CommandOutput> List connected devices: flutter devices.
doctor doctor(configure?: Configure<FlutterDoctorSettings>): Promise<CommandOutput> Check the toolchain: flutter doctor.
precache precache(configure?: Configure<FlutterPrecacheSettings>): Promise<CommandOutput> Download platform artifacts: flutter precache.
config config(configure?: Configure<FlutterConfigSettings>): Promise<CommandOutput> Change SDK settings: flutter config.
version version(configure?: Configure<FlutterVersionSettings>): Promise<CommandOutput> Print the Flutter, Dart and engine versions: flutter --version.
buildAar buildAar: FlutterBuildTask Build an Android library: flutter build aar. It builds the debug, profile and release variants unless told not to, so a single mode needs the others turned off through .args("--no-debug", "--no-profile").
buildApk buildApk: FlutterBuildTask Build an Android APK: flutter build apk.
buildAppBundle buildAppBundle: FlutterBuildTask Build an Android App Bundle: flutter build appbundle.
buildIos buildIos: FlutterBuildTask Build the iOS app: flutter build ios.
buildIpa buildIpa: FlutterBuildTask Build an iOS archive and IPA: flutter build ipa.
buildLinux buildLinux: FlutterBuildTask Build the Linux desktop app: flutter build linux.
buildMacos buildMacos: FlutterBuildTask Build the macOS desktop app: flutter build macos.
buildWeb buildWeb: FlutterBuildTask Build the web app: flutter build web.
buildWindows buildWindows: FlutterBuildTask Build the Windows desktop app: flutter build windows.
#

FlutterTestSettings

class
class FlutterTestSettings extends FlutterCompileSettings

Settings for flutter test.

MemberSignatureDoc
path path(path: PathLike): this A test file or directory to run (defaults to test/); repeatable.
coverage coverage(): this Collect coverage into coverage/lcov.info (--coverage).
coveragePath coveragePath(path: PathLike): this Where to write the lcov coverage report (--coverage-path).
mergeCoverage mergeCoverage(): this Merge with the existing coverage report (--merge-coverage).
name name(pattern: string): this Run only tests whose name matches a regular expression (--name); repeatable.
plainName plainName(text: string): this Run only tests whose name contains a string (--plain-name); repeatable.
tags tags(expression: string): this Run only tests with a tag expression (--tags).
excludeTags excludeTags(expression: string): this Skip tests matching a tag expression (--exclude-tags).
concurrency concurrency(count: number): this How many test suites to run at once (--concurrency).
reporter reporter(name: string): this The console reporter: compact, expanded, github, json, … (--reporter).
fileReporter fileReporter(spec: string): this Also write a reporter's output to a file, e.g. json:report.json (--file-reporter).
updateGoldens updateGoldens(): this Rewrite golden files instead of comparing against them (--update-goldens).
platform platform(name: string): this Run on a platform other than the VM, e.g. chrome (--platform).
randomizeOrderingSeed randomizeOrderingSeed(seed: string | number): this Shuffle test order with a seed, or random (--test-randomize-ordering-seed).
timeout timeout(value: string): this The default per-test timeout, e.g. 30s or 2x (--timeout).
shard shard(index: number, total: number): this Run one shard of the suite: shard(index, total) renders --total-shards total --shard-index index, with index from 0.
#

FlutterVersionSettings

class
class FlutterVersionSettings extends FlutterSettings

Settings for flutter --version.

MemberSignatureDoc
machine machine(): this Print the versions as JSON (--machine).