matchesPattern method
Checks if the given text matches the provided pattern.
The pattern may contain * wildcards, which are automatically
translated into regex equivalents (.*).
Returns true if the text matches the pattern; otherwise false.
Implementation
bool matchesPattern(String text, String pattern) {
final regex = RegExp(pattern.replaceAll('*', '.*'));
return regex.hasMatch(text);
}