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.


const price = Money.idr(100000); // Rp100.000 (IDR has no minor digits)const fee = Money(250, 'USD'); // $2.50final total = price + const Money.idr(2500);Money(minorUnits, currency)takes minor units: cents for USD, whole rupiah for IDR.Money.idris a shortcut, andMoney.zero(currency)an empty amount.+,-, unary-and the comparisons<,>,<=,>=work between amounts of one currency. Mixing currencies throws instead of producing a wrong number.isZeroandisNegativeanswer the two questions the kit asks most.
Formatting
Section titled “Formatting”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 enformat.format(const Money(1999, 'USD'), withSymbol: false); // "19.99" in enformat.spoken(const Money.idr(102500)); // "102500 IDR", for screen readersNegative 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.
Currencies
Section titled “Currencies”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),);Strict parsing
Section titled “Strict parsing”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.
Content guidelines
Section titled “Content guidelines”- Store and send minor units. Convert to
Moneyonce, 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
AmountTextscale 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
minorUnitsrequiredpositional | int | — | — |
currencyrequiredpositional | String | — | — |
Money.idr(…) — Indonesian rupiah; IDR has no minor digits.
| Parameter | Type | Default | Description |
|---|---|---|---|
rupiahrequiredpositional | int | — | — |
Money.zero(…)
| Parameter | Type | Default | Description |
|---|---|---|---|
currencyrequiredpositional | String | — | — |
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.
| Parameter | Type | Default | Description |
|---|---|---|---|
languageCoderequiredpositional | String | — | — |
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.
| Parameter | Type | Default | Description |
|---|---|---|---|
code:required | String | — | — |
symbol:required | String | — | — |
minorDigits:required | int | — | 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(…)
| Parameter | Type | Default | Description |
|---|---|---|---|
moneyrequiredpositional | Money? | — | — |
AmountParseResult.issue(…)
| Parameter | Type | Default | Description |
|---|---|---|---|
issuerequiredpositional | AmountIssue? | — | — |
AmountIssue
enum AmountIssue · lib/src/foundation/money.dart
| Value | Description |
|---|---|
empty | — |
invalidFormat | — |
ambiguous | — |
negative | — |
zero | — |
belowMinimum | — |
aboveMaximum | — |
See also
Section titled “See also”- Amount text and Amount input.
- Localization for separators, dates and strings.
Compact
Section titled “Compact”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 MWhich formatter
Section titled “Which formatter”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.
| Member | Type / value | Description |
|---|---|---|
dateInputPattern | String | 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. |
dateInputHint | String | Persistent localized pattern; parsing uses dateInputPattern. |
formatDateRange | String | Compact 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). |
formatDate | String | Calendar 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. |
languageCode | String | |
moneyFormat | MoneyFormat | |
formatNumber | String | Chart number with at most one decimal digit, omitting a trailing zero. Uses English separators by default and Indonesian separators for |
supportedLanguages | ['en', 'id'] | |
delegate | _PaymentLocalizationsDelegate() | |
of | PaymentLocalizations | |
formatDateTime | String | "30 Oct 2026, 14:05" / "30 Okt 2026, 14.05" in the device time zone. The date part uses formatDate's no-break spaces. |
formatBytes | String | |
working | String | |
contentHidden | String | |
timeRemaining | String | |
continueLabel | String | |
tryAgain | String | |
edit | String | |
copy | String | |
copied | String | |
copyFailed | String | |
unavailable | String | |
detailsTitle | String | |
lastUpdated | String | |
updatedAt | String | |
checkingStatus | String | |
submitting | String | |
amountLabel | String | |
minimumAmount | String | |
maximumAmount | String | |
amountIssue | String | |
summaryTitle | String | |
totalLabel | String | |
totalChangedTitle | String | |
totalChangedMessage | String | |
acceptNewTotal | String | |
methodTitle | String | |
paymentMethod | String | |
payWithTitle | String | |
noMethodsTitle | String | |
noMethodsMessage | String | |
payAmount | String | |
sendingPayment | String | |
authReadyTitle | String | |
authReadyMessage | String | |
authInProgressTitle | String | |
authInProgressMessage | String | |
authApprovedTitle | String | |
authApprovedMessage | String | |
authCanceledTitle | String | |
authCanceledMessage | String | |
authFailedTitle | String | |
authFailedMessage | String | |
authExpiredTitle | String | |
authExpiredMessage | String | |
authorize | String | |
authorizeAgain | String | |
backToReview | String | |
instructionsTitle | String | |
accountNumber | String | |
amountToPay | String | |
payBefore | String | |
howToPay | String | |
instructionsElapsedTitle | String | |
instructionsElapsedMessage | String | |
statusSendingTitle | String | |
statusSendingMessage | String | |
statusUnknownTitle | String | |
statusUnknownMessage | String | |
statusUnknownLead | String | First line of the unknown-outcome screen, set on its own so the one instruction that prevents a double charge is read first. |
statusUnknownDetail | String | |
statusRequiresActionTitle | String | |
statusRequiresActionMessage | String | |
statusProcessingTitle | String | |
statusProcessingMessage | String | |
statusPendingTitle | String | |
statusPendingMessage | String | |
statusSucceededTitle | String | |
statusSucceededMessage | String | |
statusFailedTitle | String | |
statusFailedMessage | String | |
statusCanceledTitle | String | |
statusCanceledMessage | String | |
statusExpiredTitle | String | |
statusExpiredMessage | String | |
statusUnavailableTitle | String | |
statusUnavailableMessage | String | |
statusLastKnown | String | |
attemptReference | String | |
transactionReference | String | |
notYetConfirmed | String | |
paymentActionLabel | String | |
refundTitle | String | |
refundStatusLabel | String | |
refundAmount | String | |
refundAmountUnavailable | String | |
refundSeparateNote | String | |
merchant | String | |
paidAt | String | |
receiptShareTitle | String | |
shareReceipt | String | |
shareDone | String | |
shareDismissed | String | |
shareFailed | String | |
copyFailedReceipt | String | |
shareAllowlistNote | String | |
kycIntroTitle | String | |
kycIntroMessage | String | |
readPrivacyPolicy | String | |
consentLabel | String | |
consentRequiredHint | String | |
fieldNeedsUpdate | String | |
documentLimits | String | |
documentEmpty | String | |
documentUploading | String | |
documentUploaded | String | |
documentFailed | String | |
documentMissing | String | |
chooseDocument | String | |
replaceDocument | String | |
openSettings | String | |
documentIssueTitle | String | |
documentIssueMessage | String | |
reviewDetailsTitle | String | |
reviewDocumentsTitle | String | |
documentsIncomplete | String | |
submitVerification | String | |
kycUnknownTitle | String | |
kycUnknownMessage | String | |
kycStatusTitle | String | |
kycStatusMessage | String | |
verificationActionLabel | String | |
monthName | String | Full month name for month 1–12: "October" / "Oktober". |
formatMonthYear | String | Calendar month heading: "October 2026" / "Oktober 2026". |
formatDateLong | String | Spoken calendar day: "Tuesday, 14 October 2026" / "Selasa, 14 Oktober 2026". |
weekdayShort | String | Weekday column heading for weekday as in DateTime.weekday (1 = Monday … 7 = Sunday): "Mon" / "Sen". |
firstDayOfWeek | int | First column of the calendar, as a DateTime.weekday value: Monday in Indonesian, Sunday in English. |
chartPercent | String | Spoken percentage. |
sortBy | String | Current local sort summary. |
sortDefault | String | |
sortDirection | String | Direction words matching the column's value kind. |
chartLine | String | |
chartBar | String | |
chartMeter | String | |
chartSparkline | String | |
chartNoData | String | |
chartPendingKey | String | |
chartUnknownKey | String | |
chartLoadFailed | String | |
chartEmptyTitle | String | |
chartRange | String | |
chartLowest | String | |
chartHighest | String | |
chartLatest | String | |
chartPendingCount | String | |
chartUnknownCount | String | |
chartMissingCount | String | |
meterItem | String | |
captureSourceTitle | String | |
captureSourceCamera | String | |
captureSourceGallery | String | |
captureSourceFile | String | |
captureTipLight | String | |
captureTipGlare | String | |
captureTipCorners | String | |
captureTipFaceAndCard | String | |
captureTipNoCover | String | |
captureTake | String | |
captureRetake | String | |
captureUse | String | |
captureTitle | String | |
captureFramingHint | String | |
capturePhotoLabel | String | |
captureFrameLabel | String | |
opensExternally | String | Hint for external destinations. |
hideBanner | String | Banner dismiss action. |
enterValidDate | String | Invalid calendar date. |
chooseDate | String | Calendar action. |
optional | String | Optional field marker. |
charactersLeft | String | Remaining character count. |
currencyLabel | String | Currency switch label. |
chooseDates | String | Calendar range action. |
customRange | String | Custom range action. |
clearDates | String | Clear range action. |
typeDates | String | Switches the range sheet to typed entry. |
useCalendar | String | Switches the range sheet back to the calendar. |
startDate | String | First typed date of a range. |
endDate | String | Last typed date of a range. |
chooseEndDate | String | Range summary while only the start is chosen. |
applyDates | String | Applies the chosen range. |
clear | String | Clears the chosen dates. |
day | String | Wheel column names. |
month | String | |
year | String | |
today | String | Spoken marker on today's date. |
rangeStart | String | Spoken markers on the ends of a range. |
rangeEnd | String | |
startAfterEnd | String | Typed range whose start is after its end. |
dateOutOfRange | String | Typed date outside the allowed range. |
removeItem | String | Chip remove action. |
done | String | Finishes a multiple-choice search sheet. |
resultsCount | String | Search result count. |
dateGranularity | String | Calendar grouping label. |
close | String | |
cancel | String | |
confirm | String | |
moreActions | String | |
loading | String | |
retry | String | |
expand | String | |
collapse | String | |
dismiss | String | |
openNavigation | String | |
navigation | String | |
selected | String | |
closeSheet | String | |
imageUnavailable | String | Image decode failure. |
play | String | |
pause | String | |
replay | String | |
mute | String | |
unmute | String | |
seek | String | |
videoLoading | String | |
videoBuffering | String | |
videoEnded | String | |
videoErrorTitle | String | |
videoErrorMessage | String | |
videoUnsupported | String | |
videoPosition | String | |
sponsored | String | |
promotion | String | |
whyThisAd | String | |
promoUnavailable | String | |
promoLoadFailed | String | |
updatingTotal | String | |
stepOf | String | |
completedStep | String | |
balanceTitle | String | |
balanceUnavailable | String | |
balanceInsufficient | String | |
balanceShortfall | String | |
limitUsed | String | |
promoCodeLabel | String | |
apply | String | |
remove | String | |
checkingCode | String | |
promoCodeEmpty | String | |
promoApplied | String | |
merchantVerified | String | |
orderRef | String | |
search | String | Default search field label. |
transactionsTitle | String | |
searchTransactions | String | |
clearSearch | String | |
noTransactionsTitle | String | |
noTransactionsMessage | String | |
noMatchesTitle | String | |
noMatchesMessage | String | |
transactionsFailedTitle | String | |
resetFilters | String | |
filterByStatus | String | Spoken name of the status filter button that replaces the filter tabs on phones at large text (D91). |
transactionFilterLabel | String | |
paymentLabel | String | |
dateLabel | String | |
methodLabel | String | |
merchantLabel | String | |
taskStatus | String | Spoken task status. |
subTasksComplete | String | Spoken child task completion count. |
selectAllOnPage | String | Select all on this page. |
previousPage | String | Previous page. |
nextPage | String | Next page. |
emptyTitle | String | Nothing here yet. |
sort | String | Sort. |
moveLeft | String | Move left. |
moveRight | String | Move right. |
wider | String | Wider. |
narrower | String | Narrower. |
selectRow | String | Localized selectRow label. |
rowsSelected | String | Localized rowsSelected label. |
pageRange | String | Localized pageRange label. |
pageNumber | String | Localized pageNumber label. |
rowActions | String | Localized rowActions label. |
sortedAscending | String | Localized sortedAscending label. |
sortedDescending | String | Localized sortedDescending label. |
columnOptions | String | Localized columnOptions label. |
save | String | Save. |
signInTitle | String | Sign in to continue. |
allSteps | String | All steps. |
onboardingDone | String | All steps complete. |
backTo | String | Ancestor navigation label. |
create | String | Create an item. |
signInCan | String | Sign-in heading over what the connecting app can do (D61). |
signInCannot | String | Sign-in heading over what the connecting app can never do (D61). |
paymentStatusShort | String | Short status label shared by transaction rows and details. |
| Parameter | Type | Default | Description |
|---|---|---|---|
languageCoderequiredpositional | String | — | — |
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. |
Field foundation
Section titled “Field foundation”PaymentLocalizations.dateInputHint localizes pattern letters; dateInputPattern controls parsing app-wide. Identity date values use ISO calendar dates.