Recebo essa mensagem de erro sempre que faço Run 'main.dart'. Já tentei adicionar o JAVA_HOME como variável do sistema mas sigo recebendo a mesma mensagem de erro;
Launching lib\main.dart on Redmi Note 7 in debug mode... Running Gradle task 'assembleDebug'...
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the location of your Java installation. Exception: Gradle task assembleDebug failed with exit code 1
Após isso, tentei criar o projeto e executar pelo prompt de comando como já ensinado anteriormente, recebo o seguinte erro:
Waiting for another flutter command to release the startup lock... Launching lib\main.dart on Redmi Note 7 in debug mode...
FAILURE: Build failed with an exception.
What went wrong: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1m 25s