Formatter class

Number and text formatting helpers.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

compact(num value, {String? locale}) → String
Formats value as a compact number (e.g. 1.2K, 3.4M).
currency(num value, {String symbol = '\$', int decimals = 2, String? locale}) → String
Formats a currency amount using symbol.
decimal(num value, {int decimals = 2, String? locale}) → String
Formats value with a fixed number of decimals.
maskCard(String cardNumber) → String
Masks a card number keeping the first 4 and last 4 digits.
maskEmail(String email) → String
Masks an email address.
maskPhone(String phone) → String
Masks a phone number keeping the last 4 digits.
number(num value, {String? locale}) → String
Formats value with thousands separators (e.g. 1,234,567).
percent(num value, {int decimals = 1}) → String
Formats a perceTage (e.g. 12.5%).
titleCase(String text) → String
Capitalizes the first letter of each word.
truncate(String text, int maxLength) → String
Truncates text to maxLength and appends an ellipsis.