dataUriMatcher function

CustomRenderMatcher dataUriMatcher({
  1. String? encoding = 'base64',
  2. String? mime,
})

Implementation

CustomRenderMatcher dataUriMatcher(
        {String? encoding = 'base64', String? mime}) =>
    (context) {
      if (context.tree.element?.attributes == null ||
          _src(context.tree.element!.attributes.cast()) == null) return false;
      final dataUri = _dataUriFormat
          .firstMatch(_src(context.tree.element!.attributes.cast())!);
      return dataUri != null &&
          dataUri.namedGroup('mime') != "image/svg+xml" &&
          (mime == null || dataUri.namedGroup('mime') == mime) &&
          (encoding == null || dataUri.namedGroup('encoding') == ';$encoding');
    };