LCOV - code coverage report

Current view
top level - src - squadron_singleton.dart
Test
lcov.info
Date
2024-11-13
Legend
Lines
hit
not hit
Branches
taken
not taken
# not executed
HitTotalCoverage
Lines171894.4%
Functions00-
Branches00-
Each row represents a line of source code
LineBranchHitsSource code
1import '_impl/xplat/_platform.dart'
2 if (dart.library.io) '_impl/native/_platform.dart'
3 if (dart.library.html) '_impl/web/_platform.dart'
4 if (dart.library.js_interop) '_impl/web/_platform.dart' as impl;
5import 'converters/converter.dart';
6
7class Squadron {
80 Squadron._();
9
10 /// Gets the current platform type.
118 static final platformType = impl.getPlatformType();
12
13 /// Parse [url] and returns the corresponding [Uri].
14 ///
15 /// On Web platforms, a leading '~' character will be replaced with the
16 /// current page's root URL. E.g. '~/workers' from '/path/to/index.html'
17 /// will return '/path/to/workers'.
1812 static Uri uri(String url) => impl.mapUrl(url);
19
2036 static final _platformConverter = impl.getPlatformConverter();
2136 static Converter _converter = _platformConverter;
22
23 /// Gets the current converter.
2427 static Converter get converter => _converter;
25
26 /// Sets the current converter. If [value] is `null`, the default converter
27 /// will be restored. If the converter was updated, handlers registered with
28 /// [onConverterChanged] will be notified of the change.
292 static set converter(Converter? value) {
302 value ??= _platformConverter;
313 if (_converter != value) {
32 _converter = value;
334 for (var handler in _converterChangeHandlers.values) {
34 try {
352 handler();
36 } catch (_) {
37 // ignore
38 }
39 }
40 }
411 }
42
433 static final _converterChangeHandlers = <Object, void Function()>{};
44
45 /// Registers a callback that will be called whenever `converter` is changed.
46 /// Returns an object that can be used to unregister the callback by passing
47 /// it to [unregisterConverterChanged].
481 static Object onConverterChanged(void Function() handler) {
491 final key = Object();
503 _converterChangeHandlers[key] = handler;
51 return key;
52 }
53
54 /// Unregisters a callback that was registered with [onConverterChanged].
551 static void unregisterConverterChanged(Object key) {
563 _converterChangeHandlers.remove(key);
57 }
58}
Choose Features