is_ static method
Determines if value matches the given pattern. Asterisks are wildcards.
Str.is_('foo.*', 'foo.bar'); // true
Str.is_(['admin/*', 'user/*'], 'admin/profile'); // true
Implementation
// ignore: non_constant_identifier_names
static bool is_(dynamic pattern, String value) {
final patterns = pattern is List ? pattern : [pattern];
for (final p in patterns) {
final s = p.toString();
if (s == value) return true;
final escaped = RegExp.escape(s).replaceAll(r'\*', '.*');
if (RegExp('^$escaped\$').hasMatch(value)) return true;
}
return false;
}