dataUriMatcher function

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

Implementation

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