Fixes emitting new state on closed AssetsManager

pull/505/head
Alvaro Almeida Freire Stivi 1 year ago
parent 5da301723c
commit 5e64ec7655
No known key found for this signature in database

@ -19,6 +19,7 @@ class AssetsManagerCubit extends Cubit<AssetsManagerState> {
/// do its job without adding too much delay for the user, we are letting /// do its job without adding too much delay for the user, we are letting
/// the UI paint first, and then we start loading the assets. /// the UI paint first, and then we start loading the assets.
await Future<void>.delayed(const Duration(seconds: 1)); await Future<void>.delayed(const Duration(seconds: 1));
if (isClosed) return;
final loadables = <Future<void> Function()>[ final loadables = <Future<void> Function()>[
_game.preFetchLeaderboard, _game.preFetchLeaderboard,
..._game.preLoadAssets(), ..._game.preLoadAssets(),

@ -131,6 +131,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'onNewState adds a ball', 'onNewState adds a ball',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final behavior = BallSpawningBehavior(); final behavior = BallSpawningBehavior();
await game.pump([ await game.pump([
behavior, behavior,

Loading…
Cancel
Save