flutter_multi_formatter library

Enums

BitcoinAddressNetwork
BitcoinAddressType
BitcoinWalletType
InvalidPhoneAction
this is used in a formatAsPhoneNumber() function and this is what the returned result depends on
ShorteningPolicy
ThousandSeparator
Comma means this format 1,000,000.00 Period means thousands and mantissa will look like this 1.000.000,00 None no separator will be applied at all SpaceAndPeriodMantissa 1 000 000.00 SpaceAndCommaMantissa 1 000 000,00

Extensions

DoubleExtensions on double
IntExtension on int
NumericInputFormatting on num
WARNING! This stuff requires Dart SDK version 2.6+ so if your code is supposed to be running on older versions do not use these methods! or change the sdk restrictions in your pubspec.yaml like this: environment: sdk: ">=2.6.0 <3.0.0"
StringExtension on String
StringInputFormatting on String

Functions

checkMask(String mask) → void
enumFromString<T>(List<T> enumValues, String? value) → T?
enumToString(dynamic enumValue) String?
formatAsCardNumber(String cardNumber) String
formatAsPhoneNumber(String phone, {InvalidPhoneAction invalidPhoneAction = InvalidPhoneAction.ShowUnformatted, bool allowEndlessPhone = false, String? defaultMask, String? defaultCountryCode}) String?
allowEndlessPhone if this is true, the
getBitcoinWalletDetails(String? value) BitcoinWalletDetails
Detailed wallet check. The returned object contains all the necessary info like address type, network, wallet type and address. Before using the returned object, use isValid getter to check if the result is valid
getBitcoinWalletType(String? value) BitcoinWalletType
A simplified wallet type check which only returns a wallet type like SegWit, Regular, or None if a wallet address is invalid
getCardSystemData(String cardNumber) CardSystemData?
getCountryDatasByPhone(String phone) List<PhoneCountryData>
returns a list of country datas with a country code of the supplied phone number. The return type is List because many countries and territories may share the same phone code the list will contain one PhoneCountryData at max returns A list of PhoneCountryData datas or an empty list
isBitcoinWalletValid(String? value) bool
isCardNumberValid({required String cardNumber, bool checkLength = false, bool useLuhnAlgo = true}) bool
useLuhnAlgo validates the number using the Luhn algorithm
isCardValidNumber(String cardNumber, {bool checkLength = false}) bool
checks not only for a length and characters but also for card system code. If it's not found the succession of numbers will not be marked as a valid card number
isCryptoCurrency(String currencyId) bool
Basically it doesn't really check if the currencyId is a crypto currency. It just checks if it's not fiat. I decided not to collect all possible crypto currecies as there's an endless amount of them
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
isFiatCurrency(String currencyId) bool
Checks if currency is fiat
isPhoneValid(String phone, {bool allowEndlessPhone = false, String? defaultCountryCode}) bool
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, bool isRawValue = false}) String
isRawValue pass true if you
toNumericString(String? inputString, {bool allowPeriod = false, bool allowHyphen = true, String mantissaSeparator = '.', String? errorText, bool allowAllZeroes = false, int? mantissaLength}) 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