Search code examples
flutterdartflame

Flutter and Flame, how to keep FlameGame widget alive?


Working on a game project where: I have a BottomNavigationBar navigating betwen my custom Widgets where one of them is a FlameGame. I don't want to unload and reload the widgets when player navigates as it will be frequent and expensive.

I have followed this and now my custom Widgets are being preserved, except for the FlameGame.

Tried adding AutomaticKeepAliveClientMixin. Wanted me to implement 12 overrides... Any suggestions?


Solution

  • Wrapped my GameWidget in another custom widget of mine that implements the KeepAlive mixin.

    It works now.