Skip to content
pubscout

flame_bloc

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

Integration for the Bloc state management library to Flame games.

WASM-readyRock solid
$ flutter pub add flame_bloc
Source repository

What it does

Integration for the Bloc state management library to Flame games. It provides components and mixins like FlameBlocProvider, FlameBlocListener, and FlameBlocReader to bridge blocs and cubits with Flame game components.

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

Use it when

  • You are building a game using Flame and want to manage state using the Bloc library.
  • Your Flame components need to access, read, or listen to bloc and cubit states.

Skip it when

  • You are not using the Flame game engine.
  • You prefer an entirely different state management approach inside your game.

Strengths

  • Natural integration mirroring flutter_bloc patterns inside Flame.
  • Provides providers, multi-providers, listeners, and readers for flexible component architecture.

Weaknesses

  • Mixins like FlameBlocReader are limited to accessing only a single bloc.
  • Tied strictly to the Flame game engine and Bloc library.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
4

not documented

class MyGame extends FlameGame {
  @override
  Future<void> onLoad() async {
    await add(
      FlameBlocProvider<PlayerInventoryBloc, PlayerInventoryState>(
        create: () => PlayerInventoryBloc(),
        children: [
          Player(),
        ],
      ),
    );
  }
}

Alternatives

Packages that do the same job and could replace flame_bloc.

  • forge2d

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

  • bonfire

    Create RPG-style games and similar 2D games using Flame engine.

  • flame_camera_tools

    Tools for smooth following, camera shake, zooming, and rotating in Flame games.

  • unity_kit

    Embed Unity 3D in Flutter with a typed bridge and binary protocol.

Works with

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