split method

Future<void> split(
  1. List<int> data
)

Implementation

Future<void> split(List<int> data) async {
  int startIndex = 0, endIndex = 100000;
  while (startIndex < data.length) {
    add(data.sublist(startIndex, endIndex));
    await Future.delayed(Duration(milliseconds: 10));
    startIndex = endIndex;
    endIndex += 100000;
    if (endIndex > data.length) {
      endIndex = data.length;
    }
  }
}