checkStringBytesLen function

bool checkStringBytesLen(
  1. String str,
  2. int len
)

Returns true if the bytes length of a string str is less than a certain value len.

Implementation

bool checkStringBytesLen(String str, int len) {
  final bytes = utf8.encode(str);
  return bytes.length <= len;
}