File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -10,15 +10,22 @@ import 'dart:async';
10
10
import 'package:http/browser_client.dart' ;
11
11
import 'package:http/http.dart' as http;
12
12
import 'package:http/http.dart' ;
13
+ import 'package:stream_channel/stream_channel.dart' ;
13
14
import 'package:test/test.dart' ;
14
15
15
16
import 'utils.dart' ;
16
17
18
+ extension on StreamChannel <dynamic > {
19
+ /// Handles the Wasm case where the runtime type is actually [double] instead
20
+ /// of the JS case where its [int] .
21
+ Future <int > get firstAsInt async => ((await stream.first) as num ).toInt ();
22
+ }
23
+
17
24
void main () {
18
25
late Uri url;
19
26
setUp (() async {
20
27
final channel = spawnHybridUri (Uri (path: '/test/stub_server.dart' ));
21
- var port = await ( channel.stream.first as num ). toInt () ;
28
+ var port = await channel.firstAsInt ;
22
29
url = echoUrl.replace (port: port);
23
30
});
24
31
You can’t perform that action at this time.
0 commit comments