LCOV - code coverage report

Current view
top level - src/worker - worker_channel.dart
Test
lcov.info
Date
2024-11-13
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_interop) '../_impl/web/_worker_channel.dart' as impl;
9import '../channel.dart';
10import '../typedefs.dart';
11import 'worker.dart';
12import 'worker_request.dart';
13import 'worker_response.dart';
14
15typedef PostRequest = void Function(WorkerRequest req);
16
17/// A [WorkerChannel] supports communication from a platform worker to the
18/// client that posted the [WorkerRequest]. It is used to send [WorkerResponse]
19/// back to the client.
20abstract interface class WorkerChannel {
21 /// Connects the [Channel] with the Squadron [Worker]. [channelInfo] is an
22 /// opaque object than can be deserialized as a [Channel]. This method must
23 /// be called by the worker upon startup.
24 void connect(PlatformChannel channelInfo);
25
26 /// Sends a [WorkerResponse] with the specified data to the worker client.
27 /// This method must be called from the worker only. On Web patforms, this
28 /// version does not check arguments for transferable objects.
29 void reply(dynamic data);
30
31 /// Sends a [WorkerResponse] with the specified data to the worker client.
32 /// This method must be called from the worker only. On Web patforms, this
33 /// version checks arguments for transferable objects.
34 void inspectAndReply(dynamic data);
35
36 /// Sends a [WorkerResponse.log] with the specified data to the worker
37 /// client.
38 void log(LogEvent message);
39
40 /// Checks if [stream] can be streamed back to the worker client.
41 bool canStream(Stream<dynamic> stream);
42
43 /// Sends a [WorkerResponse.closeStream] to the worker client.
44 void closeStream();
45
46 /// Sends a [WorkerResponse] with the specified error to the worker client.
47 void error(Object err, [StackTrace? stacktrace, int? command]);
48
49 /// Deserializes a [Channel] from an opaque [channelInfo].
509 static WorkerChannel? deserialize(PlatformChannel? channelInfo,
51 [Logger? logger]) =>
529 impl.deserialize(channelInfo, logger);
53}
Choose Features