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 {
43
43
}
44
44
45
45
class 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;
47
53
// ignore: close_sinks
48
- final _outStream = StreamController < String >() ;
54
+ late final _outStream;
49
55
50
56
@override
51
57
Future <int > get exitCode => _exitCodeCompleter.future;
52
58
53
59
@override
54
60
void init () {
61
+ _exitCodeCompleter = Completer <int >();
62
+ _outStream = StreamController <String >();
55
63
_outStream.sink.add ('xterm.dart demo' );
56
64
_outStream.sink.add ('\r\n ' );
57
65
_outStream.sink.add ('\$ ' );
You can’t perform that action at this time.
0 commit comments