dart_saga 0.1.0

  • README.md
  • Installing
  • Versions
  • new41

[WIP][POC] Port of redux-saga to Dart

Redux-saga like process manager for Dart.

Note: This package is still under development, and many of functionality might not be available yet. Feedback and Pull Requests are most welcome!

Sample code

import "dart:async";
import 'package:dart_saga/dart_saga.dart';

Iterable<Effect> rootSaga([msg]) sync* {
  print("rootSaga(${msg}) started");
  yield new ForkEffect(saga2, "start saga2");
  while (true) {
    print("rootSaga");
    yield new AsyncCallEffect.func(
        () => new Future.delayed(new Duration(seconds: 1)));
  }
}

Iterable<Effect> saga2([msg]) sync* {
  print("           saga2(${msg}) started");
  yield new ForkEffect(saga3, "start saga3");
  while (true) {
    print("           saga2");
    yield new WaitEffect(3);
    yield new PutEffect(new Action("HOGE"));
  }
}

Iterable<Effect> saga3([msg]) sync* {
  print("                      saga3(${msg}) started");
  while (true) {
    print("                      saga3");
    yield new TakeEffect(new Action("HOGE"));
  }
}

main() async {
  var effectManager = new EffectManager();
  effectManager.startSaga(rootSaga, "start rootSaga");
}


Demo

% pub run example/simple_demo.dart
start isolate context
rootSaga(start rootSaga) started
rootSaga
           saga2(start saga2) started
           saga2
                      saga3(start saga3) started
                      saga3
rootSaga
rootSaga
rootSaga
           saga2
Action(HOGE)
                      saga3
rootSaga
rootSaga
  :

1. Depend on it

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


dependencies:
  dart_saga: "^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:dart_saga/dart_saga.dart';
        
Version Uploaded Documentation Archive
0.1.0 Apr 12, 2018 failed Download dart_saga 0.1.0 archive

Analysis

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

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

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

Platforms

Detected platforms: unsure

Error(s) prevent platform classification:

Error(s) in lib/dart_saga.dart: The name 'Saga' is defined in the libraries 'saga.dart' and 'effect.dart'.

Suggestions

  • Fix platform conflicts.

    Error(s) prevent platform classification:

    Error(s) in lib/dart_saga.dart: The name 'Saga' is defined in the libraries 'saga.dart' and 'effect.dart'.

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 errors.

    Make sure that the imported libraries are not in conflict. Error(s) in lib/dart_saga.dart: The name 'Saga' is defined in the libraries 'saga.dart' and 'effect.dart'.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use dart_saga.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.32.0 <3.0.0