insert method
Inserts the word
into the trie.
Implementation
void insert(String word) {
var currentNode = _root;
for (final character in word.characters) {
// Add a child with a key and no value.
//
// The nodes in this trie never have a value as only the character
// is stored.
currentNode = currentNode.putChildIfAbsent(character, value: null);
}
currentNode.isEndOfWord = true;
}