runtimeOverride function
Lookup and execute an overriden function on the globalRuntime by its ID
Implementation
Object? runtimeOverride(String id, [Iterable<Object?> args = const []]) {
final spec = runtimeOverrides?[id];
if (spec == null) {
return null;
}
if (runtimeOverrideVersion != null && spec.versionConstraint != null) {
if (!VersionConstraint.parse(spec.versionConstraint!)
.allows(runtimeOverrideVersion!)) {
return null;
}
}
globalRuntime!.args.addAll(args);
final result = globalRuntime!.execute(spec.offset);
if (result == null) {
return $null();
}
if (result is List && result is! $List) {
return $List.wrap(result).$reified;
}
return result is $Value ? result.$reified : result;
}