Unexpected child "generate" found under "flutter"

Viewed 1301

Cloning a repo and running command pub get throws this error:

Error detected in pubspec.yaml:

Unexpected child "generate" found under "flutter".

Please correct the pubspec.yaml file at C:\Users\m3\repos\gallery\pubspec.yaml

Screenshot

UPDATE

Running these commands suggested on repository, does NOT solve the error:

C:\Users\m3\repos\fork\gallery>C:\Users\m3\Downloads\flutter_windows_1.20.4-stable\flutter\bin\flutter.bat channel master

C:\Users\m3\repos\fork\gallery>C:\Users\m3\Downloads\flutter_windows_1.20.4-stable\flutter\bin\flutter.bat upgrade

C:\Users\m3\repos\fork\gallery>C:\Users\m3\Downloads\flutter_windows_1.20.4-stable\flutter\bin\flutter.bat channel stable

C:\Users\m3\repos\fork\gallery>C:\Users\m3\Downloads\flutter_windows_1.20.4-stable\flutter\bin\flutter.bat upgrade
3 Answers

A bit late to the party, but I fixed it by upgrading flutter with flutter upgrade.

The error got resolved by running these two commands only:

C:\Users\m3\repos\fork\gallery>C:\Users\m3\Downloads\flutter_windows_1.20.4-stable\flutter\bin\flutter.bat channel master

C:\Users\m3\repos\fork\gallery>C:\Users\m3\Downloads\flutter_windows_1.20.4-stable\flutter\bin\flutter.bat upgrade

Note

Stay in master channel and do NOT return to stable channel, while you're working on this repository.

I think your screenshot tells it all. Where it says on your console "Please correct the pubspec.yaml file at", there looks like an issue you need to fix.

Go to the file, then run pub get. If you see any errors on console, then fix those errors. It's probably a syntax error or an indentation problem with your dependencies.

And also why do you have a generate tag under pubspec? Dart does not support the generate field (https://dart.dev/tools/pub/pubspec).

Remove this field and you should be ok, assuming all the above have been addressed.

Related