[roll] Update third-party dart packages

Roller-URL: https://ci.chromium.org/b/8813904866103579809
Roller-Owners: chaselatta@google.com, godofredoc@google.com
Cq-Cl-Tag: roller-builder:flutter-with-deps-roller
Cq-Cl-Tag: roller-bid:8813904866103579809
CQ-Do-Not-Cancel-Tryjobs: true
Change-Id: If3fdaff076c9686e2998ccd0356d586e9371f7fd
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/dart-pkg/+/680404
Commit-Queue: GI Roller <global-integration-roller@fuchsia-infra.iam.gserviceaccount.com>
diff --git a/mockito/BUILD.gn b/mockito/BUILD.gn
index 1364223..2badd43 100644
--- a/mockito/BUILD.gn
+++ b/mockito/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by package_importer.py for mockito-5.1.0
+# This file is generated by package_importer.py for mockito-5.2.0
 
 import("//build/dart/dart_library.gni")
 
diff --git a/mockito/CHANGELOG.md b/mockito/CHANGELOG.md
index a70a770..8c4c089 100644
--- a/mockito/CHANGELOG.md
+++ b/mockito/CHANGELOG.md
@@ -1,3 +1,10 @@
+## 5.2.0
+
+* Fix generation of methods with return type of `FutureOr<T>` for generic,
+  potentially nullable `T`.
+* Support `@GenerateMocks` annotations on `import` and `export` directives.
+* Support analyzer 4.x.
+
 ## 5.1.0
 
 * In creating mocks for a pre-null-safe library, opt out of null safety in the
@@ -23,7 +30,7 @@
 * Do not needlessly implement `toString` unless the class-to-mock implements
   `toString` with additional parameters.
   [#461](https://github.com/dart-lang/mockito/issues/461)
-* Support analyzer 3.x
+* Support analyzer 3.x.
 
 ## 5.0.16
 
@@ -65,7 +72,7 @@
 * Override `toString` in a Fake implementation when the class-to-be-faked has
   a superclass which overrides `toString` with additional parameters.
   [#371](https://github.com/dart-lang/mockito/issues/371)
-* Support analyzer 2.0.0
+* Support analyzer 2.x.
 
 ## 5.0.11
 
diff --git a/mockito/lib/annotations.dart b/mockito/lib/annotations.dart
index 280db40..b2c1504 100644
--- a/mockito/lib/annotations.dart
+++ b/mockito/lib/annotations.dart
@@ -88,11 +88,12 @@
   /// override member, unless the member is specified in [unsupportedMembers],
   /// or a fallback implementation is given in [fallbackGenerators].
   ///
-  /// If [unsupportedMembers] contains the name of each such member, the mock
-  /// class is generated with an override, with throws an exception, for each
-  /// member with a non-nullable unknown return type. Such an override cannot be
-  /// used with the mockito stubbing and verification APIs, but makes the mock
-  /// class a valid implementation of the class-to-mock.
+  /// For each member M in [unsupportedMembers], the mock class will have an
+  /// override that throws, which may be useful if the return type T of M is
+  /// non-nullable and it's inconvenient to define a fallback generator for M,
+  /// e.g. if T is an unknown type variable. Such an override cannot be used
+  /// with the mockito stubbing and verification APIs, but makes the mock class
+  /// a valid implementation of the class-to-mock.
   ///
   /// Each entry in [fallbackGenerators] specifies a mapping from a method name
   /// to a function, with the same signature as the method. This function is
diff --git a/mockito/lib/src/builder.dart b/mockito/lib/src/builder.dart
index 9d67262..14e157d 100644
--- a/mockito/lib/src/builder.dart
+++ b/mockito/lib/src/builder.dart
@@ -16,6 +16,7 @@
 
 import 'package:analyzer/dart/constant/value.dart';
 import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/nullability_suffix.dart';
 import 'package:analyzer/dart/element/type.dart' as analyzer;
 import 'package:analyzer/dart/element/type_provider.dart';
 import 'package:analyzer/dart/element/type_system.dart';
@@ -395,13 +396,18 @@
   ) {
     final mockTargets = <_MockTarget>{};
 
-    for (final element in entryLib.topLevelElements) {
+    final possiblyAnnotatedElements = [
+      ...entryLib.exports,
+      ...entryLib.imports,
+      ...entryLib.topLevelElements,
+    ];
+
+    for (final element in possiblyAnnotatedElements) {
       // TODO(srawlins): Re-think the idea of multiple @GenerateMocks
       // annotations, on one element or even on different elements in a library.
       for (final annotation in element.metadata) {
         if (annotation.element is! ConstructorElement) continue;
         final annotationClass = annotation.element!.enclosingElement!.name;
-        // TODO(srawlins): check library as well.
         if (annotationClass == 'GenerateMocks') {
           mockTargets
               .addAll(_mockTargetsFromGenerateMocks(annotation, entryLib));
@@ -1609,7 +1615,8 @@
       return TypeReference((b) {
         b
           ..symbol = type.element.name
-          ..isNullable = forceNullable || typeSystem.isPotentiallyNullable(type)
+          ..isNullable = forceNullable ||
+              type.nullabilitySuffix == NullabilitySuffix.question
           ..url = _typeImport(type.element)
           ..types.addAll(type.typeArguments.map(_typeReference));
       });
diff --git a/mockito/lib/src/version.dart b/mockito/lib/src/version.dart
index 6347bc3..9c84309 100644
--- a/mockito/lib/src/version.dart
+++ b/mockito/lib/src/version.dart
@@ -1 +1 @@
-const packageVersion = '5.1.0';
+const packageVersion = '5.2.0';
diff --git a/mockito/pubspec.yaml b/mockito/pubspec.yaml
index c645183..91ce991 100644
--- a/mockito/pubspec.yaml
+++ b/mockito/pubspec.yaml
@@ -1,16 +1,15 @@
 name: mockito
-version: 5.1.0
-
+version: 5.2.0
 description: >-
   A mock framework inspired by Mockito with APIs for Fakes, Mocks,
   behavior verification, and stubbing.
-homepage: https://github.com/dart-lang/mockito
+repository: https://github.com/dart-lang/mockito
 
 environment:
   sdk: '>=2.12.0-0 <3.0.0'
 
 dependencies:
-  analyzer: '>=2.1.0 <4.0.0'
+  analyzer: '>=2.1.0 <5.0.0'
   build: '>=1.3.0 <3.0.0'
   code_builder: ^4.0.0
   collection: ^1.15.0