숫자를 영어 단어로 변환하는 플러터/다트 패키지로, 통화 및 순서형 형식을 지원합니다. 다양한 플랫폼에서 앱에 원활하게 통합할 수 있는 직관적인 확장 메서드를 제공합니다. 간단하고 신뢰성 있는 설계로 개발자가 숫자 값을 읽기 쉬운 텍스트로 표시할 수 있게 해주며, 금융 애플리케이션, 보고서 또는 사용자 친화적인 인터페이스에 이상적입니다. 가볍고 설정이 최소한으로 필요한 사용하기 쉬운 패키지입니다.
사용 사례
금융 앱에서 금액 변환
법적 문서에서 숫자 표시
발음된 숫자 형식 생성
접근성 있는 UI 요소 만들기
보고서에서 큰 숫자 형식 지정
주요 기능
통화 및 순서 변환을 지원합니다
사용하기 쉬운 확장 메서드
모든 주요 플랫폼에서 작동합니다
경량이고 빠름
간결한 API와 명확한 구문
적합한 대상
금융 및 은행 앱
교육 도구
접근성 기능
문서 생성
사용자 친화적인 숫자 표시
고려 사항
12개 언어(영어 포함)로 제한됨
나열된 것 외에 비영어 지역 설정에 대한 지원 없음
일부 경우에서는 복수형을 수동으로 처리해야 합니다
표준 한계를 초과하는 매우 큰 숫자에는 최적화되지 않음
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
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.