LCOV - code coverage report

Current view
top level - src/worker - worker_channel.dart
Test
lcov.info
Date
2025-03-26
Legend
Lines
hit
not hit
Branches
taken
not taken
# not executed
HitTotalCoverage
Lines22100.0%
Functions00-
Branches00-
Each row represents a line of source code
LineBranchHitsSource code
1import 'dart:async';
2
3import 'package:logger/web.dart';
4
5import '../_impl/xplat/_worker_channel.dart'
6 if (dart.library.io) '../_impl/native/_worker_channel.dart'
7 if (dart.library.html) '../_impl/web/_worker_channel.dart'
8 if (dart.library.js) '../_impl/web/_worker_channel.dart'
9 if (dart.library.js_interop) '../_impl/web/_worker_channel.dart' as impl;
10import '../channel.dart';
11import '../typedefs.dart';
12import 'worker.dart';
13import 'worker_request.dart';
14import 'worker_response.dart';
15
16typedef PostRequest = void Function(WorkerRequest req);
17
18/// A [WorkerChannel] supports communication from a platform worker to the
19/// client that posted the [WorkerRequest]. It is used to send [WorkerResponse]
20/// back to the client.
21abstract interface class WorkerChannel {
22 /// Connects the [Channel] with the Squadron [Worker]. [channelInfo] is an
23 /// opaque object than can be deserialized as a [Channel]. This method must
24 /// be called by the worker upon startup.
25 void connect(PlatformChannel channelInfo);
26
27 /// Sends a [WorkerResponse] with the specified data to the worker client.
28 /// This method must be called from the worker only. On Web patforms, this
29 /// version does not check arguments for transferable objects.
30 void reply(dynamic data);
31
32 /// Sends a [WorkerResponse] with the specified data to the worker client.
33 /// This method must be called from the worker only. On Web patforms, this
34 /// version checks arguments for transferable objects.
35 void inspectAndReply(dynamic data);
36
37 /// Sends a [WorkerResponse.log] with the specified data to the worker
38 /// client.
39 void log(LogEvent message);
40
41 /// Checks if [stream] can be streamed back to the worker client.
42 bool canStream(Stream<dynamic> stream);
43
44 /// Sends a [WorkerResponse.closeStream] to the worker client.
45 void closeStream();
46
47 /// Sends a [WorkerResponse] with the specified error to the worker client.
48 void error(Object err, [StackTrace? stacktrace, int? command]);
49
50 /// Deserializes a [Channel] from an opaque [channelInfo].
5110 static WorkerChannel? deserialize(PlatformChannel? channelInfo,
52 [Logger? logger]) =>
5310 impl.deserialize(channelInfo, logger);
54}
Choose Features