SeatLayout class

The top-level specification of a bus seat layout. Can represent single-deck or multi-deck (e.g., sleeper/double decker) buses.

Available extensions
Annotations

Constructors

SeatLayout({required List<DeckLayout> decks})
Creates a SeatLayout with explicit decks.
const
SeatLayout.doubleDeck({required DeckLayout lowerDeck, required DeckLayout upperDeck})
Convenience constructor for a double-deck bus.
factory
SeatLayout.fromSeats({required List<Seat> seats, int rows = 0, int columns = 0, String deckName = 'Main Deck', DriverPosition driverPosition = DriverPosition.left, int? doorRowIndex})
Creates a layout directly from an arbitrary list of Seat instances.
factory
SeatLayout.fromStrings(List<String> stringMap, {String deckName = 'Main Deck', DriverPosition driverPosition = DriverPosition.left, String seatNoBuilder(int row, int col, int deck)?, int? doorRowIndex})
High-level factory to parse a standard ASCII string pattern into a SeatLayout.
factory
SeatLayout.multiDeckFromStrings({required List<String> lowerDeckMap, required List<String> upperDeckMap, String lowerDeckName = 'Lower Deck', String upperDeckName = 'Upper Deck', DriverPosition driverPosition = DriverPosition.left, String seatNoBuilder(int row, int col, int deck)?, int? doorRowIndex})
High-level factory for multi-deck buses using ASCII string patterns.
factory
SeatLayout.singleDeck({String name = 'Main Deck', required List<List<Seat?>> matrix, DriverPosition driverPosition = DriverPosition.left, int? doorRowIndex})
Convenience constructor for a single-deck bus.
factory

Properties

allSeats List<Seat>
Flattened list of all seats across all decks.
no setter
availableSeats List<Seat>

Available on SeatLayout, provided by the SeatLayoutX extension

All available seats across all decks.
no setter
bookedSeats List<Seat>

Available on SeatLayout, provided by the SeatLayoutX extension

All booked/sold seats across all decks.
no setter
decks List<DeckLayout>
List of decks in this layout.
final
disabledSeats List<Seat>

Available on SeatLayout, provided by the SeatLayoutX extension

All disabled seats across all decks.
no setter
femaleOnlySeats List<Seat>

Available on SeatLayout, provided by the SeatLayoutX extension

All female-only seats across all decks.
no setter
hashCode int
The hash code for this object.
no setterinherited
isMultiDeck bool
Whether this layout contains more than one deck.
no setter
primaryDeck DeckLayout
Returns the primary/first deck.
no setter
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
reservedSeats List<Seat>

Available on SeatLayout, provided by the SeatLayoutX extension

All reserved seats across all decks.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sleeperSeats List<Seat>

Available on SeatLayout, provided by the SeatLayoutX extension

All sleeper classification berths across all decks.
no setter
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
totalSeatCount int
Total count of all valid seats across all decks.
no setter
vipSeats List<Seat>

Available on SeatLayout, provided by the SeatLayoutX extension

All VIP classification seats across all decks.
no setter

Methods

findSeatById(String id) Seat?
Finds a seat by its id across all decks, or null if not found.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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