flame_bloc
1.12.24, released 4 months ago by flame-engine.org
Integration for the Bloc state management library to Flame games.
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.
91Compare - bonfire
Create RPG-style games and similar 2D games using Flame engine.
84Compare - flame_camera_tools
Tools for smooth following, camera shake, zooming, and rotating in Flame games.
72Compare - unity_kit
Embed Unity 3D in Flutter with a typed bridge and binary protocol.
72Compare
Works with
Packages commonly used together with flame_bloc: ones it builds on, ones built on it, and its own family.
- blocflame_bloc depends on itA Dart library for implementing the BLoC pattern with Cubits and Blocs.
- flutter_blocflame_bloc depends on itFlutter widgets to easily integrate blocs and cubits for state management.
- flameflame_bloc depends on itA minimalist Flutter game engine, provides a nice set of somewhat independent modules you can choose from.
- flame_audioSame familyAudio support wrapper for the Flame game engine
- flame_testSame familyClasses and helpers for testing applications built with the Flame Engine.
- flame_svgSame familyAdds SVG rendering support for the Flame game engine
- flame_lintSame familyA strict and satisfying lint package for Flame, Flutter, or Dart projects.
- flame_forge2dSame familyForge2D physics engine support and wrappers for the Flame game engine.