ordered method

SelectBuilder<R> ordered()

Preserve declaration order instead of applying fairness rotation.

By default, XSelect uses fairness rotation to prevent starvation. Call this method to evaluate branches in the order they were declared.

Example:

// Process high-priority channel first, then others
await XSelect.run<String>((s) => s
  ..onRecvValue(highPriority, (msg) => 'High: $msg')
  ..onRecvValue(mediumPriority, (msg) => 'Medium: $msg')
  ..onRecvValue(lowPriority, (msg) => 'Low: $msg')
  ..ordered()  // Prioritize in declaration order
);

Implementation

SelectBuilder<R> ordered() {
  _ordered = true;
  return this;
}