dirty_check 0.1.0

  • README.md
  • Installing
  • Versions
  • 0

dirty_check

Observe and be notified when a value changes.

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

Installation

dependencies:
  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:


dependencies:
  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';
  
Version Uploaded Documentation Archive
0.1.0 Jun 8, 2017 Go to the documentation of dirty_check 0.1.0 Download dirty_check 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
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://www.dartlang.org/dart-2#migration.

Maintenance issues and suggestions

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Dependencies

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