toFutureSignal method

FutureSignal<T> toFutureSignal({
  1. Duration? timeout,
  2. String? debugLabel,
  3. T? initialValue,
  4. bool autoDispose = false,
  5. bool lazy = true,
  6. List<ReadonlySignal> dependencies = const [],
})

Convert an existing future to FutureSignal

import 'package:signals/signals.dart';

final future = Future(() => 1);
final signal = future.toSignal();

Implementation

FutureSignal<T> toFutureSignal({
  Duration? timeout,
  String? debugLabel,
  T? initialValue,
  bool autoDispose = false,
  bool lazy = true,
  List<ReadonlySignal<dynamic>> dependencies = const [],
}) {
  return futureSignal(
    () => timeout != null ? this.timeout(timeout) : this,
    debugLabel: debugLabel,
    initialValue: initialValue,
    autoDispose: autoDispose,
    lazy: lazy,
    dependencies: dependencies,
  );
}