contains method Null safety

bool contains(
  1. String other
)

Whether the string value contains a match of other.

Example:

const string = 'Doug';
final containsD = string.contains('D'); // true
final containsUpperCase = string.contains(RegExp(r'[A-Z]')); // true

If startIndex is provided, this method matches only at or after that index:

const string = 'Doug smith';
final containsD = string.contains(RegExp('D'), 0); // true
final caseSensitive = string.contains(RegExp(r'[A-Z]'), 1); // false

The startIndex must not be negative or greater than length.

Implementation

bool contains(String other) => _value.contains(other);