0

It worked normally when I first created the flutter project and debug the project as soon as I created it. But after creating the second project, syntx errors continue to occur.

I hate the red line

Most error messages are like this

Undefined class 'Key'. Try changing the name to the name of an existing class, or creating a class with the name 'Key'.

Undefined class 'Widget'. Try changing the name to the name of an existing class, or creating a class with the name 'Widget'.

The method 'setState' isn't defined for the type '_MyHomePageState'. Try correcting the name to the name of an existing method, or defining a method named 'setState'.

I just created a project and debug the file..

guricoder
  • 5
  • 5
  • Did you try clean and build? flutter clean may be dart analyzer stopped, close and reopen the vscode. Create project in different directory – Thusitha Deepal Jun 17 '22 at 07:56
  • I uninstalled flutter and reinstalled it from scratch. I thought it was a vscode problem, but i think seems to be the path of the system environment variable – guricoder Jun 17 '22 at 08:41
  • when you create a project folder, it should not have spaces in folder name, sometimes error occurred. after reinstalled does it works? – Thusitha Deepal Jun 17 '22 at 09:41
  • i think it is occured by VSC problem. friday before, i create new Flutter app and run debug mode. it worked clean. but today, boot my notebook and run debug mode, same error and more error message appears. So, i removed all flutter project, reinstall flutter. its works... what the.. – guricoder Jun 20 '22 at 01:09

1 Answers1

0

Do flutter clean then flutter pub get.If it doesn't work please delete and reinstall flutter sdk

Sadhik
  • 304
  • 1
  • 6