`flutter pub update` didn't update my packages?

pub.dev warned me that one of my packages wasn't correctly overriding a method. It even gave me a -20 points to health.

line 118 col 9: 'MockCollectionReference.where' ('Query Function(dynamic, {arrayContains: dynamic, isEqualTo: dynamic, isGreaterThan: dynamic, isGreaterThanOrEqualTo: dynamic, isLessThan: dynamic, isLessThanOrEqualTo: dynamic, isNull: bool})') isn't a valid override of 'Query.where' ('Query Function(dynamic, {arrayContains: dynamic, arrayContainsAny: List

But when I navigated to the Query.where function, by clicking on one of the calls to the method in my unit tests, it redirected me to:

This is exactly what I was overriding. So why the error?

However, looking at the code for cloud_firestore on GitHub (cloud_firestore/lib/src/query.dart#L121), the signature had indeed changed to:

Query where(
    dynamic field, {
    dynamic isEqualTo,
    dynamic isLessThan,
    dynamic isLessThanOrEqualTo,
    dynamic isGreaterThan,
    dynamic isGreaterThanOrEqualTo,
    dynamic arrayContains,
    List<dynamic> arrayContainsAny,
    List<dynamic> whereIn,
    bool isNull,
})

Checking versions on https://pub.dev/packages/cloud_firestore/versions, it looked like the latest version is 0.12.11. But even after running flutter pub get on my machine, it won't update to 0.12.11. What's going on?

The .packages file confirms this. It contains this line:

cloud_firestore:file:///Users/myself/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.10/lib/

I eventually found the answer at https://dart.dev/guides/packages#upgrading-a-dependency. It turns out, pub get downloads the most up to date packages, then freezes them in a file called pubspec.lock. To force updates later, you have to run pub upgrade instead of pub get.

This works the same in flutter. I ran flutter pub upgrade and it indeed upgraded cloud_firestore, and VSC finally showed me the same error as pub.dev's tests: