execute static method

Future<void> execute(
  1. List<String> commands, {
  2. int concurrent = defaultConcurrent,
  3. void customCommand(
    1. String
    )?,
  4. void stdout(
    1. String line
    )?,
  5. void stdoutErr(
    1. String line
    )?,
  6. bool ignorePubWorkspaces = false,
})

Executes commands in multiple Flutter project directories concurrently.

This method finds all Flutter project directories (those containing pubspec.yaml) and executes the specified commands in each directory concurrently.

Parameters:

  • commands: List of commands to execute in each directory
  • concurrent: Number of concurrent executions (default: 6)
  • customCommand: Optional custom command to execute after main commands
  • stdout: Callback for stdout lines
  • stdoutErr: Callback for stderr lines
  • ignorePubWorkspaces: Whether to ignore pub workspaces (default: false)

Example:

// Run 'flutter pub get' in all Flutter project directories
await ModularHelper.execute(['flutter pub get']);

Implementation

static Future<void> execute(
  List<String> commands, {
  int concurrent = defaultConcurrent,
  void Function(String)? customCommand,
  void Function(String line)? stdout,
  void Function(String line)? stdoutErr,
  bool ignorePubWorkspaces = false,
}) async {
  await _executeConcurrentCommands(
    commands,
    concurrent: concurrent,
    customCommand: customCommand,
    stdout: stdout,
    stdoutErr: stdoutErr,
    ignorePubWorkspaces: ignorePubWorkspaces,
  );
}