This is a general solution for this type of errors that have appeared with recent android studio and flutter updates.
Modify android>settings.gradle file with this;
id "com.android.application" version "8.3.2" apply false
Modify android>gradle>gradle-wrapper.properties file with this;
distributionUrl=https://services.gradle.org/distributions/gradle-8.4-all.zip