I need to pass parameters to flutter app hosted inside html page, as explained here:
https://docs.flutter.dev/deployment/web#embedding-a-flutter-app-into-an-html-page
Important: for performance and architectural reasons it is not iFrame, it is direct embedding.
Is there a way to do it, either with route parameters or command line arguments or somehow differently?
2
Answers
To enable passing parameters through direct embedding, the Flutter app should be made multi-view. Example: https://github.com/ditman/flutter-experimental/blob/main/multi_counter/web/flutter_bootstrap.js#L36
Yes, it is possible to pass parameters to a Flutter app embedded into an HTML page. You can achieve this by using the window.defaultRouteName property and the PlatformDispatcher.instance.defaultRouteName in Flutter. Here is a summary of how to do it: