solve method
Solve the anagram Returns a list of anagrams or an empty list if none were found.
Implementation
List<String?> solve(String word) {
if (!_initialised) {
_log('Please initialise the library');
return <String>[];
}
_initialiseDataStructures(word);
_log('Solving for $word, building word list');
// Build the candidate word list
_wordList = _buildWordList();
if (_wordList.isEmpty) {
print('No suitable words.');
return <String>[];
}
// Sort it
_log('Sorting');
_wordList = _sort();
// Search for anagrams
_log('Searching for anagrams...');
_findAnagrams(0, _wordList.last, _nLetters);
return _anagramsFound.toSet().toList();
}