This error was also causing an issue "cannot find declaration to go to"
After doing a flutter upgrade, I had to do the following:- Close IntelliJ
 - delete the project's .idea folder and any *.iml files
 - Reopen the project in intellij
 
If that doesn't work try File -> Invalidate caches / restart and repeat the steps above