takeFirst function

String takeFirst(
  1. String? value,
  2. int count
)

Implementation

String takeFirst(String? value, int count) {
  if (value == null || value.isEmpty || count < 1) return "";
  if (value.length > count) {
    return value.substring(0, count);
  } else {
    return value;
  }
}