Last active
June 25, 2019 14:51
-
-
Save aam/5532a5fff95555fe1ab5e4ca66bea043 to your computer and use it in GitHub Desktop.
Check if flutter testWidgets supports multiple isolates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:isolate'; | |
import 'package:flutter_test/flutter_test.dart'; | |
void main() { | |
testWidgets('Headers', (WidgetTester tester) async { | |
final Completer<String> completer = Completer<String>(); | |
final RawReceivePort receivePort = RawReceivePort((dynamic message) { | |
print('received message $message'); | |
completer.complete(message); | |
}); | |
await Isolate.spawn(f, [[123], receivePort.sendPort]); | |
expect(await completer.future, equals('abc')); | |
receivePort.close(); | |
}, skip: isBrowser); | |
} | |
void f(List<dynamic> params) { | |
final List<int> l = params[0]; | |
final SendPort s = params[1]; | |
print('Received $l'); | |
s.send('abc'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This test never finishes and prints the following:
So await at line 15 never seems to get completer completed.