SignalsWatch<T>.select constructor

const SignalsWatch<T>.select(
  1. ReadonlySignal signal, {
  2. Key? key,
  3. required T selector(
    1. dynamic value
    ),
  4. required Widget builder(
    1. T value
    ),
  5. Function? onInit,
  6. Function? onValueUpdated,
  7. Function? onAfterBuild,
  8. Function? onDispose,
  9. bool shouldRebuild(
    1. T newValue,
    2. T oldValue
    )?,
  10. bool shouldNotify(
    1. T newValue,
    2. T oldValue
    )?,
  11. bool equals(
    1. T a,
    2. T b
    )?,
  12. Duration? debounce,
  13. Duration? throttle,
  14. void onError(
    1. Object error,
    2. StackTrace stackTrace
    )?,
  15. Widget errorBuilder(
    1. Object error
    )?,
  16. Widget loadingBuilder()?,
  17. String? debugLabel,
  18. bool debugPrint = false,
})

Create a SignalsWatch with a selector for efficient updates. Only rebuilds when the selected value changes (compared via equals).

Implementation

const SignalsWatch.select(
  ReadonlySignal<dynamic> signal, {
  super.key,
  required T Function(dynamic value) selector,
  required this.builder,
  this.onInit,
  this.onValueUpdated,
  this.onAfterBuild,
  this.onDispose,
  this.shouldRebuild,
  this.shouldNotify,
  this.equals,
  this.debounce,
  this.throttle,
  this.onError,
  this.errorBuilder,
  this.loadingBuilder,
  this.debugLabel,
  this.debugPrint = false,
})  : assert(
        debounce == null || throttle == null,
        'Cannot use both debounce and throttle simultaneously',
      ),
      _signal = signal,
      _selector = selector,
      _signals = null,
      _combine = null,
      _read = null;