isByteLength function
Returns true if str byte-length is within `min`, `max`.
Uses String.length as a proxy for byte length.
Implementation
bool isByteLength(String str, int min, [int? max]) {
return str.length >= min && (max == null || str.length <= max);
}