formatMnemonic function
Implementation
List<String> formatMnemonic(var mnemonic) {
List<String> words = [];
if (mnemonic is String) {
var sentence = mnemonic.replaceAll(RegExp(r'[\s+,,]'), ' ');
sentence = sentence.trim();
sentence = sentence.toLowerCase();
words = sentence.split(RegExp(r'\s+'));
} else if (mnemonic is List<String>) {
words = mnemonic;
} else {
throw ArgumentError(_invalidMnemonic);
}
return words;
}