Game class

Represents a generic game.

Subclass this to implement the update and render methods. Flame will deal with calling these methods properly when the game's widget is rendered.





builder WidgetBuilder
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
widget Widget
Returns the game widget. Put this in your structure to start rendering and updating the game. You can add it directly to the runApp method or inside your widget structure (if you use vanilla screens and widgets).


backgroundColor() Color
Returns the game background color. By default it will return a black color. It cannot be changed at runtime, because the game widget does not get rebuild when this value changes.
lifecycleStateChange(AppLifecycleState state) → void
This is the lifecycle state change hook; every time the game is resumed, paused or suspended, this is called. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
onAttach() → void
onDetach() → void
render(Canvas canvas) → void
Implement this method to render the current game state in the canvas.
resize(Size size) → void
This is the resize hook; every time the game widget is resized, this hook is called. [...]
toString() String
A string representation of this object. [...]
update(double t) → void
Implement this method to update the game state, given that a time t has passed. [...]


operator ==(Object other) bool
The equality operator. [...]