If you do not have the JDK software installed or if JAVA_HOME is not set, then Flutter will give this error message.
Read moreWhat version of Java does Flutter use?
Requirements to create Flutter project
Read moreCan you use Java in Flutter?
Flutter uses a flexible system that allows you to call platform-specific APIs in a language that works directly with those APIs: Kotlin or Java on Android.
Read more