SeatController class

A controller that manages selection state and pricing for a typed seat grid.

Accepts either:

Inheritance

Constructors

SeatController({required TypedSeatGrid seatGrid, int maxSelection = 5, Map<SeatType, double> prices = const {}, List<SeatPoint> initialSelection = const []})
Creates a controller from a TypedSeatGrid.
SeatController.fromInts({required List<List<int>> seatGrid, int maxSelection = 5, Map<SeatType, double> prices = const {}, List<SeatPoint> initialSelection = const []})
Convenience factory that wraps a legacy integer grid.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isMaxReached → bool
Whether the selection limit has been reached.
no setter
maxSelection → int
Maximum number of seats the user can select simultaneously.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
seatGrid → TypedSeatGrid
Read-only typed grid.
no setter
selectedCount → int
Number of currently selected seats.
no setter
selectedSeats → Set<SeatPoint>
Selected seats (unmodifiable).
no setter
totalPrice → double
Sum of prices for all selected seats.
no setter
totalPriceFormatted → String
Formatted total price string, e.g. "42.00".
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
clearSelection() → void
Clears all selected seats.
dispose() → void
Discards any resources used by the object.
override
getSeatMeta(int row, int col) → SeatMeta
Returns the full SeatMeta for a cell.
getState(int row, int col) → SeatState
Returns the SeatState for a cell — selection overrides the stored state.
getType(int row, int col) → SeatType
Returns the SeatType for a cell.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
selectAll() → void
Selects all available seats up to maxSelection.
selectByType(SeatType type) → void
Selects all available seats of a given type, up to maxSelection.
selectRow(int row) → void
Selects all available seats in row, up to maxSelection.
selectSeats(List<SeatPoint> seats) → void
Selects a list of seats by coordinate, skipping non-available ones.
toggleSeat(int row, int col) → void
Toggles selection for the seat at row / col. Silently ignores gaps, booked, and disabled seats.
toString() → String
A string representation of this object.
inherited

Operators

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