FlutterArbiter class

Inheritance

Constructors

FlutterArbiter({void onGameOver(GameOverBy)?, Future<bool> onReachingPromotionRank(Position position)?, bool showDialogs = true, BuildContext? context, dynamic onPromoted(Position position, ChessPiece? promotedTo)?})

Properties

context BuildContext?
Required context to show dialogs, if showDialogs is true
final
hashCode int
The hash code for this object.
no setterinherited
onGameOver ↔ void Function(GameOverBy)?
Callback is made when checkForGameEnd satisfy a condition
getter/setter pairinherited
onPromoted → dynamic Function(Position position, ChessPiece? promotedTo)?
Callback when pawn is promoted either by user or the default one PieceType.queen when user fails to select a piece. This callback is made when either onReachingPromotionRank or the _defaultPromotionDialog returns a value (true or false).
final
onReachingPromotionRank Future<bool> Function(Position position)?
Callback when game is over. If null and showDialogs is true and context is provided, _defaultGameOverDialog is shown. _defaultPromotionDialog is shown if this field is null and showDialogs is true. Callback is made when a pawn reaches the promotion rank. Use ChessBoardInterface.promotePawn(Position, PieceType) to promote the pawn and must return the promotion status either true or false.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showDialogs bool
true by default, show dialogs when arbiter detects a state
final

Methods

checkForGameEnd(ChessBoardInterface game) GameOverBy?
one time spectation
inherited
countdownSpectator(ChessBoardInterface game) → void
countdown for player time, if game has timeLimit is being used in ChessBoardWidget to start countdownSpectator when widget is created
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
promotionCheck(ChessBoardInterface game, Position position) Future<bool>
Returns true if player chose a piece (isPromoted)
showDialogOnGameOver(ChessBoardInterface game) Future<bool>
returns if game is over (isReset)
toString() String
A string representation of this object.
inherited

Operators

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