# Migrate a Windows project to ensure the window is shown

> How to update a Windows project to ensure the window is shown




:::important
These breaking change docs are accurate, as of the release
under which they are published. Over time, the
workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up
to date as of each release.

这些破坏性改动文档的准确性仅限于其发布时对应的版本。
随着时间的推移，文档中描述的方案可能会逐渐失效。
通常情况下，我们不会在每次发布新版本时都对这些文档进行同步更新。

The [breaking change index file](/release/breaking-changes)
lists the docs created for each release.

[破坏性改动列表](/release/breaking-changes) 
列出了每个版本的文档。

:::


Flutter 3.13 fixed a [bug][] that could result in the window not being shown.
Windows projects created using Flutter 3.7 or Flutter 3.10 need to be migrated
to fix this issue.

[bug]: https://github.com/flutter/flutter/issues/119415

## Migration steps

Verify you are on Flutter version 3.13 or newer using `flutter --version`.
If needed, use `flutter upgrade` to update to the latest version of the
Flutter SDK.

Projects that have not modified their `windows/runner/flutter_window.cpp` file
will be migrated automatically by `flutter run` or `flutter build windows`.

Projects that have modified their `windows/runner/flutter_window.cpp` file might
need to migrate manually.

Code before migration:

```cpp
flutter_controller_->engine()->SetNextFrameCallback([&]() {
  this->Show();
});
```

Code after migration:

```cpp
flutter_controller_->engine()->SetNextFrameCallback([&]() {
  this->Show();
});

// Flutter can complete the first frame before the "show window" callback is
// registered. The following call ensures a frame is pending to ensure the
// window is shown. It is a no-op if the first frame hasn't completed yet.
flutter_controller_->ForceRedraw();
```

## Example

[PR 995][] shows the migration work for the
[Flutter Gallery][] app.

[PR 995]: https://github.com/flutter/gallery/pull/995/files
[Flutter Gallery]: https://flutter-gallery-archive.web.app

