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


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


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

import 'package:ractor/ractor.dart';

var system = System("cardcard");


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 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.


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()],


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);