Skip to content

Commit 20bbd5c

Browse files
committed
The future should be set in setState
1 parent 5041013 commit 20bbd5c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/flutter/lib/src/widgets/window.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ class _RegularWindowState extends State<RegularWindow> {
113113
@override
114114
void initState() {
115115
super.initState();
116-
_future = createRegular(size: widget._preferredSize);
117-
_future!.then((WindowCreationResult metadata) async {
116+
final Future<WindowCreationResult> createRegularFuture =
117+
createRegular(size: widget._preferredSize);
118+
setState(() => _future = createRegularFuture);
119+
120+
createRegularFuture.then((WindowCreationResult metadata) async {
118121
if (widget.controller != null) {
119122
widget.controller!.view = metadata.flView;
120123
widget.controller!.parentViewId = metadata.parent;

0 commit comments

Comments
 (0)