Skip to content
Get started
Menu
Get started

Money and dates

Every amount in the kit is a Money: an integer number of minor units and a currency code. There is no floating point anywhere between your API and the screen, so 0.1 + 0.2 problems cannot reach a total.

Formatted rupiah amounts in caption, row, total, large and display roles.Formatted rupiah amounts in caption, row, total, large and display roles.
Amount roles from caption to display, followed by total, muted and struck amounts.
const price = Money.idr(100000); // Rp100.000 (IDR has no minor digits)
const fee = Money(250, 'USD'); // $2.50
final total = price + const Money.idr(2500);
  • Money(minorUnits, currency) takes minor units: cents for USD, whole rupiah for IDR. Money.idr is a shortcut, and Money.zero(currency) an empty amount.
  • +, -, unary - and the comparisons <, >, <=, >= work between amounts of one currency. Mixing currencies throws instead of producing a wrong number.
  • isZero and isNegative answer the two questions the kit asks most.

MoneyFormat formats and parses for one language. Only the separators differ: id groups with . and uses , for decimals, en does the opposite. Get the active one from PaymentLocalizations.of(context).moneyFormat.

final format = PaymentLocalizations.of(context).moneyFormat;
format.format(const Money.idr(102500)); // "Rp102.500" in id, "Rp102,500" in en
format.format(const Money(1999, 'USD'), withSymbol: false); // "19.99" in en
format.spoken(const Money.idr(102500)); // "102500 IDR", for screen readers

Negative amounts start with a minus sign (−), not a hyphen. In widgets, use AmountText, which formats, uses tabular figures, gives screen readers the spoken form and scales down instead of clipping a digit.

CurrencySpec holds a currency’s symbol and number of minor digits. The kit knows IDR (Rp, 0 digits), USD ($, 2) and SGD (S$, 2). Register others before you format them; an unknown code falls back to the code as its symbol and two minor digits.

CurrencySpec.register(
const CurrencySpec(code: 'MYR', symbol: 'RM', minorDigits: 2),
);

MoneyFormat.parse(text, currency) accepts a currency symbol or code, spaces and correctly placed group separators. Input that could be read two ways is rejected as AmountIssue.ambiguous instead of being guessed. For example, 100,000 for IDR under id is rejected: it could be one hundred thousand or one hundred with a decimal part.

final result = format.parse(input, 'IDR').withinLimits(
minimum: const Money.idr(10000),
maximum: const Money.idr(5000000),
);
if (result.isValid) {
submit(result.money!);
} else {
showError(result.issue!); // empty, invalidFormat, ambiguous, negative, zero, …
}

An AmountParseResult has exactly one of money or issue. PaymentCurrencyField does all of this for you and shows localized errors after the field loses focus or on submit.

  • Store and send minor units. Convert to Money once, where your API response is parsed.
  • Show the currency symbol on every amount a person compares or pays. Drop it only in a column where the heading already names the currency.
  • Never round a total for display. If a fee makes the number long, let AmountText scale it down.

Money

class Money · lib/src/foundation/money.dart

An amount of money as an integer number of minor units.

Arithmetic never uses floating point, and mixing currencies throws.

ParameterTypeDefaultDescription
minorUnitsrequiredpositionalint——
currencyrequiredpositionalString——

Money.idr(…) — Indonesian rupiah; IDR has no minor digits.

ParameterTypeDefaultDescription
rupiahrequiredpositionalint——

Money.zero(…)

ParameterTypeDefaultDescription
currencyrequiredpositionalString——

MoneyFormat

class MoneyFormat · lib/src/foundation/money.dart

Locale-aware formatting and strict parsing of Money.

Only the separators differ between supported locales: id groups with . and uses , for decimals, en does the opposite.

ParameterTypeDefaultDescription
languageCoderequiredpositionalString——

CurrencySpec

class CurrencySpec · lib/src/foundation/money.dart

Currency metadata used for formatting and parsing.

The package ships a small registry; hosts can register more with CurrencySpec.register before formatting amounts in that currency.

ParameterTypeDefaultDescription
code:requiredString——
symbol:requiredString——
minorDigits:requiredint—Number of decimal digits stored in minor units (IDR = 0, USD = 2).

AmountParseResult

class AmountParseResult · lib/src/foundation/money.dart

Outcome of parsing and validating an amount. Exactly one of money or issue is set.

AmountParseResult.value(…)

