value_broadcast 1.0.4 value_broadcast: ^1.0.4 copied to clipboard
Analog for the Flutter's listenable (valueNotifier) in pure Dart used for console applications without flutter desktop embedding.
import 'package:value_broadcast/value_broadcast.dart';
void main(){
final ValueBroadcast<int> valueBroadcast = ValueBroadcast(1)..addListener(switchIndex);
valueBroadcast.value = 1; //Will not trigger listeners
valueBroadcast.value = 3;
valueBroadcast.value = 2;
valueBroadcast.value = 1;
valueBroadcast.dispose();
}
void switchIndex(final int index) => print("Switching index to $index");