SeatPlanController class
A reactive controller that manages seat selection, max selection limits, dynamic seat status overrides, and real-time event notifications.
- Inheritance
-
- Object
- ChangeNotifier
- SeatPlanController
Constructors
-
SeatPlanController({List<
Seat> initialSelectedSeats = const [], int? maxSelectedSeats, VoidCallback? onMaxSeatsReached, ValueChanged<List< ? onSelectionChanged})Seat> > - Creates a SeatPlanController.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- maxSelectedSeats → int?
-
Maximum number of seats a user can select at one time.
If
null, there is no selection limit.final - onMaxSeatsReached → VoidCallback?
-
Callback triggered when the user attempts to exceed maxSelectedSeats.
final
-
onSelectionChanged
→ ValueChanged<
List< ?Seat> > -
Callback triggered whenever the selection changes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedCount → int
-
Total count of currently selected seats.
no setter
-
selectedSeatIds
→ Set<
String> -
Set of currently selected seat IDs.
no setter
-
selectedSeats
→ List<
Seat> -
List of currently selected Seat items.
no setter
- totalPrice → double
-
Total price calculated from all selected seats that have a price specified.
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clearSelection(
) → void - Clears all currently selected seats.
-
clearStatusOverrides(
) → void - Clears all dynamic seat status overrides.
-
deselect(
Seat seat) → bool -
Deselects the given
seat. -
dispose(
) → void -
Discards any resources used by the object.
inherited
-
getEffectiveStatus(
Seat seat) → SeatStatus - Retrieves the effective status of a seat, taking into account current selection and any runtime overrides.
-
isSelected(
Seat seat) → bool -
Checks whether the seat with
seatIdorseatis currently selected. -
isSelectedId(
String seatId) → bool - Checks whether a seat ID is currently selected.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
overrideSeatStatus(
String seatId, SeatStatus newStatus) → void - Dynamically updates the runtime status of a specific seat (e.g., from a WebSocket event).
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
select(
Seat seat) → bool -
Selects the given
seat. -
setSelection(
List< Seat> newSelection) → void -
Replaces the entire selection with
newSelection. -
toggle(
Seat seat) → bool -
Toggles the selection state of a given
seat. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited