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 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
-
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
-
Share in cents for the last customer (absorbs remainder).
final
-
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, thetoStringmethod will be overridden to output this instance'sprops.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
customersServedincremented by 1.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited