isMaxLengthValid method
Checks if the length of the provided data exceeds the maximum length allowed.
Returns true if the length of data is greater than the specified maximum length max.
If max is not provided, the default maximum length is set to 15.
Example:
bool isValid = isMaxLengthValid('example', max: 5);
// Returns true since 'example' has a length greater than 5.
If the length of data is equal to or less than max, returns false.
Example:
bool isValid = isMaxLengthValid('example', max: 10);
// Returns false since 'example' has a length of 7, within the maximum limit.
Implementation
bool isMaxLengthValid(String data, {int? max}) {
if (data.length > (max ?? 15)) {
return true;
}
return false;
}