call<T> method
Widget
call<T>(
- T onTick(
- Duration elapsed
- Widget builder(
- BuildContext context,
- BloomVia via,
- T value
- Key? key,
Creates an inline reactive widget driven by a continuous frame ticker.
Converts continuous elapsed duration pulses from a frame ticker into reactive state of type T
via onTick, re-evaluating builder synchronously on each frame tick.
onTick: Callback converting frame elapsed duration to state of typeT. Evaluated synchronously with Duration.zero to seed initial state, and subsequently on frame ticks.builder: Reactive builder callback receiving BuildContext, BloomVia, and current driven valueT.key: Optional widget key.
Requires:
onTickmust be a pure, deterministic conversion function.
Ensures:
- Returns an inline reactive Widget driven continuously by element frame ticks.
Examples
composed.drive<double>(
(elapsed) => (elapsed.inMilliseconds % 1000) / 1000.0,
(context, via, progress) => CircularProgressIndicator(value: progress),
);
Implementation
@pragma('vm:prefer-inline')
Widget call<T>(
T Function(Duration elapsed) onTick,
Widget Function(BuildContext context, BloomVia via, T value) builder, {
Key? key,
}) =>
_ComposedDriveWidget<T>(
onTick: onTick,
builder: builder,
key: key,
);