select<R> method

Computed<R> select<R>(
  1. R selector(
    1. ReadonlySignal<T>
    ), {
  2. bool? autoDispose = false,
  3. String? debugLabel,
})

Select a value and return a computed signal to listen for changes

final a = signal({'a': 1, 'b': 2});
final b = a.select((val) => val()['a'] as int);

Implementation

Computed<R> select<R>(
  R Function(ReadonlySignal<T>) selector, {
  bool? autoDispose = false,
  String? debugLabel,
}) {
  return computed(
    () => selector(this),
    autoDispose: autoDispose ?? this.autoDispose,
    debugLabel: debugLabel,
  );
}