withParameters method
Returns a copy of this instance with parameters multiLine
and caseSensitive
.
If this instance already have the same parameters returns this instance.
Implementation
RegExpDialect withParameters(
{bool? multiLine = false,
bool? caseSensitive = true,
bool throwCompilationErrors = true}) {
multiLine ??= this.multiLine;
caseSensitive ??= this.caseSensitive;
if (hasErrors && throwCompilationErrors) {
throw StateError(
"Can't use a dialect with errors. Words with errors: ${errorWords.join(', ')}");
}
if (this.multiLine == multiLine && this.caseSensitive == caseSensitive) {
return this;
}
return RegExpDialect._(_dialect, multiLine, caseSensitive);
}