AudioService class

Audio service for playing game sounds.

Each sound uses a dedicated AudioPlayer instance so sounds can overlap without the previous clip being cut off (e.g. rapid dice rolls).

Asset paths assume the following entries in pubspec.yaml:

flutter:
  assets:
    - assets/audio/dice_roll.mp3
    - assets/audio/piece_move.mp3
    - assets/audio/piece_capture.mp3
    - assets/audio/piece_home.mp3
    - assets/audio/player_win.mp3
    - assets/audio/game_over.mp3

Constructors

AudioService({bool enabled = true})

Properties

enabled bool
Whether sounds are currently played.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() Future<void>
Release all native resources. Call from LudoController.dispose.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
playCapture() Future<void>
Opponent piece sent back to home.
playDiceRoll() Future<void>
Dice-roll sound – called in LudoController.rollDice.
playGameOver() Future<void>
All players have finished — overall game over.
playPieceHome() Future<void>
Piece reaches its home stretch finish cell.
playPieceMove() Future<void>
Piece-move tick – call once per step in the step-by-step animation.
playWin() Future<void>
A player has placed all 4 pieces in the centre.
toString() String
A string representation of this object.
inherited

Operators

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