flame icon indicating copy to clipboard operation
flame copied to clipboard

feat: Adding ComponentNotifier API

Open erickzanardo opened this issue 3 years ago • 0 comments

Description

This adds a proposal for a new API for flame, the ComponentNotifier.

This API offers the user change notifiers classes that are tied to FlameGame and its components so the user can be notified when a component is added, removed or updated.

This will enable users to:

  • Take the benefit of reactive programming inside the game
  • Have a simple way of watching certain states from the game, on Flutter Widgets

One important note here is that this proposal does not mean to replace integrations like flame_bloc, but rather provider an simple and out of the box solution, without any need of additional packages, since change notifiers are provided by flutter itself.

Opening this as draft for now to get feedback on the implementation, will write tests and docs once we have the final implementation.

Demo of the example:

https://user-images.githubusercontent.com/835641/188513760-e9f87e43-55e5-495e-8109-c16f07180a02.mov

Checklist

  • [ ] The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • [ ] I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • [ ] I have updated/added tests for ALL new/updated/fixed functionality.
  • [ ] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • [ ] I have updated/added relevant examples in examples.

Breaking Change

  • [ ] Yes, this is a breaking change.
  • [x] No, this is not a breaking change.

Related Issues

erickzanardo avatar Sep 05 '22 21:09 erickzanardo