[pigeon] Require analyzer 5.13.0, prepare for NamedType refactoring. (#4127)

We would like to make a breaking change to the Dart analyzer.
https://dart-review.googlesource.com/c/sdk/+/303280

https://github.com/flutter/flutter/issues/128212

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md
index fe7793e..e48f0ee 100644
--- a/packages/pigeon/CHANGELOG.md
+++ b/packages/pigeon/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 10.0.1
+
+* Requires `analyzer 5.13.0` and replaces use of deprecated APIs.
+
 ## 10.0.0
 
 * [swift] Avoids using `Any` to represent `Optional` in Swift.
diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart
index 7508c56..f7b0fc0 100644
--- a/packages/pigeon/lib/generator_tools.dart
+++ b/packages/pigeon/lib/generator_tools.dart
@@ -11,7 +11,7 @@
 /// The current version of pigeon.
 ///
 /// This must match the version in pubspec.yaml.
-const String pigeonVersion = '10.0.0';
+const String pigeonVersion = '10.0.1';
 
 /// Read all the content from [stdin] to a String.
 String readStdin() {
diff --git a/packages/pigeon/lib/pigeon_lib.dart b/packages/pigeon/lib/pigeon_lib.dart
index 1ef6e8a..09ea913 100644
--- a/packages/pigeon/lib/pigeon_lib.dart
+++ b/packages/pigeon/lib/pigeon_lib.dart
@@ -1004,10 +1004,7 @@
     final dart_ast.NamedType? namedType =
         getFirstChildOfType<dart_ast.NamedType>(parameter);
     if (namedType != null) {
-      // TODO(stuartmorgan): Replace `name` when adopting the next version of
-      // analyzer.
-      // ignore: deprecated_member_use
-      final String argTypeBaseName = namedType.name.name;
+      final String argTypeBaseName = _getNamedTypeQualifiedName(namedType);
       final bool isNullable = namedType.question != null;
       final List<TypeDeclaration> argTypeArguments =
           typeAnnotationsToTypeArguments(namedType.typeArguments);
@@ -1089,10 +1086,7 @@
         Method(
           name: node.name.lexeme,
           returnType: TypeDeclaration(
-              // TODO(stuartmorgan): Replace `name` when adopting the next
-              // version of analyzer.
-              // ignore: deprecated_member_use
-              baseName: returnType.name.name,
+              baseName: _getNamedTypeQualifiedName(returnType),
               typeArguments:
                   typeAnnotationsToTypeArguments(returnType.typeArguments),
               isNullable: returnType.question != null),
@@ -1141,10 +1135,7 @@
       for (final Object x in typeArguments.childEntities) {
         if (x is dart_ast.NamedType) {
           result.add(TypeDeclaration(
-              // TODO(stuartmorgan): Replace `name` when adopting the next
-              // version of analyzer.
-              // ignore: deprecated_member_use
-              baseName: x.name.name,
+              baseName: _getNamedTypeQualifiedName(x),
               isNullable: x.question != null,
               typeArguments: typeAnnotationsToTypeArguments(x.typeArguments)));
         }
@@ -1174,10 +1165,7 @@
           final dart_ast.TypeArgumentList? typeArguments = type.typeArguments;
           _currentClass!.fields.add(NamedType(
             type: TypeDeclaration(
-              // TODO(stuartmorgan): Replace `name` when adopting the next
-              // version of analyzer.
-              // ignore: deprecated_member_use
-              baseName: type.name.name,
+              baseName: _getNamedTypeQualifiedName(type),
               isNullable: type.question != null,
               typeArguments: typeAnnotationsToTypeArguments(typeArguments),
             ),
@@ -1223,6 +1211,14 @@
     node.visitChildren(this);
     return null;
   }
+
+  static String _getNamedTypeQualifiedName(dart_ast.NamedType node) {
+    final dart_ast.ImportPrefixReference? importPrefix = node.importPrefix;
+    if (importPrefix != null) {
+      return '${importPrefix.name.lexeme}.${node.name2.lexeme}';
+    }
+    return node.name2.lexeme;
+  }
 }
 
 int? _calculateLineNumberNullable(String contents, int? offset) {
diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml
index 26b6465..a4284b0 100644
--- a/packages/pigeon/pubspec.yaml
+++ b/packages/pigeon/pubspec.yaml
@@ -2,13 +2,13 @@
 description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
 repository: https://github.com/flutter/packages/tree/main/packages/pigeon
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon
-version: 10.0.0 # This must match the version in lib/generator_tools.dart
+version: 10.0.1 # This must match the version in lib/generator_tools.dart
 
 environment:
-  sdk: ">=2.18.0 <4.0.0"
+  sdk: ">=2.19.0 <4.0.0"
 
 dependencies:
-  analyzer: "^5.2.0"
+  analyzer: "^5.13.0"
   args: ^2.1.0
   collection: ^1.15.0
   meta: ^1.7.0