Skip to content
pubscout

refena

3.7.0, released 3 weeks ago by refena.dev

A state management and dependency injection library inspired by Riverpod and async_redux.

WASM-readyRock solid
$ flutter pub add refena
Source repository

What it does

Provides a notifier-focused state management system that handles app state and services via providers. Supports synchronous and asynchronous states, Redux-style actions, and high-traceability debugging tools.

AI-written summary of version 3.7.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want Riverpod-like type-safe providers without custom widget consumers
  • You need Redux-style action dispatching combined with standard state notifiers
  • You want built-in support for debugging observers, event tracing, and an inspector

Skip it when

  • You prefer automatic provider disposal (autodispose) without manual ref.dispose calls
  • You already rely heavily on Riverpod or Bloc and do not wish to introduce a new paradigm

Strengths

  • Supports multiple paradigms including Notifier, AsyncNotifier, and ReduxNotifiers
  • Native Flutter integration using BuildContext extensions without custom widget wrappers
  • Extensive tracing, debugging, and testing capabilities

Weaknesses

  • Providers are not disposed automatically and require explicit management or view models
  • Smaller ecosystem and community compared to Riverpod or Bloc

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1

Wrap your root app widget with RefenaScope.

final counterProvider = NotifierProvider<Counter, int>((ref) => Counter());

class Counter extends Notifier<int> {
  @override
  int init() => 10;

  void increment() => state++;
}

class MyPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    int counterState = context.watch(counterProvider);
    return Scaffold(
      body: Center(
        child: Text('Counter state: $counterState'),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => context.notifier(counterProvider).increment(),
        child: const Icon(Icons.add),
      ),
    );
  }
}

Alternatives

Packages that do the same job and could replace refena.

  • riverpod

    If you prefer auto-dispose behavior and a larger ecosystem of official extensions.

  • bloc

    If you want a strictly event-driven state machine with a massive community and extensive tooling.

  • provider

    If you need a simpler, battle-tested InheritedWidget wrapper for dependency injection and state sharing.

Works with

Packages commonly used together with refena: ones it builds on, ones built on it, and its own family.