WtHelper class

Stateless UI + formatting helpers: dates/relative time, string casing & slugs, number/currency formatting, and flash/showLoading/confirm dialog utilities.

Constructors

WtHelper()

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

confirm(BuildContext context, {required String title, required String message, String confirmText = 'Confirm', String cancelText = 'Cancel'}) Future<bool>
currency(double amount, {String symbol = '\$', int decimals = 2}) String
flash(BuildContext context, String message, {bool isError = false}) → void
formatDate(DateTime date, {String format = 'yyyy-MM-dd'}) String
Formats date with an intl format pattern (default yyyy-MM-dd).
formatDateTime(DateTime date) String
formatNumber(num number) String
hideLoading(BuildContext context) → void
showLoading(BuildContext context) → void
slug(String text) String
timeAgo(DateTime date, {DateTime? now, bool assumeUtc = false, int justNowSeconds = 10, TimeAgoLabels? labels}) String
A relative "time ago" phrase covering seconds → years.
timeAgoFrom(String? dateTime, {DateTime? now, bool assumeUtc = false, int justNowSeconds = 10, TimeAgoLabels? labels}) String
timeAgo for a datetime string (ISO-8601 or yyyy-MM-dd HH:mm:ss). Returns '' for null / blank / unparseable input instead of throwing — safe to drop straight into a widget from an API/DB field.
truncate(String text, int maxLength, {String suffix = '...'}) String
ucFirst(String text) String