utils/format library
Extensions
Functions
-
formatCurrency(
double? value) → String -
Formats a double value to a currency string using the
_kCurrencyFormatterSymbolWithCents. Returns 'n/a' if the value is null. -
formatDate(
DateTime? value) → String -
Formats a DateTime object to a string using the
_kDateFormat. Returns 'n/a' if the value is null or represents an invalid date. -
formatDateDay(
DateTime? value) → String -
Formats a DateTime object to a string using the
_kDateDayFormat. Returns 'n/a' if the value is null or represents an invalid date and time. -
formatDateTime(
DateTime? value) → String -
Formats a DateTime object to a string using the
_kDateTimeFormat. Returns 'n/a' if the value is null or represents an invalid date and time. -
formatImage(
String? imageData) → Uint8List -
Decodes a base64 encoded string
imageDatato a Uint8List. If the input is null or empty, it uses_kDefaultImageBase64. -
formatInitials(
String? value) → String -
Formats a string
valueto its initials. Returns the first two initials of the input string. If the input is null or empty, returns 'n/a'. -
formatNullable(
Object? value) → String - Converts an Object to a string. Returns 'n/a' if the value is null.
-
formatNumber(
int? value) → String - Converts an int value to a string. Returns 'n/a' if the value is null.
-
formatPercent(
double? value) → String -
Formats a double value to a percentage string using the
_kPercentFormatter. Returns 'n/a' if the value is null.