Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support inspecting widget tree of multi engine #6640

Open
hyiso opened this issue Nov 2, 2023 · 8 comments
Open

Support inspecting widget tree of multi engine #6640

hyiso opened this issue Nov 2, 2023 · 8 comments
Labels
P3 issues we think are valid but not important screen: inspector

Comments

@hyiso
Copy link

hyiso commented Nov 2, 2023

Currently, when using flutter attach, the widget tree in Flutter Inspector page only shows first engine's widget tree, we can't choose to see widget tree of other engine.

@CoderDake
Copy link
Contributor

CoderDake commented Nov 2, 2023

hi @hyiso what do you mean by other "engine"?
If possible could you post some code here to help us reproduce what you are experiencing?

@hyiso
Copy link
Author

hyiso commented Nov 3, 2023

In my case, there are two Flutter Engines exist at the same time.

The first Flutter Engine shows one Flutter page, and the second Flutter Engine shows another Flutter page

I want to use devtools' inspector page to inspect the widget tree of the second Flutter Engine, but the inspector page only shows the first Flutter Engine's widget tree

I have no idea how to select the second Flutter Engine to inspect

@kenzieschmoll
Copy link
Member

DevTools can only connect to a single Flutter app at a time. If you are running a separate flutter app, this will have its own instance of DevTools to debug with.

How are you opening DevTools?

  • If you are running both of your flutter apps from Command line, each app will have a unique link to DevTools.
  • If you are running both of your flutter apps from VS code, when you switch debug sessions, you'll be able to open DevTools pages for the debug session that is selected. If this is not possible, there may be a bug in the Dart Code VS Code extension @DanTup

@hyiso
Copy link
Author

hyiso commented Nov 4, 2023

These two engines are in one app, in add2app scenario

The DevTools inspector page is opened in browser from VS Code after running flutter attach

There is no other debug session that I can found to select

@DanTup
Copy link
Contributor

DanTup commented Nov 4, 2023

I'm not very familiar with add2app. When we say "two engines" here, do we mean "two Dart VMs" or a single VM with multiple isolates?

If there are two VMs it seems like there should be two VM Service URIs and you could "attach" to each of them from VS Code to get two sessions, although it also feels odd to need two VMs in a single app for two views.

@hyiso
Copy link
Author

hyiso commented Nov 5, 2023

These two engines are created via FlutterEngineGroup, I have not seen any option to select session from VS Code when running flutter attach and opening DevTools

There was only one VM service URI printed to console when entering Flutter page.

The reason why we need two engines is irrelevant here

@nt4f04uNd
Copy link
Member

There is a similar scenario with ContentProvider in my Flutter plugin, which I described here nt4f04uNd/android_content_provider#16 (comment)

@ultraon
Copy link

ultraon commented Nov 7, 2024

I have the same issue. I use add-to-app with a Multi-engine approach/flavor, see https://docs.flutter.dev/add-to-app/multiple-flutters. So, I have android app with 5 bottom bar tabs, 2 of them are FlutterFragments, when I use flutter attach command, I have a properly worked debugger, but when I use Flutter Inspector it shows me the very first Flutter Engine.
As I understand, internally it works as one DartVM and multiple isolates that correlates to multiple FlutterEngines created on the native Android app side.
There is no ability to switch/reconnect Flutter Inspector to the 2nd FlutterEngine in the same android application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 issues we think are valid but not important screen: inspector
Projects
None yet
Development

No branches or pull requests

6 participants