Skip to content

Instantly share code, notes, and snippets.

@alexd1971
Created October 16, 2017 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexd1971/229c10bbf1aa11908bb89a6b29591e2d to your computer and use it in GitHub Desktop.
Save alexd1971/229c10bbf1aa11908bb89a6b29591e2d to your computer and use it in GitHub Desktop.
Hybrid test example
import 'package:test/test.dart';
import 'package:stream_channel/stream_channel.dart';
main() {
StreamChannel ch;
setUpAll(() async {
ch = spawnHybridUri('server_start.dart', stayAlive: true);
String message = await ch.stream.first;
print(message);
});
tearDownAll(() {
ch.sink.add('stop');
});
test('test', (){
expect(1, 1);
});
}
import 'package:stream_channel/stream_channel.dart';
hybridMain(StreamChannel ch) {
ch.sink.add('Server ready');
ch.stream.listen((message) {
print(message);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment