Native platforms
In a browser nothing more is needed. On every other platform the engine draws with Flutter GPU, which is turned on once per platform, in the platform's own file.
Why
The switch is not a property of the app's configuration: it is a line in the platform's own project, which the app adds once for each platform it is built for. Without it the engine does not start there: the app runs, and its scenes are their placeholders (see Where scenes do not draw).
Example
<!-- macos/Runner/Info.plist, and the same in ios/Runner/Info.plist -->
<key>FLTEnableFlutterGPU</key>
<true/>
The line for each platform
| Platform | File | Add |
|---|---|---|
| iOS | ios/Runner/Info.plist |
<key>FLTEnableFlutterGPU</key><true/> |
| macOS | macos/Runner/Info.plist |
<key>FLTEnableFlutterGPU</key><true/> |
| Android | android/app/src/main/AndroidManifest.xml, in <application> |
<meta-data android:name="io.flutter.embedding.android.EnableFlutterGPU" android:value="true" /> |
| Linux | linux/runner/my_application.cc, after fl_dart_project_new() |
fl_dart_project_set_enable_flutter_gpu(project, TRUE); |
| Windows | windows/runner/main.cpp, after flutter::DartProject project(L"data"); |
project.set_enable_flutter_gpu(true); |
On Android the line goes inside <application>:
<!-- android/app/src/main/AndroidManifest.xml -->
<application>
<meta-data
android:name="io.flutter.embedding.android.EnableFlutterGPU"
android:value="true" />
</application>
On Linux and Windows it follows the line that makes the project:
// linux/runner/my_application.cc
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_enable_flutter_gpu(project, TRUE);
// windows/runner/main.cpp
flutter::DartProject project(L"data");
project.set_enable_flutter_gpu(true);
What was run
Scenes were seen drawing in a browser and on macOS. The other platforms are set up the same way and were not run. The scene showcase of the framework's repository (example/scene) has all five lines.
See also
- Overview: the setup
- Where scenes do not draw
- Testing: a test has no GPU