https://github.com/xclud/dart_persian
Persian utilities for Dart and Flutter.
https://github.com/xclud/dart_persian
Last synced: about 1 year ago
JSON representation
Persian utilities for Dart and Flutter.
- Host: GitHub
- URL: https://github.com/xclud/dart_persian
- Owner: xclud
- License: mit
- Created: 2018-05-02T13:09:01.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2022-12-11T12:43:14.000Z (over 3 years ago)
- Last Synced: 2025-04-25T12:54:40.316Z (about 1 year ago)
- Language: Dart
- Homepage: https://pub.dev/packages/persian
- Size: 98.6 KB
- Stars: 10
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pub.dartlang.org/packages/persian)
Utilities and Humanizer for Persian language and culture.
## Features
* `PersianDate` class which converts a `DateTime` to Jalali date.
* String corrections replacing `ي` with `ی` and `ك` with `ک`.
* Humanize numbers to Persian text: 123 => صد و بیست و سه.
* Convert numbers to Persian numbers: 123 => ۱۲۳.
* Can be used in Dart and Flutter projects.
* Supports all platforms (Android, iOS, macOS, Windows, Linux, Web).
## Getting Started
In your `pubspec.yaml` file add:
```dart
dependencies:
persian: any
```
## Usage
Import the package:
```dart
import 'package:persian/persian.dart';
```
Then, use the extension methods:
```dart
String myText = '123456789';
String myPersianText = myText.withPersianNumbers(); //Will be ۱۲۳۴۵۶۷۸۹
```
```dart
DateTime myDate = DateTime.now();
PersianDate myPersianDate = myDate.toPersian(); //Will be 1398/10/19
```
```dart
int number = 123456789;
String myPersianNumber = number.toPersianString(); //Will be صد و بیست و سه میلیون و چهارصد و پنجاه و شش هزار و هفتصد و هشتاد و نه
```