limit function
Returns functions that limits passed string to the maxLength
number of characters.
If passed string is shorter than limit, it will return passed string.
If passed string is null
, it will return empty string.
final limit3 = limit(3);
limit3('Test') // 'Tes'
Implementation
String Function(String?) limit(int maxLength) =>
(s) => substring(s, 0, maxLength);