Skip to content

Commit

Permalink
refactor: Remove unused event "ScoreEventCleared" from flame_block ex…
Browse files Browse the repository at this point in the history
…ample (#2380)

# Description

This is a cleanup identified on this issue:
#2308
Using an amazing unused-code tooling
Now, since Flame is a public API, unused code might not be trivial - it
might just mean untested code.

Since this an example package, it definitely should never have unused
code.
In this case, the constructor wasn't being used, but upon deeper
investigation, that was because this particular event wasn't ever fired
at all.
So I removed it entirely. If this was supposed to be fired somewhere by
the example, please lmk and I can add the missing firing.
But as far as I can see, the event serves no purpose in this example.

## Checklist

- [x] I have followed the [Contributor Guide] when preparing my PR.
- [x] I have updated/added tests for ALL new/updated/fixed
functionality.
- [x] I have updated/added relevant documentation in `docs` and added
dartdoc comments with `///`.
- [x] I have updated/added relevant examples in `examples` or `docs`.

## Breaking Change?

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flame-engine/flame/blob/main/CONTRIBUTING.md
[Conventional Commit]: https://conventionalcommits.org/
[CHANGELOG]:
https://github.com/flame-engine/flame/blob/main/CHANGELOG.md

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
  • Loading branch information
luanpotter and spydon committed Mar 1, 2023
1 parent f5c0e5e commit a9db3f4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
Expand Up @@ -12,12 +12,6 @@ class GameStatsBloc extends Bloc<GameStatsEvent, GameStatsState> {
),
);

on<ScoreEventCleared>(
(event, emit) => emit(
state.copyWith(score: 0),
),
);

on<PlayerRespawned>(
(event, emit) => emit(
state.copyWith(status: GameStatus.respawned),
Expand Down
Expand Up @@ -13,13 +13,6 @@ class ScoreEventAdded extends GameStatsEvent {
List<Object?> get props => [score];
}

class ScoreEventCleared extends GameStatsEvent {
const ScoreEventCleared();

@override
List<Object?> get props => [];
}

class PlayerDied extends GameStatsEvent {
const PlayerDied();

Expand Down

0 comments on commit a9db3f4

Please sign in to comment.