PriceFormatter class
Utility for formatting prices with proper localization.
final formatter = PriceFormatter();
// Format with currency symbol
formatter.format(9.99, 'USD'); // '$9.99'
formatter.format(9.99, 'KRW'); // '₩9,990'
// Format subscription price
formatter.formatSubscription(9.99, 'USD', 'month'); // '$9.99/month'
Constructors
- PriceFormatter({String? locale})
- Creates a price formatter.
Properties
Methods
-
format(
double price, String currencyCode) → String - Formats a price with currency symbol.
-
formatRange(
double minPrice, double maxPrice, String currencyCode) → String - Formats a price range.
-
formatSavings(
double monthlyPrice, double yearlyPrice, int monthsInYear, {String prefix = 'Save '}) → String - Calculates and formats savings percentage.
-
formatSubscription(
double price, String currencyCode, String period) → String - Formats a subscription price with period.
-
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