Skip to content

FlutterSignal

Since Signals 0.6.0, you can use the signals_flutter import to create signals that extend ValueNotifier.

import 'package:signals/signals_flutter.dart';
final count = signal(0);
assert(count is Signal<int>);
assert(count is FlutterSignal<int>);
assert(count is FlutterReadonlySignal<int>);
assert(count is ValueNotifier<int>);

Custom Signal

To create a custom signal that extends ValueNotifier, use the ValueNotifierSignalMixin mixin.

import 'package:signals/signals_flutter.dart';
class MySignal extends Signal<int> with ValueNotifierSignalMixin<int> {
MySignal(int value) : super(value);
}

Or extend FlutterSignal directly.

import 'package:signals/signals_flutter.dart';
class MySignal extends FlutterSignal<int> {
MySignal(int value) : super(value);
}