flutter/examples/flutter_view
Loïc Sharma ce61eda70c
[Windows] Ensure window is shown (#127046)
## Background

The Windows runner has a race at startup:

1. **Platform thread**: creates a hidden window
2. **Platform thread**: launches the Flutter engine
3. **UI/Raster threads**: renders the first frame
4. **Platform thread**: Registers a callback to show the window once the next frame has been rendered.

Steps 3 and 4 happen in parallel and it is possible for step 3 to complete before step 4 starts. In this scenario, the next frame callback is never called and the window is never shown.

As a result the `windows_startup_test`'s test, which [verifies that the "show window" callback is called](1f09a8662d/dev/integration_tests/windows_startup_test/windows/runner/flutter_window.cpp (L60-L64)), can flake if the first frame is rendered before the show window callback has been registered.

## Solution

This change makes the runner schedule a frame after it registers the next frame callback. If step 3 hasn't completed yet, this no-ops as a frame is already scheduled. If step 3 has already completed, a new frame will be rendered, which will call the next frame callback and show the window.

Part of https://github.com/flutter/flutter/issues/119415

See this thread for alternatives that were considered: https://github.com/flutter/engine/pull/42061#issuecomment-1550080722
2023-05-19 22:25:55 +00:00
..
android Fix warning in flutter created project ("package attribute is deprecated" in AndroidManifest) (#123426) 2023-03-29 04:21:03 +00:00
assets Add flutter_view sample (#8486) 2017-03-09 12:53:01 +01:00
ios Migrate Xcode projects last version checks to Xcode 14.3 (#125827) 2023-05-02 00:06:33 +00:00
lib Prepare examples for use_super_parameters (#100514) 2022-03-29 12:53:08 -07:00
macos Migrate Xcode projects last version checks to Xcode 14.3 (#125827) 2023-05-02 00:06:33 +00:00
windows [Windows] Ensure window is shown (#127046) 2023-05-19 22:25:55 +00:00
.metadata Update outdated platform directories in examples (#91125) 2021-10-05 14:52:11 -07:00
pubspec.yaml Upgrade leak_tracker to 5.0.0 (#126367) 2023-05-16 04:39:26 +00:00
README.md ✒ Spell Check All .md Files Related to Flutter 💙 (#61564) 2020-07-22 18:23:47 -07:00

Example of embedding Flutter using FlutterView

This project demonstrates how to embed Flutter within an iOS or Android application. On iOS, the iOS and Flutter components are built with Xcode. On Android, the Android and Flutter components are built with Android Studio or Gradle.

You can read more about accessing platform and third-party services in Flutter.

iOS

You can open ios/Runner.xcworkspace in Xcode and build the project as usual.

Android

You can open android/ in Android Studio and build the project as usual.