StringValidations extension

Some basic String validation extensions not provider by dart

on

Methods

isNullOrEmpty({String? valueName}) String?

Available on String?, provided by the StringValidations extension

isNullOrEmpty checks is the String is null or empty. Provides a basic error message that can be used. 'valueName is required' A return value of null indicates a valid value.
isTooLong({int? maxLength = 25, String? valueName}) String?

Available on String?, provided by the StringValidations extension

isTooShort compares the length of a string to the maxLength to ensure it is less than the maxLength. Provides a basic error message that can be used. 'valueName must be less than (maxLength + 1) characters.' A return value of null indicates a valid length.
isTooShort({int minLength = 0, String? valueName}) String?

Available on String?, provided by the StringValidations extension

isTooShort compares the length of a string to the minLength to ensure it is greater. Provides a basic error message that can be used. 'valueName requires at least minLength characters.' A return value of null indicates a valid length.
lengthIsInRange({int? minLength = 0, int? maxLength = 25, String? valueName}) String?

Available on String?, provided by the StringValidations extension

lengthIsInRange compares the length of a string to the minLength and maxLength to ensure it is between the given values. Provides a basic error message that can be used. 'valueName must be between minLength and maxLength characters long.' A return value of null indicates a valid length.