How can I use performance profiling with a Flutter add-to-app app using Flutter Attach?

791 views Asked by At

I have a Flutter app that I've added to an existing Android app. I'm trying to profile this app, but my issue is that I can't seem to maintain profile mode and also use Flutter Attach to actually view the Flutter DevTools window. My process is as follows -- select 'Profile app' from Android Studio. App starts in profiling mode. Then I close the app, start Flutter Attach from Android Studio, and re-open the app so Flutter Attach connects. However at this point it says 'Syncing files to [Device name]...' and when that's done, I can open the DevTools but it's back in debug mode. The same happens if I start up Flutter Attach waiting for a connection and then start the profiling mode, it seems to be the process of attaching and syncing files that puts it into debug mode. But I could be missing something. (The fact that I have to restart the app in order for Flutter Attach to see it is also weird, and possibly related I guess)

1

There are 1 answers

0
mosh.jinton On BEST ANSWER

Mostly solved -- simply using flutter attach --profile in the command line will keep the app in profile mode and allow you to open Dev Tools in the browser. However, I'm still unsure if it is possible to use the --profile option in when starting Flutter Attach from Android Studio, which would allow Android Studio's performance windows to be used, which seem better than the browser ones.