persian 1.2.0 copy "persian: ^1.2.0" to clipboard
persian: ^1.2.0 copied to clipboard

Utilities and Humanizer for Persian language and culture. Includes some String extensions and PersianDate class.

pub package

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:

dependencies:
  persian: any

Usage #

Import the package:

import 'package:persian/persian.dart';

Then, use the extension methods:

String myText = '123456789';
String myPersianText = myText.withPersianNumbers(); //Will be ۱۲۳۴۵۶۷۸۹
DateTime myDate = DateTime.now();
PersianDate myPersianDate = myDate.toPersian(); //Will be 1398/10/19
int number = 123456789;
String myPersianNumber = number.toPersianString(); //Will be صد و بیست و سه میلیون و چهارصد و پنجاه و شش هزار و هفتصد و هشتاد و نه
44
likes
150
points
120
downloads

Publisher

verified publisherpwa.ir

Weekly Downloads

Utilities and Humanizer for Persian language and culture. Includes some String extensions and PersianDate class.

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

More

Packages that depend on persian