initSort method
dynamic
initSort(})
***** ***** ***** ***** ***** 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!
}