Skip to content

RillNeverOps

extension RillNeverOps on Rill<Never>

Operations only available on a Rill that emits no elements — Rill<Never>.

Methods

widen() extension

Rill<O2> widen<O2>()

Widens this Rill<Never> to Rill<O2>.

Useful when an API expects Rill<O2> and you have a Rill<Never> that produces no elements (e.g. after Rill.drain or Rill.foreach).

Why this is type-safe: the ideal signature would use a lower type bound:

dart
Rill<O2> widen<O2 super O>()

where O2 super O means "O2 is a supertype of O". Dart does not support lower type bounds, so restricting the receiver to Rill<Never> encodes the same constraint at the type level. Never is the bottom type — Never <: O2 for every O2 — so the cast Pull<Never, Unit> as Pull<O2, Unit> always succeeds at runtime.

See also Rill.append for the type-preserving concatenation variant.

Available on Rill<O>, provided by the RillNeverOps extension

Implementation
dart
Rill<O2> widen<O2>() => (underlying as Pull<O2, Unit>).rillNoScope;