smartExpand method

Iterable<String> smartExpand([
  1. int? maxPieceSize
])

Implementation

Iterable<String> smartExpand([int? maxPieceSize]) sync* {
  if (maxPieceSize != null) {
    for (String i in this) {
      if (i.length <= maxPieceSize) {
        yield i;
      } else {
        for (int j = 0; j < i.length; j += maxPieceSize) {
          yield i.substring(
            j,
            j + maxPieceSize < i.length ? j + maxPieceSize : i.length,
          );
        }
      }
    }
  } else {
    yield* this;
  }
}