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
pauseEngineFn VoidCallback
read / write
resumeEngineFn VoidCallback
read / write
runOnCreation bool
Flag to tell the game loop if it should start running upon creation
read / write
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
onTimingsCallback(List<FrameTiming> timings) → void
Use for caluclating the FPS.
pauseEngine() → void
Pauses the engine game loop execution
recordDt(double dt) → void
Used for debugging
@Deprecated('Gets called for backward compatibility, will be removed in v1')
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. [...]
resumeEngine() → void
Resumes the engine game loop execution
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. [...]