nextShareAmount property

Decimal get nextShareAmount

The share amount (as Decimal) for the next customer to be served.

Returns the last-customer share when customersServed == numberOfCustomers - 1, otherwise returns the base share. Returns Decimal.zero when complete.

Implementation

Decimal get nextShareAmount {
  if (isComplete) return Decimal.zero;
  final cents =
      (customersServed == numberOfCustomers - 1) ? lastShareCents : baseShareCents;
  return (Decimal.fromInt(cents) / Decimal.fromInt(100))
      .toDecimal(scaleOnInfinitePrecision: 2);
}