msgSplitter method

List<String> msgSplitter(
  1. String msg,
  2. int l
)

Implementation

List<String> msgSplitter(String msg, int l) {
  String request = msg;
  List<String> res = [];
  int partCount = ((request.length) / l).floor();
//   print(partCount);
  for (int i = 0; i < partCount; i++) {
    String msg = request.substring((i * l), (i + 1) * l);
    res.add(msg);
  }
  String lastMsg = request.substring(((partCount) * l));
  res.add(lastMsg);
  return res;
}