dirty_check 0.1.0

dirty_check #

Observe and be notified when a value changes.

Warning: This is not an official Google or Dart project.

Installation #

  dirty_check: ^0.1.0

Usage #

This library uses Zones in order to be notified when the VM event loop ends. As such you'll need to run some or all of your code inside of a specific function, runChecked, in order to receive updates:

import 'package:dirty_check/dirty_check.dart';

main() {
  runChecked(() => startYourApp());

You can then use the observe top-level function to receive a Stream which updates when the observed method or closure changes in value. For example to be notified when Person#name changes:

set person(Person person) {
  observe(() => person.name).listen((newName) {
    print('The user renamed themselves $newName.');

Limitations #

In order to avoid performance or code-bloat on some platforms, this library does not use dart:mirrors, which means it does not have knowledge of class structure. As such it may not be practical to use this library to arbitrarily observe many properties on an object.

Users are encouraged to explore alternative APIs/code generation :)

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  dirty_check: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:dirty_check/dirty_check.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.22.0 <2.0.0