ParameterTypeDefaultDescription
moneyrequiredpositionalMoney?——

AmountParseResult.issue(…)

ParameterTypeDefaultDescription
issuerequiredpositionalAmountIssue?——

AmountIssue

enum AmountIssue · lib/src/foundation/money.dart

ValueDescription
empty—
invalidFormat—
ambiguous—
negative—
zero—
belowMinimum—
aboveMaximum—

Use MoneyFormat.compact for chart axes only, never an amount the customer pays or confirms. It rounds to at most three significant digits and promotes the suffix on carry. Indonesian uses rb, jt, M and T with a nonbreaking space; English uses K, M, B and T. Smaller amounts keep the regular currency format.

const format = MoneyFormat('id');
format.compact(const Money.idr(1250000000)); // Rp1,25 M

Use semantic number and date APIs only.

The value is… Use
An amount the customer pays or confirms format / AmountText
Read by a screen reader spoken
On a chart axis only compact
A calendar date formatDate
A timestamp formatDateTime
Function Output Use for Don’t
format(money, {withSymbol}) (:109) Rp102.500 / $1,025.00 Every displayed amount Format by hand
spoken(money) (:171) Words for screen readers AmountText semantics, chart summaries Show it
compact(money) (:133) 1,2 jt / 1.2M (NBSP) Chart axes only (decisions.md, charts) Totals, buttons, confirmations
AmountParseResult / AmountIssue (:263-276) Strict parse PaymentCurrencyField Accept floats

Use format.format or AmountText for checkout amounts. Reserve compact formatting for chart axes so confirmation totals keep every digit.

PaymentLocalizations.formatDate returns “30 Oct 2026” or “30 Okt 2026” without converting zones or using the time. Calendar dates belong to the host. formatDateTime converts an instant to device-local time and adds “14:05” or “14.05”. Never use it to re-zone a date of birth.

Day, month and year are joined by no-break spaces (U+00A0), so a date never wraps as “1 Oct / 2026” at large text. formatDateRange glues the dash of a same-month range (“1–31 Oct 2026”) with U+2060 and lets a longer range wrap only after “– “. Compare formatted dates with \u00A0, not a plain space.

dateInputPattern is DD/MM/YYYY for both locales (Q12). A language change must not change the order in which an Indonesian user types their birth date. Grammar: DD, MM, YYYY exactly once, separated by the same /, . or - character. The pattern must stay visible as the hint; it does not replace a field label. The host supplies a delegate returning:

PaymentLocalizations(code, dateInputPattern: 'MM/DD/YYYY');

Use Date field for typed dates and Date range picker for ranges. The kit handles formatting and form validation; the host supplies valid ranges, business-day rules and time-zone policy.

PaymentLocalizations

class PaymentLocalizations · lib/src/foundation/payment_localizations.dart

Overridable strings and formatters for every kit component.

Defaults support English (en) and Indonesian (id); other languages use English. To add a language, subclass this class and register a host LocalizationsDelegate<PaymentLocalizations> that returns the subclass. Override any string getter or method; unmodified members keep their defaults.

Add PaymentLocalizations.delegate to localizationsDelegates. Without it, widgets still pick a language from the ambient locale.

MemberType / valueDescription
dateInputPatternStringTyped date hint, DD/MM/YYYY in both locales (Q12). DD, MM and YYYY each occur once with one repeated /, . or - separator. Override app-wide with a host LocalizationsDelegate<PaymentLocalizations> returning PaymentLocalizations(code, dateInputPattern: 'MM/DD/YYYY'). Applies app-wide; there is no per-field override.
dateInputHintStringPersistent localized pattern; parsing uses dateInputPattern.
formatDateRangeStringCompact calendar range using the same localized month names as formatDate.

