isMinLengthValid method
Checks if the length of the provided data meets the minimum length requirement.
Returns true if the length of data is less than the specified minimum length min.
If min is not provided, the default minimum length is set to 3.
Example:
bool isValid = isMinLengthValid('example', min: 5);
// Returns true since 'example' has a length less than 5.
If the length of data is equal to or greater than min, returns false.
Example:
bool isValid = isMinLengthValid('example', min: 7);
// Returns false since 'example' has a length of 7, meeting the minimum requirement.
Implementation
bool isMinLengthValid(String data, {int? min}) {
if (data.length < (min ?? 3)) {
return true;
}
return false;
}