Megidd
Megidd

Reputation: 7961

Unexpected child "generate" found under "flutter"

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

Upvotes: 6

Views: 1682

Answers (3)

Caleb Robinson
Caleb Robinson

Reputation: 1120

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

Upvotes: 5

Megidd
Megidd

Reputation: 7961

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.

Upvotes: 3

Dan Gerchcovich
Dan Gerchcovich

Reputation: 525

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.

Upvotes: 0

Related Questions