Kinda Code
Home/Flutter/Flutter iOS: Trying to embed a platform view but…

Flutter iOS: Trying to embed a platform view but…

Last updated: February 06, 2023

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:

You can also take a tour around our Flutter topic page and Dart topic page to see the latest tutorials and examples.