amount_to_word 2.5.2 copy "amount_to_word: ^2.5.2" to clipboard
amount_to_word: ^2.5.2 copied to clipboard

Number & amount to words for Flutter/Dart — Persian, English, Turkish, Arabic, Spanish, Hindi with 23 currencies, ordinals, invoices & BigInt.

Amount to Word — Number & Currency to Words for Flutter & Dart #

Convert numbers and money amounts to words in Persian (Farsi), English, Turkish, Arabic, Spanish, and Hindi — with 23 currencies, ordinals, invoice helpers, Indian numbering (lakh/crore), BigInt, and Flutter locale detection.

Ideal for invoices, receipts, banking, e-commerce, and multilingual financial apps.

Pub Version Pub Likes Pub Points License: MIT GitHub stars

⭐ If this package saves you time, please star the repo on GitHub — it helps others discover it and keeps development going. Thank you!

12345.toWords(language: Language.fa);  // دوازده هزار و سیصد و چهل و پنج
12.5.toCurrency(currency: CurrencyConfig.usDollar);
// twelve dollars and fifty cents

Why amount_to_word? #

6 languages Persian, English, Turkish, Arabic, Spanish, Hindi — native grammar & pluralization
23 currencies IRR/IRT, USD, EUR, GBP, MENA, Asia-Pacific + custom currencies
Invoice-ready prefix / suffix / only / ignoreZeroCurrency
Extensions 123.toWords(), 1.toOrdinal(), BigInt.toWords(), numeric strings
Indian numbering Opt-in lakh / crore scales
BigInt Amounts beyond safe num precision
Flutter locale AmountToWords.fromContext(context)
Light footprint No intl — Flutter only for optional locale hooks
Stable API ^2.0.x–^2.5.x callers stay compatible

Search keywords: number to words · amount to words · currency to words · Persian number to words · Flutter invoice text · Dart localization · تبدیل عدد به حروف


Table of contents #


Installation #

Add to pubspec.yaml:

dependencies:
  amount_to_word: ^2.5.1
flutter pub get
# or: dart pub get

Requires Dart ^3.5.0. Core conversion works in any Dart/Flutter app; AmountToWords.fromContext needs a Flutter BuildContext.


Quick start #

import 'package:amount_to_word/amount_to_word.dart';

void main() {
  final fa = AmountToWords(Language.fa);
  final en = AmountToWords(Language.en);

  print(fa.toWords(12345));
  // دوازده هزار و سیصد و چهل و پنج

  print(en.convert(1250.75, currency: CurrencyConfig.usDollar));
  // one thousand two hundred fifty dollars and seventy-five cents

  print(fa.convert(1_000_000, currency: CurrencyConfig.iranianToman));
  // یک میلیون تومان
}

Extensions (one-liners) #

print(123.toWords());                                    // one hundred twenty-three
print(25.toWords(language: Language.fa));                // بیست و پنج
print(21.toWords(language: Language.ar));                // واحد و عشرون
print(21.toWords(language: Language.es));                // veintiuno
print(21.toWords(language: Language.hi));                // इक्कीस

print(12.5.toCurrency(currency: CurrencyConfig.usDollar));
print(1.5.toCurrency(language: Language.hi, currency: CurrencyConfig.indianRupee));

print('۲۵'.toWords(language: Language.fa));
print('١٢'.toWords(language: Language.ar));

Indian numbering & BigInt #

print(100000.toWords(numberingSystem: NumberingSystem.indian)); // one lakh

print(BigInt.parse('1000000000000000000').toWords()); // one quintillion
print(CurrencyConfig.getByCode('GBP')!.getMainUnit(Language.en)); // pound

Ordinals, negatives & invoices #

print(1.toOrdinal());                                    // first
print(21.toOrdinal(language: Language.fa));              // بیست و یکم

print((-5).toWords(allowNegative: true));                // minus five

print(AmountToWords(Language.en).convert(
  100,
  currency: CurrencyConfig.usDollar,
  prefix: 'Amount: ',
  only: true,
));
// Amount: one hundred dollars only

Supported languages #

Language Code Cardinals Currency Ordinals Mixed
Persian (Farsi) fa ✅ ✅ ✅ ✅
English en ✅ ✅ ✅ ✅
Turkish tr ✅ ✅ ✅ ✅
Arabic ar ✅ ✅ ✅ ✅
Spanish es ✅ ✅ ✅ ✅
Hindi hi ✅ ✅ ✅ ✅

Supported currencies #

Currency Decimals Notes
Iranian Rial / Toman ❌ Local usage (no subunits)
USD, EUR, CAD, GBP, AUD, NZD, CHF ✅ Full pluralization
Turkish Lira, Afghan Afghani ✅ / ❌ Regional
SAR, AED, QAR, KWD, IQD, EGP ✅ MENA (KWD/IQD: 1000 fils)
JPY, CNY, INR, KRW, PKR, BDT ✅ / ❌ Asia-Pacific

ISO-style lookup: CurrencyConfig.getByCode('INR'). Define custom currencies with CurrencyConfig(...).


Number formats #

Format Persian English
Words دو هزار و پانصد و شصت و شش two thousand five hundred sixty-six
Mixed ۲ هزار و ۵۶۶ 2 thousand 566
Language digits ۲,۵۶۶ 2,566
Latin digits 2,566 2,566
final converter = AmountToWords(Language.fa);
print(converter.toMixed(2566)); // ۲ هزار و ۵۶۶
print(converter.convertToMixed(2566.75, currency: CurrencyConfig.usDollar));

