kisrs 2.1.0

  • Readme
  • Changelog
  • Installing
  • 42

kisrs - Keep It Simple, Reactive State #

First, make a class for your state. If your class has a dispose() Function, it will be called on disposal.

class MyStore implements StoreData {
    MyStore(){}

    final _x = DataPoint<int>(initial: 0);
    PublicDataPoint get x => _x.public;
    void increment(){
        _x.value = _x.value + 1;
    }

    void dispose(){
        _x.dispose();
    }
}

You can then attach an object of your class to a Store or StoreManager.

  • Store<T> just passes your data down the Widget tree
  • StoreManager<T> contains a Store and automatically calls the dispose() function when the Store is being disposed. Use this for cleanup.

You can access your Store with Store.of<T>(context).

DataPoints are how your store data in your state.

  • DataPoint<T>() creates a new DataPoint of a given Type that will be null initially.
  • DataPoint<T>(initial: x) creates a new DataPoint of a given Type that contains initial data.

datapoint.value = 'Hello' sets the value of datapoint to 'Hello' and sends the new value to the stream.

datapoint.value is the current value.

datapoint.stream is is a stream of value changes. When you listen to it, it immediately sends the value.

datapoint.dispose() releases the memory used for the DataPoint. You must do this in order to prevent memory leaks!

[2.1.0] - Sat Apr 20 2019

  • Add ReactiveTextField

[2.0.1] - Sat Mar 16 2019

  • Fix null check of StoreManager disposer

[2.0.0] - Sat Mar 16 2019

  • Fix several conceptual flaws of older versions.

[1.0.5] - Sat Mar 16 2019

  • If DataPoint.value == null, allow any mutation

[1.0.4] - Mon Mar 12 2019

  • Make DataPoint.onChange async

[1.0.3] - Mon Mar 12 2019

  • DataPoint.onChange now gets executed before the data is being added to the sink. You can modify the data. If you want to refuse a change, return null.

[1.0.2] - Mon Mar 12 2019

  • Define DataPoint.onChange return type.

[1.0.1] - Mon Mar 11 2019

  • Added DataPoint onChange

[1.0.0] - Mon Mar 11 2019

  • Initial Release

Use this package as a library

1. Depend on it

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


dependencies:
  kisrs: ^2.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:kisrs/kisrs.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
42
Learn more about scoring.

We analyzed this package on Nov 19, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/lumi-sch/kisrs was unreachable.

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (rxdart).

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and kisrs.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
rxdart ^0.21.0 0.21.0 0.22.6
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test