from static method

RegExpDialect? from(
  1. Object? dialect, {
  2. bool multiLine = false,
  3. bool caseSensitive = true,
  4. bool throwCompilationErrors = true,
})

Implementation

static RegExpDialect? from(Object? dialect,
    {bool multiLine = false,
    bool caseSensitive = true,
    bool throwCompilationErrors = true}) {
  if (dialect == null) return null;

  if (dialect is RegExpDialect) {
    return dialect.withParameters(
        multiLine: multiLine,
        caseSensitive: caseSensitive,
        throwCompilationErrors: throwCompilationErrors);
  }

  if (dialect is Map) {
    var map = asMapOfString(dialect)!;
    return RegExpDialect(map,
        multiLine: multiLine,
        caseSensitive: caseSensitive,
        throwCompilationErrors: throwCompilationErrors);
  }

  return null;
}