Unable to run new flutter sample code in IntelliJ IDEA

2,697

Solution 1

It sounds like IntelliJ is configured to run as a Dart command line app instead of a Flutter app. Edit configurations and remove any configurations that look like "Dart Command Line App". Then create a new one for a Flutter app.

Solution 2

Click the name of the test, and choose "Edit configurations" You'll (probably) notice that the run config is under 'dart' rather than 'flutter test'

Delete this one, create a new one (using the plus button) under 'Flutter Test' and choose / run this manually.

(Also, you need to have the tests in a folder called 'test' at the same level (e.g. as a sister to) the lib folder, and follow the naming convention '*_test.dart' for all tests.)

Happy coding!

Share:
2,697
Naveen Cherian
Author by

Naveen Cherian

Updated on December 02, 2022

Comments

  • Naveen Cherian
    Naveen Cherian over 1 year

    I installed IntelliJ IDEA, downloaded both the flutter and dart plugins, Installed android studio and jdk . I opened configured IntelliJ IDEA to point at the android sdk and jdk.
    I opened up IntelliJ IDEA and created new project->flutter. I clicked on build and got an error message.

    I am using Ubuntu 16.04 64 bit system

    I ran Flutter Doctor and confirmed that i got nothing new or missing installation. The message at debugger is as shown

    The built-in library 'dart:ui' is not available on the stand-alone VM. 
    library handler failed export 'dart:ui' show Locale
    Process finished with exit code 254 Failed to connect to the VM observatory service: java.io.IOException: Failed to connect: ws://127.0.0.1:46579/ws Caused by: de.roderick.weberknecht.WebSocketException: error while creating socket to ws://127.0.0.1:46579/ws Caused by: java.net.ConnectException: Connection refused
    

    Standard new flutter project code with output

    Debugger output which i copy pasted

  • eyoeldefare
    eyoeldefare almost 6 years
    So you create a new project every time?
  • lordvcs
    lordvcs almost 6 years
    @EyoelD This may not be the best option, but it worked for me, and this was when flutter was still in beta.
  • Tony
    Tony over 5 years
    Searching for ages, and this was the answer... thanks!