immutable_state 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 73

immutable_state

Pub build status

🎯 A lightweight framework for UI state management in Flutter and Dart, and an alternative to Redux.

package:immutable_state can be used by itself easily, or with ready-made integrations like package:flutter_immutable_state.

Visit the homepage for documentation and info.

1.0.0

  • Initial release.

example/main.dart

import 'package:immutable_state/immutable_state.dart';

void main() {
  var appState = new Immutable(
    new AppState(
      titleState: new TitleState(
        title: 'Hello!',
      ),
    ),
  );

  var titleState = appState.property(
    (state) => state.titleState,
    change: (state, titleState) => state.changeTitleState(titleState),
  );

  // Changes propagate to the parent...
  titleState.change((state) => state.changeTitle('world'));
}

class AppState {
  final TitleState titleState;

  AppState({this.titleState});

  @override
  bool operator ==(other) =>
      other is AppState && other.titleState == titleState;

  AppState changeTitleState(TitleState titleState) =>
      new AppState(titleState: titleState);
}

class TitleState {
  final String title;

  TitleState({this.title});

  @override
  bool operator ==(other) => other is TitleState && other.title == title;

  TitleState changeTitle(String title) => new TitleState(title: title);
}

Use this package as a library

1. Depend on it

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


dependencies:
  immutable_state: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:immutable_state/immutable_state.dart';
  
Version Uploaded Documentation Archive
1.0.0 Jun 25, 2018 Go to the documentation of immutable_state 1.0.0 Download immutable_state 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
46
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:immutable_state/immutable_state.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <3.0.0
Dev dependencies
test ^0.12.0