active_property_change_notifier 0.0.1-alpha copy "active_property_change_notifier: ^0.0.1-alpha" to clipboard
active_property_change_notifier: ^0.0.1-alpha copied to clipboard

Actively pushes changes of itself and nested objects, including which property is changed, values before and after.

example/lib/main.dart

import 'package:active_property_change_notifier/active_property_change_notifier.dart';

part 'main.g.dart';

@NotifyPropertyChange()
mixin ObservableData on ActivePropertyChangeNotifier{
  int simpleProperty;
  String simpleStringProperty;

  @CustomField(ObservableData)
  @propagateChanges
  ObservableData nestedData;
}

void main() async {
  ObservableData testSubject = ObservableDataImpl();
  
  testSubject.propertyChangesStream().listen((change){
    print("value changed on ${change.propertyPath} from ${change.previousValue} to ${change.currentValue}");
  });
  testSubject.propertyChangesStream().listen((change) => print("another listener found changes in path: ${change.propertyPath}"));
  testSubject.propertyChangesStreamOnPath("nestedData/simpleStringProperty").listen((change) => print("only listen for path ${change.propertyPath}."));
  
  testSubject.nestedData = ObservableDataImpl();
  
  testSubject.simpleProperty = 10;
  testSubject.simpleStringProperty = "Hello";
  testSubject.nestedData.simpleProperty = 20;
  testSubject.nestedData.simpleStringProperty = "Hello";
  
  testSubject.simpleProperty = 20;
  testSubject.simpleStringProperty = "Hello world";
  testSubject.nestedData.simpleProperty = 30;
  testSubject.nestedData.simpleStringProperty = "Hello world";
}
0
likes
40
pub points
0%
popularity

Publisher

unverified uploader

Actively pushes changes of itself and nested objects, including which property is changed, values before and after.

Homepage
Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

meta

More

Packages that depend on active_property_change_notifier