resolveTransferControl function

StaticOrRuntimeParameter resolveTransferControl(
  1. StaticOrRuntimeParameter? control, {
  2. required String name,
})

Resolves how a consumer takes a result that a core produces.

A core accepts one such control for each result that a consumer may leave waiting. A runtime control is the consumer's one-bit action: the core then generates its input, named name, and the logic that retains the result until that action. Omitting control, or fixing it true, declares a scheduled consumer that takes every result in the cycle it is presented, so the core generates neither. A control fixed false is rejected, because the result would never be taken.

Implementation

StaticOrRuntimeParameter resolveTransferControl(
    StaticOrRuntimeParameter? control,
    {required String name}) {
  if (control != null && !control.isRuntime && !control.staticConfig) {
    throw ArgumentError.value(
        control, name, 'A result must be taken; it cannot be fixed false.');
  }
  return StaticOrRuntimeParameter(
      name: name,
      staticConfig: control == null || control.staticConfig,
      runtimeConfig: control?.runtimeConfig);
}