CommandDetector class

Detects a capability by running a probe command (typically tool --version) and, if it exits successfully, extracting a version string.

This covers the common case (Docker, Dart, Python, Git, …). GPU/accelerator capabilities use bespoke detectors.

Implemented types

Constructors

CommandDetector({required CapabilityKind kind, required String executable, String? name, List<String> args = const ['--version'], RegExp? versionPattern})
Creates a command-based detector.

Properties

args List<String>
The arguments passed to the probe (default ['--version']).
final
executable String
The executable to probe.
final
hashCode int
The hash code for this object.
no setterinherited
kind CapabilityKind
The kind this detector probes for.
final
name String
The capability name (defaults to kind.name).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
versionPattern RegExp
A regex whose first group captures the version from the probe output.
final

Methods

detect() Future<Capability?>
Detects the capability, or returns null if not present.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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