question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[proposal] Provide a way to call `FlutterSdk.flutterRun` in non paused state

See original GitHub issue

Steps to Reproduce

I’m building a IntelliJ plugin which depends on this Flutter plugin to execute some Flutter commands. I’m using the FlutterSdk.flutterRun method to run the opened project and everything works fine. However I noticed that when I run on a device (Android, web or MacOS) in debug mode, the app is started in paused mode: it builds the app on the device, but I get a blank app (the Flutter UI is not rendered).

After some investigation I notice that the method I’m using is adding the --start-paused option automatically:

https://github.com/flutter/flutter-intellij/blob/f21250eaedeed48397c24cddef7d30c75ad19db1/src/io/flutter/sdk/FlutterSdk.java#L277-L279

Proposal

Provide a way to prevent this flag of being passed automatically.

Version info

flutter run -v
[✓] Flutter (Channel stable, 2.0.6, on macOS 11.2.3 20D91 darwin-x64, locale en-AO)
    • Flutter version 2.0.6 at /Users/pedromassango/Code/flutter_stable
    • Framework revision 1d9032c7e1 (5 days ago), 2021-04-29 17:37:58 -0700
    • Engine revision 05e680e202
    • Dart version 2.12.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/pedromassango/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/pedromassango/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Community Edition (version 2021.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 55.1.5
    • Dart plugin version 211.7179

[✓] VS Code (version 1.55.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[✓] Connected device (3 available)
    • Redmi 5 Plus (mobile) • 0258ff700005 • android-arm64  • Android 8.1.0 (API 27)
    • macOS (desktop)       • macos        • darwin-x64     • macOS 11.2.3 20D91 darwin-x64
    • Chrome (web)          • chrome       • web-javascript • Google Chrome 90.0.4430.93

• No issues found!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
stevemessickcommented, May 5, 2021

Using profile mode might work, but Bazel projects could have some unintended side-effect – I’m not an expert on that. (I’m not sure how common Bazel is outside Google, but it is common within the company.) @helin24 might know more about Bazel. Using profile mode will cause your app to run in profile mode on the device, which may or may not be what you want.

You’d need to look at how RunMode.PROFILE is used, and trace back those dependencies to understand how to add a new kind of RunMode. You may not need to change flutterRun() at all.

0reactions
helin24commented, May 6, 2021

Note: another reason we use start paused mode for run is because there are some cases where early errors aren’t caught and displayed if the plugin hasn’t started listening to certain streams yet at the time the app starts.

If you want to put together your change I can test it out for the Bazel projects. I’m not clear on how your changes will flow through to Bazel yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[web] Debug mode is paused when launched from IntelliJ ...
Hi, I am developing a flutter web application using Android Studio. ... there may be misleading, it only calls that if not starting...
Read more >
How to execute code before app exit flutter - Stack Overflow
The flutter terminal will no longer receive any messages after the application is abruptly closed. ②When the root page on the Flutter side ......
Read more >
Flutter for Android developers
Flutter is a new way to build UIs for mobile, but it has a plugin system to communicate with Android (and iOS) for...
Read more >
Contributing to Flutter - Google Git
The pre-built flutter tool runs in release mode with the observatory off by default. To enable debugging mode and the observatory on the...
Read more >
Setup Guide Flutter Wikitude SDK Flutter 9.10.0 Documentation
You will have to add this ArchitectWidget object in your overridden build() method, as any other Flutter widget. Override the didChangeAppLifecycleState() ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found