-
-
Notifications
You must be signed in to change notification settings - Fork 895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Remove Loadable, optional onLoads #1333
Conversation
We could remove the breaking change by having an empty |
Yeah, makes sense, let's do that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! Don't remember why I created that mixin from the beginning, but this is clearly nicer.
Co-authored-by: Erick <erickzanardoo@gmail.com>
Description
Game
no longer depends onLoadable
, that is, when creating a newGame
subclass you only need to sayclass MyGame with Game
instead ofclass MyGame with Loadable, Game
. This is done by moving the 2 lines of code that are insideLoadable
into theGame
class. The benefit here is that it simplifies the usage of theGame
class.Component
no longer depends onLoadable
. This brings in several advantages:Component
is the most "base" class in the Flame engine. Having it being derived from some other helper class is not ideal.onLoad
method is now defined within theComponent
class, alongside all other lifecycle methods, which makes it easier to document.onLoadCache
variable is removed -- the fact that the component is loaded only once is guarded by theisLoaded
flag, so carrying around thatFuture
was unnecessary and was only increasing the size of theComponent
object.Loadable
mixin is now empty and declaredDeprecated
, to be removed in 1.2.0. Anyone who uses a customGame
class viawith Loadable, Game
can simply removeLoadable
from the declaration.The default
onLoad
methods are no longer declared as@mustCallSuper
, since they have no functionality. This simplifies user code: there is no longer need to sayawait super.onLoad()
at the start of youronLoad()
implementation. A derived class can always re-add this annotation if it overridesonLoad
and if it intends to be derived further.Checklist
fix:
,feat:
,docs:
etc).docs
and added dartdoc comments with///
.examples
.Breaking Change