I accidentally deleted the pub-cache in my flutter sdk and now whenever I try to run my flutter app on the web I receive this error:

Finished with error: Invalid argument(s): A directory corresponding to fileSystemPath "/Users/xxxxx/flutter/.pub-cache/hosted/pub.dartlang.org/devtools-0.1.15/build" could not be found

How can I resolve this issue?

I already tried to restore the pub-cache but it doesn't work.

How can I solve this?

Solution 1: Christopher Moore

Use flutter pub cache repair. It should solve the issue. See pub cache for reference.

Solution 2: xcsob

I managed to solve the problem by downloading the flutter sdk again and adding web support.

Solution 3: Victor Ruiz.

I did solve the problem downloading again.

  1. Deleted the SDK folder
  2. Fresh Install of the SDK.