formatter_utils library Null safety


checkMask(String mask) → void
isDigit(String? character, {bool positiveOnly = false}) bool
character a character to check if it's a digit against positiveOnly if true it will not allow a minus (dash) character to be accepted as a part of a digit
isUnmaskableSymbol(String? symbol) bool
numericStringStartsWithOrphanPeriod(String string) bool
toCurrencyString(String value, {int mantissaLength = 2, ThousandSeparator thousandSeparator = ThousandSeparator.Comma, ShorteningPolicy shorteningPolicy = ShorteningPolicy.NoShortening, String leadingSymbol = '', String trailingSymbol = '', bool useSymbolPadding = false}) String
thousandSeparator specifies what symbol will be used to separate each block of 3 digits, e.g. ThousandSeparator.Comma will format a million as 1,000,000 shorteningPolicy is used to round values using K for thousands, M for millions and B for billions ShorteningPolicy.NoShortening displays a value of 1234456789.34 as 1,234,456,789.34 but ShorteningPolicy.RoundToThousands displays the same value as 1,234,456K mantissaLength specifies how many digits will be added after a period sign leadingSymbol any symbol (except for the ones that contain digits) the will be added in front of the resulting string. E.g. $ or € some of the signs are available via constants like MoneySymbols.EURO_SIGN but you can basically add any string instead of it. The main rule is that the string must not contain digits, preiods, commas and dashes trailingSymbol is the same as leading but this symbol will be added at the end of your resulting string like 1,250€ instead of €1,250 useSymbolPadding adds a space between the number and trailing / leading symbols like 1,250€ -> 1,250 € or €1,250€ -> € 1,250
toNumericString(String? inputString, {bool allowPeriod = false, bool allowHyphen = true, String mantissaSeparator = '.', String? errorText, bool allowAllZeroes = false}) String
errorText if you don't want this method to throw any errors, pass null here allowAllZeroes might be useful e.g. for phone masks
toNumericStringByRegex(String? inputString, {bool allowPeriod = false, bool allowHyphen = true}) String