LCOV - code coverage report

Current view
top level - src - worker_client.dart
Test
lcov.info
Date
2025-11-17
Legend
Lines
hit
not hit
Branches
taken
not taken
# not executed
HitTotalCoverage
Lines51050.0%
Functions00-
Branches00-
Each row represents a line of source code
LineBranchHitsSource code
1import 'dart:async';
2
3import 'package:cancelation_token/cancelation_token.dart';
4import 'package:using/using.dart';
5
6import 'channel.dart';
7import 'invoker.dart';
8import 'tokens/_squadron_cancelation_token.dart';
9import 'typedefs.dart';
10import 'worker/worker.dart';
11import 'worker/worker_request.dart';
12import 'worker_service.dart';
13
14@Deprecated('Use WorkerClient instead.')
15typedef LocalWorkerClient = WorkerClient;
16
17/// Base class used to communicate with a [Worker] over a [Channel].
18///
19/// Typically, derived classes should add proxy methods sending [WorkerRequest]s to the worker.
20class WorkerClient with Releasable implements WorkerService, Invoker {
21 /// Create a client for a [Worker]. The [channel] passed to this client must have been obtained
22 /// from the target [Worker].
231 WorkerClient(this.channel);
24
25 /// The [Channel] to communicate with the [Worker].
26 final Channel channel;
27
280 @override
29 void release() {
300 channel.close();
310 super.release();
32 }
33
34 /// Sends a command to the [Worker].
351 @override
36 Future<dynamic> send(int command,
37 {List args = const [],
38 CancelationToken? token,
39 bool inspectRequest = false,
40 bool inspectResponse = false}) =>
412 channel.sendRequest(command, args,
420 token: token?.wrap(),
43 inspectRequest: inspectRequest,
44 inspectResponse: inspectResponse);
45
46 /// Sends a streaming command to the [Worker].
471 @override
48 Stream<dynamic> stream(int command,
49 {List args = const [],
50 CancelationToken? token,
51 bool inspectRequest = false,
52 bool inspectResponse = false}) =>
532 channel.sendStreamingRequest(command, args,
540 token: token?.wrap(),
55 inspectRequest: inspectRequest,
56 inspectResponse: inspectResponse);
57
58 /// Local worker clients do not need an [operations] map.
59 @override
60 final OperationsMap operations = WorkerService.noOperations;
61}
Choose Features