isLike method

bool isLike(
  1. string mask, [
  2. bool caseSensitive = false
])

Checks if a given value matches a mask pattern.

The mask pattern can contain wildcard characters:

  • * matches any sequence of characters (including an empty sequence).
  • ? matches any single character.

Returns true if the value matches the mask pattern, false otherwise.

Implementation

bool isLike(string mask, [bool caseSensitive = false]) => RegExp('^${RegExp.escape(mask).replaceAll('\\*', '.*').replaceAll('\\?', '.').toString()}\$', multiLine: true, caseSensitive: caseSensitive).hasMatch(this);