SplitEquallyState class

Immutable state for the "Split Equally" feature.

Calculated once when the cashier activates split-equally on the ReconciliationScreen. Shares are fixed — they do NOT recalculate after each payment (tips / overpayments by earlier customers do not affect subsequent amounts).

Rounding: integer-cent arithmetic. baseShareCents = totalCents ~/ numberOfCustomers lastShareCents = baseShareCents + remainder The last customer absorbs any remainder so the sum is always exact.

Constructors

SplitEquallyState({required int numberOfCustomers, required int totalCents, required int baseShareCents, required int lastShareCents, required int customersServed})
const
SplitEquallyState.calculate({required Decimal outstandingAmount, required int numberOfCustomers})
Creates a new SplitEquallyState from the outstanding amount and desired number of customers.
factory

Properties

baseShareCents int
Per-customer share in cents for customers 1..(N-1).
final
customersServed int
How many customers have been served so far.
final
hashCode int
The hash code for this object.
no setterinherited
isComplete bool
Whether all N customers have been served.
no setter
lastShareCents int
Share in cents for the last customer (absorbs remainder).
final
nextShareAmount → Decimal
The share amount (as Decimal) for the next customer to be served.
no setter
numberOfCustomers int
Number of customers to split among (>= 2).
final
progressText String
Progress text for the chip display (e.g. "1 of 3 paid").
no setter
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
totalCents int
Total amount in cents (integer).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
withCustomerServed() SplitEquallyState
Returns a new state with customersServed incremented by 1.

Operators

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