contains method

bool contains(
  1. String other, {
  2. bool caseSensitive = true,
})

Checks if the string contains other.

caseSensitive determines whether the search is case-sensitive (default: true).

Example:

final name = react('Flutter');
name.contains('flut', caseSensitive: false); // true

Implementation

bool contains(String other, {bool caseSensitive = true}) {
  final v = caseSensitive ? value : value.toLowerCase();
  final t = caseSensitive ? other : other.toLowerCase();
  return v.contains(t);
}