Arguments class

Configuration class for custom build process arguments.

This class extends BuildArguments to provide comprehensive configuration options for custom build workflows. It supports flexible binary type specification, user-defined arguments, and advanced build customization that can accommodate diverse project requirements and build environments.

Key Capabilities

  • Binary Type Flexibility: Supports any binary output format specification
  • Custom Arguments: Allows passing arbitrary arguments to build commands
  • Build Mode Control: Configurable debug, profile, and release modes
  • Flavor Support: Product flavor and variant management
  • Dart Compilation: Advanced Dart define and compilation options
  • Output Customization: Flexible output path and naming control
  • Build Integration: Compatible with existing build systems and tools

Configuration Options

The class manages various build parameters:

  • Binary output format and type specification
  • Build mode and optimization settings
  • Custom command-line arguments for specialized builds
  • Source directory and target file configuration
  • Dart compilation defines and build metadata
  • Output path management and file naming

Example Usage

// Create custom build configuration
final args = Arguments(
  variables,
  binaryType: 'aab',
  buildMode: 'release',
  customArgs: ['--verbose', '--analyze-size'],
  flavor: 'production',
  output: './custom-builds/',
);

// Execute custom build
final result = await args.build();
Inheritance

Constructors

Arguments(Variables variables, {String? buildMode = 'release', required String binaryType, required String buildSourceDir, String? target, String? flavor, String? dartDefines, String? dartDefinesFile, String? buildName, String? buildNumber, bool pub = true, String? output, List<String>? customArgs})
Creates a new custom build arguments configuration.
Arguments.fromArgResults(ArgResults results, ArgResults? globalResults)
Factory constructor creating Arguments from command-line results.
factory
Arguments.fromJson(Map<String, dynamic> json, {required Variables variables})
Factory constructor creating Arguments from JSON configuration.
factory

Properties

argumentBuilder ↔ List<String>
Generates the command-line arguments for the Flutter build command.
getter/setter pairinherited
arguments → Future<List<String>>
Processes variables in arguments and returns the final command-line arguments.
no setterinherited
binaryType → String
Type of binary to build (e.g., 'apk', 'aab', 'ipa').
finalinherited
buildMode → String?
Build mode for the application.
finalinherited
buildName ↔ String?
Version name for the application build.
getter/setter pairinherited
buildNumber ↔ String?
Version code/build number for the application.
getter/setter pairinherited
buildSourceDir → String
Source directory where build artifacts are initially created.
finalinherited
customArgs → List<String>?
Additional custom arguments for the Flutter build command.
finalinherited
dartDefineArguments → List<String>
Expands dartDefines into the --dart-define flags the Flutter CLI expects.
no setterinherited
dartDefines → String?
Dart compilation defines as a single string.
finalinherited
dartDefinesFile → String?
Path to a file containing Dart compilation defines.
finalinherited
flavor → String?
Build flavor for multi-flavor applications.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
logger ↔ ColorizeLogger
Logger instance for outputting colored messages.
getter/setter pairinherited
output ↔ String?
Custom output path for the build artifacts.
getter/setter pairinherited
parent ↔ BuilderJob
Reference to the parent builder job.
getter/setter pairinherited
pub → bool
Whether to run flutter pub get before building.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
secretKeys → Set<String>
Configuration keys whose values must never be printed or logged.
no setterinherited
target → String?
Target Dart file to build from.
finalinherited
variables → Variables
Variable processor for substituting placeholders in arguments.
finalinherited

Methods

build() → Future<int>
inherited
copyWith(Arguments? data) → BuildArguments
Creates a copy of this Arguments instance with selective updates.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
printJob() → Future
Prints the resolved configuration of a job.
inherited
registerSecrets() → Future<void>
Resolves every secret value and registers it with the logger.
inherited
toJson() → Map<String, dynamic>
Serializes the Arguments instance to a JSON-compatible map.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

parser ↔ ArgParser
Command-line argument parser for custom build configuration.
getter/setter pair