flutter
integration tests on an Android emulator.Images are built by the flutter-container module (Flutter SDK, Android SDK and
emulator stages). Every function accepts an optional pre-built image to skip the
local image build, e.g. one pulled from ghcr.io/daniel-naegele/flutter.
Installation
dagger install github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483Entrypoint
Return Type
Flutter ! Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
func (m *MyModule) Example() *dagger.Flutter {
return dag.
Flutter()
}@function
def example() -> dagger.Flutter:
return (
dag.flutter()
)@func()
example(): Flutter {
return dag
.flutter()
}Types
Flutter 🔗
flutterVersion() 🔗
Flutter SDK version tag (e.g. “3.47.6”).
Return Type
String ! Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
flutter-versionfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Flutter().
Flutterversion(ctx)
}@function
async def example() -> str:
return await (
dag.flutter()
.flutterversion()
)@func()
async example(): Promise<string> {
return dag
.flutter()
.flutterVersion()
}androidVersion() 🔗
Android platform API level for the emulator system image (e.g. “36”).
Return Type
String ! Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
android-versionfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Flutter().
Androidversion(ctx)
}@function
async def example() -> str:
return await (
dag.flutter()
.androidversion()
)@func()
async example(): Promise<string> {
return dag
.flutter()
.androidVersion()
}registry() 🔗
Registry to pull prebuilt images from (e.g. “ghcr.io/daniel-naegele”). When empty the images are built from scratch. Prebuilt images only exist for the default Android API level, so a different AndroidVersion builds locally.
Return Type
String ! Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
registryfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Flutter().
Registry(ctx)
}@function
async def example() -> str:
return await (
dag.flutter()
.registry()
)@func()
async example(): Promise<string> {
return dag
.flutter()
.registry()
}analyze() 🔗
Analyze runs static analysis (flutter analyze) using the project’s analysis_options.yaml and returns the analyzer output.
Errors always fail the analysis; warnings and infos fail it depending on fatalWarnings and fatalInfos.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| project | Directory ! | - | Flutter project directory. |
| fatalInfos | Boolean | - | Treat info level issues as fatal. |
| fatalWarnings | Boolean | true | Treat warning level issues as fatal. |
| flutterImage | Container | - | Pre-built Flutter image to use instead of building one. |
Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
analyze --project DIR_PATHfunc (m *MyModule) Example(ctx context.Context, project *dagger.Directory) string {
return dag.
Flutter().
Analyze(ctx, project)
}@function
async def example(project: dagger.Directory) -> str:
return await (
dag.flutter()
.analyze(project)
)@func()
async example(project: Directory): Promise<string> {
return dag
.flutter()
.analyze(project)
}androidImage() 🔗
AndroidImage returns the Flutter + Android SDK image used by BuildApk and BuildAppBundle.
Return Type
Container ! Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
android-imagefunc (m *MyModule) Example() *dagger.Container {
return dag.
Flutter().
Androidimage()
}@function
def example() -> dagger.Container:
return (
dag.flutter()
.androidimage()
)@func()
example(): Container {
return dag
.flutter()
.androidImage()
}buildApk() 🔗
BuildApk builds an Android APK (flutter build apk) and returns it.
Release signing: pass keystore, storePassword, keyAlias (and keyPassword if it differs from storePassword). The module then writes android/key.properties with the keys storePassword, keyPassword, keyAlias and storeFile, following the Flutter deployment docs (https://docs.flutter.dev/deployment/android#configure-signing-in-gradle). The project’s android/app/build.gradle(.kts) must read that file and use it for its release signingConfig. Without a keystore, the project’s own signing configuration applies (typically debug signing).
Return Type
File !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| project | Directory ! | - | Flutter project directory. |
| mode | String | "release" | Build mode: debug, profile or release. |
| flavor | String | - | Product flavor to build. |
| target | String | - | Main entry point (e.g. lib/main_prod.dart). |
| buildName | String | - | Version name (e.g. 1.2.3), overrides pubspec.yaml. |
| buildNumber | String | - | Version code (e.g. 42), overrides pubspec.yaml. |
| dartDefines | [String ! ] | - | Compile-time constants as KEY=VALUE, passed as –dart-define. |
| keystore | File | - | Upload/release keystore (JKS or PKCS12). |
| storePassword | Secret | - | Keystore password. |
| keyPassword | Secret | - | Key password (defaults to storePassword). |
| keyAlias | String | - | Key alias inside the keystore. |
| androidImage | Container | - | Pre-built Android image to use instead of building one (e.g. ghcr.io/daniel-naegele/flutter:-android). |
Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
build-apk --project DIR_PATHfunc (m *MyModule) Example(project *dagger.Directory) *dagger.File {
return dag.
Flutter().
Buildapk(project)
}@function
def example(project: dagger.Directory) -> dagger.File:
return (
dag.flutter()
.buildapk(project)
)@func()
example(project: Directory): File {
return dag
.flutter()
.buildApk(project)
}buildAppBundle() 🔗
BuildAppBundle builds an Android App Bundle (flutter build appbundle) and returns the .aab.
Signing works exactly as for BuildApk (android/key.properties).
Return Type
File !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| project | Directory ! | - | Flutter project directory. |
| mode | String | "release" | Build mode: debug, profile or release. |
| flavor | String | - | Product flavor to build. |
| target | String | - | Main entry point (e.g. lib/main_prod.dart). |
| buildName | String | - | Version name (e.g. 1.2.3), overrides pubspec.yaml. |
| buildNumber | String | - | Version code (e.g. 42), overrides pubspec.yaml. |
| dartDefines | [String ! ] | - | Compile-time constants as KEY=VALUE, passed as –dart-define. |
| keystore | File | - | Upload/release keystore (JKS or PKCS12). |
| storePassword | Secret | - | Keystore password. |
| keyPassword | Secret | - | Key password (defaults to storePassword). |
| keyAlias | String | - | Key alias inside the keystore. |
| androidImage | Container | - | Pre-built Android image to use instead of building one. |
Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
build-app-bundle --project DIR_PATHfunc (m *MyModule) Example(project *dagger.Directory) *dagger.File {
return dag.
Flutter().
Buildappbundle(project)
}@function
def example(project: dagger.Directory) -> dagger.File:
return (
dag.flutter()
.buildappbundle(project)
)@func()
example(project: Directory): File {
return dag
.flutter()
.buildAppBundle(project)
}emulatorImage() 🔗
EmulatorImage returns the emulator image (AVD for AndroidVersion) used by IntegrationTest.
Return Type
Container ! Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
emulator-imagefunc (m *MyModule) Example() *dagger.Container {
return dag.
Flutter().
Emulatorimage()
}@function
def example() -> dagger.Container:
return (
dag.flutter()
.emulatorimage()
)@func()
example(): Container {
return dag
.flutter()
.emulatorImage()
}flutterImage() 🔗
FlutterImage returns the Flutter SDK image used by Test, Analyze and Format.
Return Type
Container ! Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
flutter-imagefunc (m *MyModule) Example() *dagger.Container {
return dag.
Flutter().
Flutterimage()
}@function
def example() -> dagger.Container:
return (
dag.flutter()
.flutterimage()
)@func()
example(): Container {
return dag
.flutter()
.flutterImage()
}format() 🔗
Format checks that all Dart files are formatted (dart format –set-exit-if-changed). Fails and lists the offending files when formatting would change anything.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| project | Directory ! | - | Flutter project directory. |
| targets | [String ! ] | - | Files or directories to check (defaults to the whole project). |
| flutterImage | Container | - | Pre-built Flutter image to use instead of building one. |
Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
format --project DIR_PATHfunc (m *MyModule) Example(ctx context.Context, project *dagger.Directory) string {
return dag.
Flutter().
Format(ctx, project)
}@function
async def example(project: dagger.Directory) -> str:
return await (
dag.flutter()
.format(project)
)@func()
async example(project: Directory): Promise<string> {
return dag
.flutter()
.format(project)
}integrationTest() 🔗
IntegrationTest runs integration tests (flutter test integration_test) on an Android emulator booted inside the test container.
The debug APK is built first, then the emulator image’s android-start-emulator boots the AVD (configured through the image’s ANDROIDEMULATOR* env) and the tests run against emulator-5554.
The emulator needs KVM: the Dagger engine must be able to expose /dev/kvm to
privileged execs (e.g. a rootful engine). The exec runs with insecure root
capabilities so the emulator can use it. android-start-emulator checks
acceleration with emulator -accel-check; without KVM this function fails
unless requireKvm is false.
Returns a reports directory with integration-test-results.json, junit.xml, accel-check.txt, boot.txt (boot time, accel on/off, API level) and emulator.log.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| project | Directory ! | - | Flutter project directory. |
| target | String | "integration_test" | Integration test file or directory. |
| flavor | String | - | Product flavor to build. |
| dartDefines | [String ! ] | - | Compile-time constants as KEY=VALUE, passed as –dart-define. |
| bootTimeout | Integer | 300 | Seconds to wait for the emulator to finish booting. |
| testTimeout | Integer | 600 | Seconds after which one flutter test attempt is aborted. |
| attempts | Integer | 3 | Total flutter test attempts; only infrastructure failures (lost VM service, device offline, timeout) are retried, never failing tests. |
| flutterVerbose | Boolean | - | Run flutter test with -v (verbose tool logs). |
| requireKvm | Boolean | true | Fail if KVM acceleration is unavailable instead of using the software emulator. |
| ignoreFailures | Boolean | - | Return the reports even when tests fail. |
| emulatorImage | Container | - | Pre-built emulator image to use instead of building one (e.g. ghcr.io/daniel-naegele/flutter:-emulator). |
Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
integration-test --project DIR_PATHfunc (m *MyModule) Example(project *dagger.Directory) *dagger.Directory {
return dag.
Flutter().
Integrationtest(project)
}@function
def example(project: dagger.Directory) -> dagger.Directory:
return (
dag.flutter()
.integrationtest(project)
)@func()
example(project: Directory): Directory {
return dag
.flutter()
.integrationTest(project)
}test() 🔗
Test runs the project’s unit and widget tests (flutter test).
Returns a reports directory containing: - test-results.json: Dart JSON reporter output - junit.xml: JUnit XML report (for GitLab/GitHub test reporting) - lcov.info and coverage-html/: coverage, when coverage is enabled
Fails when a test fails, unless ignoreFailures is set.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| project | Directory ! | - | Flutter project directory. |
| targets | [String ! ] | - | Test files or directories to run (defaults to the test/ directory). |
| coverage | Boolean | - | Collect coverage and export lcov.info plus an HTML report. |
| ignoreFailures | Boolean | - | Return the reports even when tests fail. |
| flutterImage | Container | - | Pre-built Flutter image to use instead of building one (e.g. ghcr.io/daniel-naegele/flutter:). |
Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
test --project DIR_PATHfunc (m *MyModule) Example(project *dagger.Directory) *dagger.Directory {
return dag.
Flutter().
Test(project)
}@function
def example(project: dagger.Directory) -> dagger.Directory:
return (
dag.flutter()
.test(project)
)@func()
example(project: Directory): Directory {
return dag
.flutter()
.test(project)
}withAndroidVersion() 🔗
WithAndroidVersion returns this module configured to use the given Android API level.
Return Type
Flutter !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String ! | - | No description provided |
Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
with-android-version --version stringfunc (m *MyModule) Example(version string) *dagger.Flutter {
return dag.
Flutter().
Withandroidversion(version)
}@function
def example(version: str) -> dagger.Flutter:
return (
dag.flutter()
.withandroidversion(version)
)@func()
example(version: string): Flutter {
return dag
.flutter()
.withAndroidVersion(version)
}withFlutterVersion() 🔗
WithFlutterVersion returns this module configured to use the given Flutter version.
Return Type
Flutter !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String ! | - | No description provided |
Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
with-flutter-version --version stringfunc (m *MyModule) Example(version string) *dagger.Flutter {
return dag.
Flutter().
Withflutterversion(version)
}@function
def example(version: str) -> dagger.Flutter:
return (
dag.flutter()
.withflutterversion(version)
)@func()
example(version: string): Flutter {
return dag
.flutter()
.withFlutterVersion(version)
}withPrebuiltImages() 🔗
WithPrebuiltImages returns this module configured to pull the published flutter-container images from a registry instead of building them. The images for the configured Flutter version and Android API level must have been published (flutter-container’s publish function).
Return Type
Flutter !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| registry | String | "ghcr.io/daniel-naegele" | Registry the images were published to. |
Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
with-prebuilt-imagesfunc (m *MyModule) Example() *dagger.Flutter {
return dag.
Flutter().
Withprebuiltimages()
}@function
def example() -> dagger.Flutter:
return (
dag.flutter()
.withprebuiltimages()
)@func()
example(): Flutter {
return dag
.flutter()
.withPrebuiltImages()
}withoutPrebuiltImages() 🔗
WithoutPrebuiltImages returns this module configured to build the images from scratch instead of pulling published ones.
Return Type
Flutter ! Example
dagger -m github.com/daniel-naegele/daggerverse/flutter@003f668d6c6d5649dddbc4e47637d61f07d76483 call \
without-prebuilt-imagesfunc (m *MyModule) Example() *dagger.Flutter {
return dag.
Flutter().
Withoutprebuiltimages()
}@function
def example() -> dagger.Flutter:
return (
dag.flutter()
.withoutprebuiltimages()
)@func()
example(): Flutter {
return dag
.flutter()
.withoutPrebuiltImages()
}