I faced the same issue. If downgrading compileSdkVersion is not an option for you, try Upgrading Android Studio and upgrading Flutter to the latest version It helped me. Below are the versions that worked for me.
Android Studio Ladybug Feature Drop | 2024.2.2
Flutter version - 3.27.1