Configure thresholds and commas with NumberFormatConfig.


Features in depth #

Custom currency #

final bitcoin = CurrencyConfig(
  mainUnits: {
    Language.en: 'bitcoin',
    Language.fa: 'بیت‌کوین',
  },
  subUnits: {
    Language.en: 'satoshi',
    Language.fa: 'ساتوشی',
  },
  subUnitInMainUnit: 100000000,
);

print(AmountToWords(Language.en).convert(1.5, currency: bitcoin));

Pluralization (examples) #

  • English: dollar → dollars, penny → pennies
  • Spanish: dólar canadiense → dólares canadienses; apocope un / veintiún
  • Hindi: रुपया → रुपये, पैसा → पैसे
  • Persian & Turkish: currency units typically uninflected

Range & negatives #

  • Default range: 0 … 999,999,999,999,999 (larger via BigInt APIs)
  • Negatives throw unless allowNegative: true
  • Currency decimals follow subUnitInMainUnit (e.g. KWD: 3 digits)

Packaging #

  • Pure Dart: converters, currencies, extensions, ordinals, BigInt, Indian numbering
  • Flutter-only: fromContext / of / convertWithContext (locale from BuildContext)

Flutter integration #

import 'package:flutter/material.dart';
import 'package:amount_to_word/amount_to_word.dart';

class PriceDisplay extends StatelessWidget {
  final double amount;
  final CurrencyConfig currency;

  const PriceDisplay({super.key, required this.amount, required this.currency});

  @override
  Widget build(BuildContext context) {
    final converter = AmountToWords.fromContext(context);

    return Text(
      converter.convert(amount, currency: currency),
      style: const TextStyle(fontStyle: FontStyle.italic),
    );
  }
}

Also available: AmountToWords.fromLocale('fa').


API overview #

AmountToWords #

API Purpose
AmountToWords(Language) Explicit language
fromLocale([String?]) Locale string
fromContext(BuildContext) Flutter locale
toWords(num, …) Cardinals
convert(num, {currency, prefix, suffix, only, …}) Amount + currency / invoice
toOrdinal(int) Ordinals
toMixed / convertToMixed Digits + scale words

Predefined currencies (selection) #

iranianRial, iranianToman, usDollar, euro, canadianDollar, britishPound, saudiRiyal, uaeDirham, turkishLira, indianRupee, japaneseYen, … — see API docs.

Language #

enum Language { fa, en, tr, ar, es, hi }

Full reference: pub.flutter-io.cn documentation.


Examples #

Runnable samples under /example:

File Covers
example.dart Multilingual showcase
basic_usage.dart Cardinals FA / EN / TR
currency_usage.dart Built-in currencies
extensions_invoice_ordinals.dart Extensions, ordinals, invoices
bigint_indian_numbering.dart BigInt + Indian scales
multilingual_ar_es_hi.dart Arabic, Spanish, Hindi
flutter_integration.dart Widget + fromContext
mixed_format_example.dart Mixed formats
custom_currency.dart Custom currency
dart pub get
dart run example/example.dart
flutter test

Performance #

Metric Detail
Complexity O(log n) conversion
Dependencies Flutter SDK only (no intl)
Network Fully offline
Reuse Keep one AmountToWords instance per language

Compared to typical alternatives #

amount_to_word Typical packages
Languages 6 1–2
Currencies 23 + custom Few / none
Invoice options Yes Rare
Indian numbering + BigInt Yes Rare
Flutter locale helper Yes Often missing

Contributing #

Bug reports and PRs are welcome:

  1. Open an issue for bugs or language/currency requests
  2. For new languages: extend Language, add a ConverterBase implementation, update currencies + tests + docs
  3. For new currencies: add CurrencyConfig, register in getAllCurrencies(), cover with tests

Changelog: CHANGELOG.md


Support & star #

📦 pub.flutter-io.cn amount_to_word
📖 Docs API reference
🐛 Issues GitHub Issues
💬 Discussions GitHub Discussions

⭐ Star this repository #

If amount_to_word helps your product or side project:

→ Star on GitHub

Stars improve discoverability on GitHub and pub.flutter-io.cn, encourage contributions, and signal that multilingual amount-to-words tooling matters to the Flutter community. One click makes a real difference.

Star History Chart


Use cases #

  • Invoices & receipts (legal amount-in-words lines)
  • Banking / fintech UIs
  • E-commerce order summaries
  • Multilingual accounting & ERP
  • Government / education number systems

Supported by #

Built and battle-tested with Fida Invoice — a professional invoice app for Iran (branding, stamps, auto calculations, export).

Get Fida Invoice on Google Play


License #

MIT — see LICENSE.


Convert any amount to words. Ship invoices users can trust.
If you found this useful → ⭐ Star the repo · 👍 Like on pub.flutter-io.cn

3
likes
160
points
110
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Number & amount to words for Flutter/Dart — Persian, English, Turkish, Arabic, Spanish, Hindi with 23 currencies, ordinals, invoices & BigInt.

Repository (GitHub)
View/report issues

Topics

#number-to-words #currency #flutter #i18n #invoice

License

MIT (license)

Dependencies

flutter

More

Packages that depend on amount_to_word