initSort method

dynamic initSort(
  1. List<Line>? allLines, {
  2. int spaceBetweenWordsCount = 4,
  3. bool isHorizontal = true,
  4. int strictness = 1,
})

***** ***** ***** ***** ***** SORTING_ALGORITHM ***** ***** ***** ***** *****


Sorts all lines probably the most accurate algorithm for sorting lines the length of space between words of a line is 4 and it's changeable!

Implementation

///Sorts all lines
///probably the most accurate algorithm for sorting lines
///the length of space between words of a line is 4 and it's changeable!
initSort(List<Line>? allLines,
    {int spaceBetweenWordsCount = 4,
    bool isHorizontal = true,
    int strictness = 1}) async {
  if (isHorizontal) {
    isSortComplete = false;
    sortedResult = '';
  } else {
    isSortCompleteVertical = false;
    sortedResultVertical = '';
  }
  spaceBetweenWords = '';
  for (int i = 0; i < spaceBetweenWordsCount; i++) {
    spaceBetweenWords = spaceBetweenWords + ' ';
  }
  sortLines(allLines, spaceBetweenWords, isHorizontal, strictness);
  await waitWhile(
      () => isHorizontal ? isSortComplete : isSortCompleteVertical);
  return isHorizontal
      ? sortedResult
      : sortedResultVertical; //the data is ready to use!
}