formatWith method

String? formatWith({
  1. String? zero,
  2. String? zeroReplace,
  3. String? one,
  4. String? oneReplace,
  5. String? many,
  6. String? manyReplace,
  7. String? other,
  8. String? otherReplace,
  9. String? all,
  10. String? allReplace,
})

Implementation

String? formatWith({
  String? zero,
  String? zeroReplace,
  String? one,
  String? oneReplace,
  String? many,
  String? manyReplace,
  String? other,
  String? otherReplace,
  String? all,
  String? allReplace,
}) =>
    toInt().mapTo(
      (int it) => it == 0
          ? allReplace ??
              zeroReplace ??
              (zero ?? other ?? all)?.pre(formatted, between: " ") ??
              otherReplace
          : it == 1
              ? allReplace ??
                  oneReplace ??
                  (one ?? other ?? all)?.pre(formatted, between: " ") ??
                  otherReplace
              : it > 1
                  ? allReplace ??
                      manyReplace ??
                      (many ?? other ?? all)?.pre(formatted, between: " ") ??
                      otherReplace
                  : allReplace ??
                      otherReplace ??
                      (other ?? all)?.pre(formatted, between: " "),
    );