File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -43,15 +43,23 @@ class MyHomePage extends StatefulWidget {
4343}
4444
4545class FakeTerminalBackend extends TerminalBackend {
46- final _exitCodeCompleter = Completer <int >();
46+ // we do a late initialization of those backend members as the backend gets
47+ // transferred into the Isolate.
48+ // It is not allowed to e.g. transfer closures which we can not guarantee
49+ // to not exist in our member types.
50+ // The Isolate will call init() once it starts (from its context) and that is
51+ // the place where we initialize those members
52+ late final _exitCodeCompleter;
4753 // ignore: close_sinks
48- final _outStream = StreamController < String >() ;
54+ late final _outStream;
4955
5056 @override
5157 Future <int > get exitCode => _exitCodeCompleter.future;
5258
5359 @override
5460 void init () {
61+ _exitCodeCompleter = Completer <int >();
62+ _outStream = StreamController <String >();
5563 _outStream.sink.add ('xterm.dart demo' );
5664 _outStream.sink.add ('\r\n ' );
5765 _outStream.sink.add ('\$ ' );
You can’t perform that action at this time.
0 commit comments