LCOV - code coverage report

Current view
top level - src/_impl/web - _uri_checker.dart
Test
lcov.info
Date
2024-11-13
Legend
Lines
hit
not hit
Branches
taken
not taken
# not executed
HitTotalCoverage
Lines5683.3%
Functions00-
Branches00-
Each row represents a line of source code
LineBranchHitsSource code
1import 'dart:js_interop';
2
3import 'package:web/web.dart' as web;
4
5@JS()
6external JSPromise<web.Response> fetch(JSAny resource, [JSAny? options]);
7
8class UriChecker {
9 UriChecker._();
10
11 static const headers = {'method': 'HEAD'};
12
132 static Future<bool> exists(Uri url) async {
142 if (url.isScheme('data')) return true;
15 try {
162 final res = await fetch(url.toString().toJS, headers.jsify()).toDart;
172 return res.ok && (200 <= res.status) && (res.status < 300);
18 } catch (_) {
190 return false;
20 }
212 }
22}
Choose Features