LCOV - code coverage report

Current view
top level - src/local_worker - local_worker_client.dart
Test
lcov.info
Date
2024-11-13
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 '../tokens/_squadron_cancelation_token.dart';
8import '../worker/worker_request.dart';
9import '../worker_service.dart';
10import 'local_worker.dart';
11
12/// Base class used to communicate with a [LocalWorker].
13///
14/// Typically, derived classes should add proxy methods sending [WorkerRequest]s to the worker.
15class LocalWorkerClient with Releasable implements WorkerService {
16 /// Create a client for a [LocalWorker]. The [channel] passed to this client must have been obtained by
17 /// calling [Channel.share] on the [LocalWorker.channel].
181 LocalWorkerClient(this.channel);
19
20 /// The [Channel] to communicate with the [LocalWorker].
21 final Channel channel;
22
230 @override
24 void release() {
250 channel.close();
260 super.release();
27 }
28
29 /// Sends a command to the [LocalWorker].
301 Future<dynamic> send(int command,
31 {List args = const [],
32 CancelationToken? token,
33 bool inspectRequest = false,
34 bool inspectResponse = false}) =>
352 channel.sendRequest(command, args,
360 token: token?.wrap(),
37 inspectRequest: inspectRequest,
38 inspectResponse: inspectResponse);
39
40 /// Sends a streaming command to the [LocalWorker].
411 Stream<dynamic> stream(int command,
42 {List args = const [],
43 CancelationToken? token,
44 bool inspectRequest = false,
45 bool inspectResponse = false}) =>
462 channel.sendStreamingRequest(command, args,
470 token: token?.wrap(),
48 inspectRequest: inspectRequest,
49 inspectResponse: inspectResponse);
50
51 /// Local worker clients do not need an [operations] map.
52 @override
53 final Map<int, CommandHandler> operations = WorkerService.noOperations;
54}
Choose Features