networkSourceMatcher function
Implementation
ImageSourceMatcher networkSourceMatcher({
List<String> schemas= const ["https", "http"],
List<String>? domains,
String? extension,
}) =>
(attributes, element) {
if (_src(attributes) == null) return false;
try {
final src = Uri.parse(_src(attributes)!);
return schemas.contains(src.scheme) &&
(domains == null || domains.contains(src.host)) &&
(extension == null || src.path.endsWith(".$extension"));
} catch (e) {
return false;
}
};