get<V> method
Retrieves the active configurations for a specific TestVariant instance.
Since MatrixVariant orchestrates the lifecycle, it extracts the current active
value from the inner mapping matching the provided variant reference.
Throws a StateError if triggered outside the execution bounds of an active test slice.
Throws an ArgumentError if the provided variant was not supplied in the matrix configuration.
Implementation
V get<V>(TestVariant<V> variant) {
final activeMap = _current;
if (activeMap == null) {
throw StateError(
'Matrix values cannot be accessed outside the lifecycle execution bounds of a running test.',
);
}
if (!activeMap.containsKey(variant)) {
throw ArgumentError(
'The requested variant instance was not provided in this MatrixVariant configuration.',
);
}
// Direct lookup from the map snapshot ensuring 100% type-safe return without type scanning
return activeMap[variant] as V;
}