DistinctSignal<T> constructor

DistinctSignal<T>(
  1. Signal<T> source, {
  2. String? debugLabel,
  3. bool equals(
    1. T a,
    2. T b
    )?,
  4. T guard(
    1. T current,
    2. T next
    )?,
  5. VoidCallback? onListen,
  6. VoidCallback? onCancel,
})

Implementation

DistinctSignal(
  this.source, {
  String? debugLabel,
  super.equals,
  super.guard,
  super.onListen,
  super.onCancel,
}) : super(source.val, debugLabel: debugLabel) {
  _subscription = source.stream.listen((value) {
    if (val != value) {
      emit(value);
    }
  });
}