Skip to content
pubscout

yx_state

1.0.2, released 6 weeks ago by dev.go.yandex

A state management library for Dart and Flutter applications.

WASM-ready
$ flutter pub add yx_state
Source repository

What it does

Provides a StateManager class to handle application state transitions, handle asynchronous operations with automatic error reporting, and monitor changes using state observers and global overrides.

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

Use it when

  • You need a structured state management solution for Dart or Flutter.
  • You want built-in support for error handling and global state change observation.
  • You want a lightweight state manager without code generation requirements.

Skip it when

  • You prefer compile-time safe immutable models generated via build_runner.
  • You are already deeply invested in an alternative state management library like Bloc or Riverpod.

Strengths

  • Built-in error handling and error reporting mechanisms.
  • State observers allow easy monitoring for debugging and analytics.
  • Global overrides for customizing state emission behavior.

Weaknesses

  • Limited community and ecosystem compared to older, dominant alternatives like Bloc or Riverpod.
  • Relies on manual state class definitions and equality overrides.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
import 'package:yx_state/yx_state.dart';

class CounterState {
    final int count;
    const CounterState(this.count);
}

class CounterManager extends StateManager<CounterState> {
    CounterManager() : super(const CounterState(0));

    void increment() => handle((emit) async {
        emit(CounterState(state.count + 1));
      });
}

Alternatives

Packages that do the same job and could replace yx_state.

  • bloc

    If you want a heavily battle-tested, event-driven state management library with extensive tooling and community support.

  • riverpod

    If you want compile-time safe, provider-based state management that prevents scoping bugs.

  • provider

    If you prefer a lightweight, inherited-widget-based dependency injection and state management approach.

Works with

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