testInputsFromEnvironment function
Map<String, dynamic>
testInputsFromEnvironment(
)
Implementation
Map<String, dynamic> testInputsFromEnvironment() {
final runtimeInputs =
RunnerRuntimeConfiguration.current.string('ensembleTestInputs');
if (runtimeInputs.isNotEmpty) {
final decodedRuntime = json.decode(runtimeInputs);
if (decodedRuntime is Map) {
return decodedRuntime
.map((key, value) => MapEntry(key.toString(), value));
}
throw EnsembleTestFailure('Invalid ensembleTestInputs runtime payload.');
}
const encoded = String.fromEnvironment('ensembleTestInputs');
if (encoded.isEmpty) return const {};
try {
final value = json.decode(utf8.decode(base64Url.decode(encoded)));
if (value is Map) {
return value.map((key, value) => MapEntry(key.toString(), value));
}
} catch (_) {
// Fall through to the explicit failure below.
}
throw EnsembleTestFailure('Invalid ensembleTestInputs dart-define payload.');
}