Sometimes, this problem is caused by issues in the pubspec.lock file after a merge. I usually solve it by:
Deleting the pubspec.lock file.
pubspec.lock
Running flutter pub get
flutter pub get
This will recreate the file correctly and should resolve the issue.