TetrisEvent class

Something that happened in a game, delivered on TetrisGame.events.

Use it to drive sound effects, haptics, animations or analytics:

game.events.listen((e) {
  if (e.type == TetrisEventType.linesCleared && e.lines == 4) {
    playSound('tetris.wav');
  }
});

Constructors

TetrisEvent(TetrisEventType type, {TetrominoType? piece, int lines = 0, int cells = 0, int level = 0, TSpinType tSpin = TSpinType.none, bool perfectClear = false, bool backToBack = false, int combo = 0})
const

Properties

backToBack → bool
Whether this clear continued a back-to-back chain.
final
cells → int
Cells travelled, for TetrisEventType.softDropped and TetrisEventType.hardDropped.
final
combo → int
Current combo count after this event.
final
hashCode → int
The hash code for this object.
no setterinherited
level → int
The new level, for TetrisEventType.levelUp.
final
lines → int
Number of lines cleared, for TetrisEventType.linesCleared.
final
perfectClear → bool
final
piece → TetrominoType?
The piece involved (moved, rotated, dropped, held or locked), if any.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tSpin → TSpinType
final
type → TetrisEventType
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited