utils/utils
library
Classes
-
ValidationData
-
Represents data used for validation, including the value to be validated
and a list of validator annotation.
Functions
-
assertNullableString({dynamic value, bool allowNullable = false})
→ void
-
Asserts that the given
value is a String,
and optionally allows null if specified.
-
assertNumeric({dynamic value, bool allowNullable = false})
→ void
-
-
validateField(dynamic value, List<ValidatorAnnotation> annotations)
→ String?
-
Validates a field using a list of ValidatorAnnotation annotations.
-
validateInstance(List<ValidationData> validationDatas, {bool stopWhenFirstError = true})
→ ValidationResult
-
-
validateIsAlphabet({String? value, bool onlyAcceptLowerCase = false, bool allowMultiline = true, bool trimWhiteSpace = true})
→ bool
-
check if the
value is alphabet or not
-
validateIsEmpty({String? value, bool excludeWhiteSpace = true})
→ bool
-
check if the
value is empty or not
-
validateIsNegative<T extends num>(T value)
→ bool
-
validate if
value is negative
-
validateIsNotNegative<T extends num>(T value)
→ bool
-
validate if
value is not negative
-
validateIsNotPositive<T extends num>(T value)
→ bool
-
validate if
value is not positive
-
validateIsNotZero<T extends num>(T value)
→ bool
-
validate if
value lower than zero or higher than zero
-
validateIsPositive<T extends num>(T value)
→ bool
-
validate if
value is positive
-
validateIsStringDouble({required String value})
→ bool
-
validate is string value can be parsed to double or not
-
validateIsStringInteger({required String value})
→ bool
-
validate is string value can be parsed to integer or not
-
validateIsStringNumber({required String value})
→ bool
-
validate is string value can be parsed to numeric or not
-
validateMaxStringLength({required int length, required String value})
→ bool
-
validate is string
value have max length <= length
-
validateMaxValue<T extends num>({required T value, required T maxValue})
→ bool
-
validate if
value <= maxValue
-
validateMinMaxStringLength({required int minLength, required int maxLength, required String value})
→ bool
-
validate is string
value length >= minLength and <= maxLength
-
validateMinMaxValue<T extends num>({required T value, required T minValue, required T maxValue})
→ bool
-
validate if
value >= minValue and value <= maxValue
-
validateMinStringLength({required int length, required String value})
→ bool
-
validate is string
value have min length >= length
-
validateMinValue<T extends num>({required T value, required T minValue})
→ bool
-
validate if
value >= minValue