The fix to this so that hopefully no one else has to go through this is, in flutter config --jdk-dir even tho in flutter config -h it doesn't say anything about this you can just pass the path to your JDK for example
flutter config --jdk-dir /usr/lib/jvm/java-17-openjdk