take method

String take(
  1. int count, {
  2. bool ellipsis = true,
  3. String fill = "",
  4. bool useRunes = false,
})

Implementation

String take(int count, {bool ellipsis = true, String fill = "", bool useRunes = false}) {
  if (useRunes) {
    final length = runes.length;
    if (length <= count) {
      return this;
    }
    return "${String.fromCharCodes(runes.toList().sublist(0, count))}${ellipsis ? "..." : ""}$fill";
  }
  if (length <= count) {
    return this;
  }
  return "${substring(0, count)}${ellipsis ? "..." : ""}$fill";
}