CurrencyValidator class

Validator that ensures the value is a valid currency for the device's current locale.

Implemented types
Annotations
  • @immutable

Constructors

CurrencyValidator({bool allowNegative = true})
Constructs the validator with the option to allowNegative values or not. If allowNegative is true then this will allow negative values and will error out on negative otherwise.
const

Properties

allowNegative bool
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String
no setteroverride

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Returns the JSON-compatible representation of this validator.
toString() String
Returns the string encoded JSON representation for this class. This will remove all null values and empty collections from the returned string.
inherited
validate({required String label, required String? value}) String?
Validates that the given value is in a valid currency format. If allowNegative is true then this will pass on negative currency values, other this will fail on negative currency values.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromDynamic(dynamic map) CurrencyValidator
Processes the validator object from the given map which must be an actual Map or a Map-like object that supports the [] operator. Any non-null object that is not Map-like will result in an error. A null value will result in a return value of null.

Constants

kType → const String