ractor 1.1.0

Ractor #

A fresh and funny state management package. Power by dart-actor.

Usage #

Racor.dart consist of three main ideas. Thay are System, Store and Event.

System #

Every logic app should have an event system to broadcast and catch event.

import 'package:ractor/ractor.dart';

var system = System("cardcard");

Event #

IMO, everything should trigger event. Such as click button, select a photo. Event should indicate what user have done. You can create a event by class.

class SetCoverImage {
  File cover;


Store #

Store is a unit to store state and catch event. After store catched related events, you can transform event to new state or do nothing.

import 'dart:io';

import 'package:ractor/ractor.dart';

class DraftStore extends Store {
  File cover;

  createReceive() {
    return receiveBuilder().match<SetCoverImage>((setCoverImage) {
      // we catched SetCoverImage, setCoverImage.cover is our new state right now.
      setState(() {
        cover = setCoverImage.cover;

How to use ractor with flutter #

Highly recommend ractor_hooks to connect ractor store and fluter widget.

SystemProvider #

Just like Provider in react-redux. SystemProvider should be your root widget, and provide system and stores to it.

import 'package:flutter/material.dart';
import 'package:ractor_hooks/ractor_hooks.dart';

class Main extends StatelessWidget {
  Widget build(BuildContext context) {
    return SystemProvider(
      child: MaterialApp(),
      system: system,
      stores: [LoggerStore(), DraftStore()],

useStore #

SystemProvider is a simple dependencies injection. The Instance of the Stores that you provided have been preserved into SystemProvider, so must take it by token. useStore can help us to take it.

class MyWidget extends RactorHookWidget {
  build {
    final draftStore = useStore(DraftStore);
    return Image.file(draftStore.cover);

1.0.0 #

  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

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

  ractor: ^1.1.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or 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:ractor/ractor.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.

We analyzed this package on Feb 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Maintenance suggestions

The package description is too short. (-17 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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 ractor.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
dart_actor ^0.1.0 0.1.4
Transitive dependencies
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
event_bus 1.1.1
typed_data 1.1.6
uuid 2.0.4
Dev dependencies
pedantic ^1.0.0
test ^1.0.0