$periodic static method

$Value? $periodic(
  1. Runtime runtime,
  2. $Value? target,
  3. List<$Value?> args
)

Creates a new $Stream that runs periodically

Implementation

static $Value? $periodic(
    Runtime runtime, $Value? target, List<$Value?> args) {
  final computation = args[1]?.$value as EvalCallable?;
  return $Stream.wrap(Stream.periodic(
      args[0]!.$value as Duration,
      computation == null
          ? null
          : (i) => runtime.wrap(computation.call(runtime, null, [$int(i)]))));
}