LCOV - code coverage report
Current view: top level - src/isolate_factory - web_isolate_factory.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 15 15 100.0 %
Date: 2022-04-21 05:11:43 Functions: 0 0 -

          Line data    Source code
       1             : import 'dart:async';
       2             : 
       3             : import 'package:combine/combine.dart';
       4             : import 'package:combine/src/combine_isolate/web_combine_isolate.dart';
       5             : import 'package:combine/src/isolate_factory/isolate_factory.dart';
       6             : import 'package:combine/src/isolate_messenger/internal_isolate_messenger/web_internal_isolate_messenger.dart';
       7             : 
       8             : class IsolateFactoryImpl extends IsolateFactory {
       9             :   @override
      10           5 :   Future<CombineIsolate> create<T>(
      11             :     IsolateEntryPoint<T> entryPoint, {
      12             :     Map<String, Object?>? argumentsMap,
      13             :     T? argument,
      14             :     String? debugName,
      15             :     bool errorsAreFatal = true,
      16             :   }) async {
      17             :     // Will be closed by [WebIsolateWrapper.kill].
      18             :     // ignore: close_sinks
      19           5 :     final fromIsolate = StreamController<Object?>.broadcast();
      20             :     // ignore: close_sinks
      21           5 :     final toIsolate = StreamController<Object?>.broadcast();
      22           5 :     final toIsolateStream = toIsolate.stream;
      23           5 :     final fromIsolateStream = fromIsolate.stream;
      24             : 
      25           5 :     final isolateMessenger = WebInternalIsolateMessenger(
      26             :       fromIsolateStream,
      27           5 :       toIsolate.sink,
      28             :     );
      29             : 
      30           5 :     final context = IsolateContext(
      31           5 :       messenger: WebInternalIsolateMessenger(
      32             :         toIsolateStream,
      33           5 :         fromIsolate.sink,
      34           5 :       ).toIsolateMessenger(),
      35             :       argument: argument,
      36             :     );
      37             : 
      38             :     /// Schedules [entryPoint] to run after user code is launched.
      39           5 :     await null;
      40           5 :     entryPoint(context);
      41             : 
      42           5 :     return WebCombineIsolate(
      43           5 :       isolateMessenger.toIsolateMessenger(),
      44             :       fromIsolate,
      45             :       toIsolate,
      46             :     );
      47             :   }
      48             : }

Generated by: LCOV version 1.15