When we download a Flutter package it creates a Flutter package folder.
What worked for me is
- Go to the downloaded flutter package folder and then go to the given path - "packages\flutter_tools\gradle"
- Delete the build folder
- open the project in android studio the gradle files will start downloading.
After everything is successful just run the project from the editor. It will work