Each date keeps its no-break spaces. The short same-month form ("1–31 Oct 2026") never breaks at its dash (U+2060 joins it); the spaced form keeps one break after "– " so a long range can wrap at large text without splitting a date (#65).

formatDateStringCalendar date in the host zone; unlike formatDateTime, no conversion to the device zone occurs and the time is ignored. Day, month and year are joined by no-break spaces (U+00A0), so "1 Oct 2026" never wraps inside the date.
languageCodeString
moneyFormatMoneyFormat
formatNumberStringChart number with at most one decimal digit, omitting a trailing zero.

Uses English separators by default and Indonesian separators for id. Override for additional languages. Charts use this for visible and spoken numbers; percentages pass grouping as false and add their own unit label. Money continues to use moneyFormat.

supportedLanguages['en', 'id']
delegate_PaymentLocalizationsDelegate()
ofPaymentLocalizations
formatDateTimeString"30 Oct 2026, 14:05" / "30 Okt 2026, 14.05" in the device time zone. The date part uses formatDate's no-break spaces.
formatBytesString
workingString
contentHiddenString
timeRemainingString
continueLabelString
tryAgainString
editString
copyString
copiedString
copyFailedString
unavailableString
detailsTitleString
lastUpdatedString
updatedAtString
checkingStatusString
submittingString
amountLabelString
minimumAmountString
maximumAmountString
amountIssueString
summaryTitleString
totalLabelString
totalChangedTitleString
totalChangedMessageString
acceptNewTotalString
methodTitleString
paymentMethodString
payWithTitleString
noMethodsTitleString
noMethodsMessageString
payAmountString
sendingPaymentString
authReadyTitleString
authReadyMessageString
authInProgressTitleString
authInProgressMessageString
authApprovedTitleString
authApprovedMessageString
authCanceledTitleString
authCanceledMessageString
authFailedTitleString
authFailedMessageString
authExpiredTitleString
authExpiredMessageString
authorizeString
authorizeAgainString
backToReviewString
instructionsTitleString
accountNumberString
amountToPayString
payBeforeString
howToPayString
instructionsElapsedTitleString
instructionsElapsedMessageString
statusSendingTitleString
statusSendingMessageString
statusUnknownTitleString
statusUnknownMessageString
statusUnknownLeadStringFirst line of the unknown-outcome screen, set on its own so the one instruction that prevents a double charge is read first.
statusUnknownDetailString
statusRequiresActionTitleString
statusRequiresActionMessageString
statusProcessingTitleString
statusProcessingMessageString
statusPendingTitleString
statusPendingMessageString
statusSucceededTitleString
statusSucceededMessageString
statusFailedTitleString
statusFailedMessageString
statusCanceledTitleString
statusCanceledMessageString
statusExpiredTitleString
statusExpiredMessageString
statusUnavailableTitleString
statusUnavailableMessageString
statusLastKnownString
attemptReferenceString
transactionReferenceString
notYetConfirmedString
paymentActionLabelString
refundTitleString
refundStatusLabelString
refundAmountString
refundAmountUnavailableString
refundSeparateNoteString
merchantString
paidAtString
receiptShareTitleString
shareReceiptString
shareDoneString
shareDismissedString
shareFailedString
copyFailedReceiptString
shareAllowlistNoteString
kycIntroTitleString
kycIntroMessageString
readPrivacyPolicyString
consentLabelString
consentRequiredHintString
fieldNeedsUpdateString
documentLimitsString
documentEmptyString
documentUploadingString
documentUploadedString
documentFailedString
documentMissingString
chooseDocumentString
replaceDocumentString
openSettingsString
documentIssueTitleString
documentIssueMessageString
reviewDetailsTitleString
reviewDocumentsTitleString
documentsIncompleteString
submitVerificationString
kycUnknownTitleString
kycUnknownMessageString
kycStatusTitleString
kycStatusMessageString
verificationActionLabelString
monthNameStringFull month name for month 1–12: "October" / "Oktober".
formatMonthYearStringCalendar month heading: "October 2026" / "Oktober 2026".
formatDateLongStringSpoken calendar day: "Tuesday, 14 October 2026" / "Selasa, 14 Oktober 2026".
weekdayShortStringWeekday column heading for weekday as in DateTime.weekday (1 = Monday … 7 = Sunday): "Mon" / "Sen".
firstDayOfWeekintFirst column of the calendar, as a DateTime.weekday value: Monday in Indonesian, Sunday in English.
chartPercentStringSpoken percentage.
sortByStringCurrent local sort summary.
sortDefaultString
sortDirectionStringDirection words matching the column's value kind.
chartLineString
chartBarString
chartMeterString
chartSparklineString
chartNoDataString
chartPendingKeyString
chartUnknownKeyString
chartLoadFailedString
chartEmptyTitleString
chartRangeString
chartLowestString
chartHighestString
chartLatestString
chartPendingCountString
chartUnknownCountString
chartMissingCountString
meterItemString
captureSourceTitleString
captureSourceCameraString
captureSourceGalleryString
captureSourceFileString
captureTipLightString
captureTipGlareString
captureTipCornersString
captureTipFaceAndCardString
captureTipNoCoverString
captureTakeString
captureRetakeString
captureUseString
captureTitleString
captureFramingHintString
capturePhotoLabelString
captureFrameLabelString
opensExternallyStringHint for external destinations.
hideBannerStringBanner dismiss action.
enterValidDateStringInvalid calendar date.
chooseDateStringCalendar action.
optionalStringOptional field marker.
charactersLeftStringRemaining character count.
currencyLabelStringCurrency switch label.
chooseDatesStringCalendar range action.
customRangeStringCustom range action.
clearDatesStringClear range action.
typeDatesStringSwitches the range sheet to typed entry.
useCalendarStringSwitches the range sheet back to the calendar.
startDateStringFirst typed date of a range.
endDateStringLast typed date of a range.
chooseEndDateStringRange summary while only the start is chosen.
applyDatesStringApplies the chosen range.
clearStringClears the chosen dates.
dayStringWheel column names.
monthString
yearString
todayStringSpoken marker on today's date.
rangeStartStringSpoken markers on the ends of a range.
rangeEndString
startAfterEndStringTyped range whose start is after its end.
dateOutOfRangeStringTyped date outside the allowed range.
removeItemStringChip remove action.
doneStringFinishes a multiple-choice search sheet.
resultsCountStringSearch result count.
dateGranularityStringCalendar grouping label.
closeString
cancelString
confirmString
moreActionsString
loadingString
retryString
expandString
collapseString
dismissString
openNavigationString
navigationString
selectedString
closeSheetString
imageUnavailableStringImage decode failure.
playString
pauseString
replayString
muteString
unmuteString
seekString
videoLoadingString
videoBufferingString
videoEndedString
videoErrorTitleString
videoErrorMessageString
videoUnsupportedString
videoPositionString
sponsoredString
promotionString
whyThisAdString
promoUnavailableString
promoLoadFailedString
updatingTotalString
stepOfString
completedStepString
balanceTitleString
balanceUnavailableString
balanceInsufficientString
balanceShortfallString
limitUsedString
promoCodeLabelString
applyString
removeString
checkingCodeString
promoCodeEmptyString
promoAppliedString
merchantVerifiedString
orderRefString
searchStringDefault search field label.
transactionsTitleString
searchTransactionsString
clearSearchString
noTransactionsTitleString
noTransactionsMessageString
noMatchesTitleString
noMatchesMessageString
transactionsFailedTitleString
resetFiltersString
filterByStatusStringSpoken name of the status filter button that replaces the filter tabs on phones at large text (D91).
transactionFilterLabelString
paymentLabelString
dateLabelString
methodLabelString
merchantLabelString
taskStatusStringSpoken task status.
subTasksCompleteStringSpoken child task completion count.
selectAllOnPageStringSelect all on this page.
previousPageStringPrevious page.
nextPageStringNext page.
emptyTitleStringNothing here yet.
sortStringSort.
moveLeftStringMove left.
moveRightStringMove right.
widerStringWider.
narrowerStringNarrower.
selectRowStringLocalized selectRow label.
rowsSelectedStringLocalized rowsSelected label.
pageRangeStringLocalized pageRange label.
pageNumberStringLocalized pageNumber label.
rowActionsStringLocalized rowActions label.
sortedAscendingStringLocalized sortedAscending label.
sortedDescendingStringLocalized sortedDescending label.
columnOptionsStringLocalized columnOptions label.
saveStringSave.
signInTitleStringSign in to continue.
allStepsStringAll steps.
onboardingDoneStringAll steps complete.
backToStringAncestor navigation label.
createStringCreate an item.
signInCanStringSign-in heading over what the connecting app can do (D61).
signInCannotStringSign-in heading over what the connecting app can never do (D61).
paymentStatusShortStringShort status label shared by transaction rows and details.
ParameterTypeDefaultDescription
languageCoderequiredpositionalString——
dateInputPattern:String'DD/MM/YYYY'Typed date hint, DD/MM/YYYY in both locales (Q12). DD, MM and YYYY each occur once with one repeated /, . or - separator. Override app-wide with a host LocalizationsDelegate<PaymentLocalizations> returning PaymentLocalizations(code, dateInputPattern: 'MM/DD/YYYY'). Applies app-wide; there is no per-field override.

PaymentLocalizations.dateInputHint localizes pattern letters; dateInputPattern controls parsing app-wide. Identity date values use ISO calendar dates.