quickAmounts function

List<int> quickAmounts(
  1. int dueCents
)

Schnellwahl für „Gegeben": passend, der nächste runde Euro, dann Scheine.

Implementation

List<int> quickAmounts(int dueCents) {
  const scheine = [500, 1000, 2000, 5000, 10000, 20000];
  final aus = <int>[dueCents];
  final rund = ((dueCents + 99) ~/ 100) * 100;
  if (rund > dueCents) aus.add(rund);
  for (final s in scheine) {
    if (aus.length >= 4) break;
    if (s > dueCents && !aus.contains(s)) aus.add(s);
  }
  return aus.take(4).toList();
}