Orientação gerada a partir de informações públicas. Apenas para referência.
Um pacote Flutter/Dart que converte números em palavras em inglês, com suporte a formas monetárias e ordinais. Oferece métodos de extensão intuitivos para integração perfeita em aplicativos em múltiplas plataformas. Projetado para simplicidade e confiabilidade, permite aos desenvolvedores exibir valores numéricos como texto legível, ideal para aplicações financeiras, relatórios ou interfaces amigáveis ao usuário. O pacote é leve e fácil de usar com configuração mínima.
Casos de uso
Convertendo quantias em aplicativos financeiros
Exibindo números em documentos legais
Gerando formatos de número falado
Criando elementos de interface acessíveis
Formatar números grandes em relatórios
Principais recursos
Suporta conversões de moeda e ordinais
Métodos de extensão fáceis de usar
Funciona em todas as principais plataformas
Leve e rápido
API simples com sintaxe clara
Indicado para
Aplicativos financeiros e bancários
Ferramentas educacionais
Funcionalidades de acessibilidade
Geração de documentos
Exibição numérica para o usuário
Considerações
Limitado a 12 idiomas (inglês incluso)
Sem suporte para locais não-ingleses além dos listados
Requer manipulação manual da pluralização em alguns casos
Não otimizado para números extremamente grandes além dos limites padrão
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
Number to Words English
A Flutter/Dart package that converts numbers to their written words representation with multi-language support.
Features
✅ Comprehensive multi-language support: 12 languages worldwide
✅ 🆕 Currency conversion: Support for 12 major currencies in all languages
✅ 🆕 Ordinal numbers: 1st, 2nd, 3rd conversion in all languages
✅ Extension methods: Direct conversion with .toWords(), .toUSD(), .toOrdinal(), etc.
✅ Global coverage: Europe, Asia, Middle East, Latin America
✅ Convert integers to written words in 12 languages
✅ Supports numbers from 0 to trillion scale
✅ Null safety support
✅ Lightweight and fast
✅ No external dependencies
✅ Well tested and documented (147+ tests)
✅ Backward compatible - existing code continues to work
✅ Modular architecture - easy to extend with new languages
✅ 🆕 Language accuracy improvements - Vietnamese, Russian, Arabic grammar fixes
✅ 🆕 Code quality optimized - Dart formatting compliance for better pub.dev scores
✅ 🆕 Broader compatibility - Supports Flutter 2.5+ and Dart 2.12+ for legacy projects
// Large numbers in different languagesprint(NumberToWords.convert('en', 1000000));
// Output: 'one million'print(NumberToWords.convert('vi', 1000000));
// Output: 'một triệu'print(NumberToWords.convert('es', 1000000));
// Output: 'uno millón'// Grammar improvements - Russian gender agreement for thousandsprint(NumberToWords.convert('ru', 1000));
// Output: 'одна тысяча' (feminine form)// Grammar improvements - Arabic proper word orderprint(NumberToWords.convert('ar', 21));
// Output: 'واحد وعشرون' (ones before tens)// Negative numbersprint(NumberToWords.convert('en', -123));
// Output: 'minus one hundred twenty-three'print(NumberToWords.convert('vi', -123));
// Output: 'âm một trăm hai mươi ba'print(NumberToWords.convert('es', -123));
// Output: 'menos ciento veintitrés'// Decimal numbersprint(NumberToWords.convert('en', 12.34));
// Output: 'twelve point three four'print(NumberToWords.convert('vi', 12.34));
// Output: 'mười hai phẩy ba tư'print(NumberToWords.convert('es', 12.34));
// Output: 'doce punto tres cuatro'
Legacy API (Backward Compatible)
The original English-only API continues to work:
// Legacy API - still supportedprint(NumberToWordsEnglish.convert(55));
// Output: 'fifty-five'print(NumberToWordsEnglish.convert(100000));
// Output: 'one hundred thousand'print(NumberToWordsEnglish.convert(13578921));
// Output: 'thirteen million five hundred seventy-eight thousand nine hundred twenty-one'
String result = NumberToWords.convertCurrency('en', 123.45, 'USD');
// Returns: "one hundred twenty-three dollars and forty-five cents"
NumberToWordsEnglish (Legacy)
Methods
static String convert(num number)
Converts a number to its English word representation.
Note: This is the legacy API maintained for backward compatibility. For new projects, use NumberToWords.convert('en', number) instead.
Parameters:
number (num): The number to convert
Returns:
String: The English word representation of the number.
Example:
String result = NumberToWordsEnglish.convert(123);
// Returns: "one hundred twenty-three"
Supported range
This package supports converting integers in the following range:
Minimum: 0 (zero)
Maximum: 999,999,999,999,999 (nine hundred ninety-nine trillion nine hundred ninety-nine billion nine hundred ninety-nine million nine hundred ninety-nine thousand nine hundred ninety-nine)
Additional information
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Issues and feedback
Please file issues, bugs, or feature requests in our issue tracker.
This project is licensed under the MIT License - see the LICENSE file for details.
MIT LicenseCopyright (c) 2022KeNguyenPermissionis hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Softwareis
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.