The named parameter 'colors' isn't defined.flutter

Viewed 4874

i am using gradient for my custom button when i want to pass gradient color to it, it shows error that says

The named parameter 'colors' isn't defined.

how can i fix it?

enter image description here

3 Answers

Try to restart the Analysis Dart Server.

Ctrl + Shift + P on Windows, Cmd + Shift + P on Macos opens the command palette if you use VS Code.

Then run Dart: Restart Analysis Server.

Clean your project by pressing flutter clean command.

Close the IDE and restart it. And this issue will be solved

You can try restarting the IDE. It will mostly fix the issue.

Files -> Restart and Invalidate Cache

Related