onRemove method
Called when the game is about to be removed from the Flutter widget tree, but before it is actually removed. See the docs for an example on how to do cleanups to avoid memory leaks.
Implementation
@override
void onRemove() {
super.onRemove();
Component.staticGameInstance = null;
}