Problem
When developing a Flutter app for iOS and using some packages to embed Youtube videos, Google Maps, or something similar to these ones, you may see the following error message:
Trying to embed a platform view but the PrerollContext does not support embedding
Or:
Trying to embed a platform view but the PaintContext does not support embedding
Solution
To get rid of the mentioned error, what you need to do is just add the following to the <dict> block in your ./ios/Runner/info.plist file:
<key>io.flutter.embedded_views_preview</key>
<true/>
Screenshot of mine:
After that, restart both your iOS simulator and your app (stop it and execute flutter run again). A hot reload with r or a hot restart with R seems not to work.
Further reading:
- Flutter: Avoid `print` calls in production code
- Flutter: GridPaper example
- Using Provider for State Management in Flutter
- Using GetX (Get) for State Management in Flutter
- Flutter Cupertino Button – Tutorial and Examples
- Flutter: Convert UTC Time to Local Time and Vice Versa
You can also take a tour around our Flutter topic page and Dart topic page to see the latest tutorials and examples.