Skip to content
pubscout

flame_riverpod

5.5.5, released 4 months ago by flame-engine.org

Helpers for using Riverpod state management within Flame game engines.

$ flutter pub add flame_riverpod
Source repository

What it does

Bridges Riverpod state management with Flame game components. It provides specialized mixins and widgets like RiverpodAwareGameWidget, RiverpodGameMixin, and RiverpodComponentMixin to manage provider subscriptions based on component lifecycles.

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

Use it when

  • You are building a game using Flame and want to use Riverpod for state management
  • You need Flame components to react to provider changes and manage subscriptions automatically

Skip it when

  • You are not using the Flame game engine
  • You prefer a state management solution other than Riverpod

Strengths

  • Integrates Riverpod naturally with Flame component lifecycles
  • Automatically handles subscription initialization and cleanup
  • Provides access to WidgetRef operations within components

Weaknesses

  • Tied strictly to Flame and Riverpod ecosystems
  • Requires specific mixins and game widget replacements

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
3

Use RiverpodAwareGameWidget, add RiverpodGameMixin to your game, and RiverpodComponentMixin to interacting components.

class RefExampleGame extends FlameGame with RiverpodGameMixin {
  @override
  Future<void> onLoad() async {
    await super.onLoad();
    add(RiverpodAwareTextComponent());
  }
}

Alternatives

Packages that do the same job and could replace flame_riverpod.

  • forge2d

    A 2D physics engine for Dart, binding to the native Box2D v3 library.

Works with

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