I solved similar problem by running following commands on terminal:
1- "flutter clean"
2- "rm pubspec.lock"
3- "flutter pub get"
(