Update to latest lints, require Dart ^3.1 (dart-lang/markdown#568)

diff --git a/pkgs/markdown/.github/workflows/test-package.yml b/pkgs/markdown/.github/workflows/test-package.yml
index 381cde9..57383f4 100644
--- a/pkgs/markdown/.github/workflows/test-package.yml
+++ b/pkgs/markdown/.github/workflows/test-package.yml
@@ -47,7 +47,7 @@
       matrix:
         # Add macos-latest and/or windows-latest if relevant for this package.
         os: [ubuntu-latest]
-        sdk: [2.19.0, dev]
+        sdk: [3.1, dev]
     steps:
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
       - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
diff --git a/pkgs/markdown/CHANGELOG.md b/pkgs/markdown/CHANGELOG.md
index 3cd2f7a..5fcfd57 100644
--- a/pkgs/markdown/CHANGELOG.md
+++ b/pkgs/markdown/CHANGELOG.md
@@ -1,5 +1,6 @@
 ## 7.1.2-wip
 
+* Require Dart `^3.1.0`.
 * Update all CommonMark specification links to 0.30.
 * Fix beginning of line detection in `AutolinkExtensionSyntax`. 
 
diff --git a/pkgs/markdown/analysis_options.yaml b/pkgs/markdown/analysis_options.yaml
index 124348f..1604ff0 100644
--- a/pkgs/markdown/analysis_options.yaml
+++ b/pkgs/markdown/analysis_options.yaml
@@ -11,6 +11,8 @@
     # The example app explicitly takes a String of user-generated HTML and
     # inserts it straight into a <div> using innerHtml.
     unsafe_html: ignore
+    # Waiting on a couple of bug fixes and new features before this should be enabled
+    comment_references: ignore
 
 linter:
   rules:
@@ -25,15 +27,11 @@
     - missing_whitespace_between_adjacent_strings
     - no_adjacent_strings_in_list
     - package_api_docs
-    - prefer_const_constructors
     - prefer_const_declarations
     - prefer_final_locals
     - prefer_final_in_for_each
-    - prefer_relative_imports
-    - test_types_in_equals
     - unnecessary_await_in_return
     - unnecessary_raw_strings
     - use_if_null_to_convert_nulls_to_bools
     - use_raw_strings
     - use_string_buffers
-    - use_super_parameters
diff --git a/pkgs/markdown/pubspec.yaml b/pkgs/markdown/pubspec.yaml
index 387a667..6ddea8f 100644
--- a/pkgs/markdown/pubspec.yaml
+++ b/pkgs/markdown/pubspec.yaml
@@ -11,7 +11,7 @@
   markdown:
 
 environment:
-  sdk: '>=2.19.0 <3.0.0'
+  sdk: ^3.1.0
 
 dependencies:
   args: ^2.0.0
@@ -20,11 +20,11 @@
 dev_dependencies:
   build_runner: ^2.0.5
   build_version: ^2.0.3
-  build_web_compilers: '>=3.0.0 <5.0.0'
+  build_web_compilers: ^4.0.0
   collection: ^1.15.0
-  dart_flutter_team_lints: ^1.0.0
+  dart_flutter_team_lints: ^2.0.0
   html: ^0.15.0
-  http: '>=0.13.5 <2.0.0'
+  http: ^1.0.0
   io: ^1.0.0
   js: ^0.6.3
   path: ^1.8.0
diff --git a/pkgs/markdown/tool/expected_output.dart b/pkgs/markdown/tool/expected_output.dart
index b50adb0..aa7bab3 100644
--- a/pkgs/markdown/tool/expected_output.dart
+++ b/pkgs/markdown/tool/expected_output.dart
@@ -92,11 +92,10 @@
   return results;
 }
 
-/// Parse and yield data cases (each a [DataCase]) from the directory containing
-/// [library], optionally under [subdirectory].
+/// Parse and yield data cases (each a [DataCase]) from [testDirectory].
 ///
 /// By default, only read data cases from files with a `.unit` extension. Data
-/// cases are read from files located immediately in [directory], or
+/// cases are read from files located immediately in [testDirectory], or
 /// recursively, according to [recursive].
 ///
 /// The typical use case of this method is to declare a library at the top of a
diff --git a/pkgs/markdown/tool/stats.dart b/pkgs/markdown/tool/stats.dart
index 4f952bb..67b1d39 100644
--- a/pkgs/markdown/tool/stats.dart
+++ b/pkgs/markdown/tool/stats.dart
@@ -179,26 +179,11 @@
 
 Object? _convert(Object? obj) {
   if (obj is CompareLevel) {
-    switch (obj) {
-      case CompareLevel.strict:
-        return 'strict';
-      case CompareLevel.error:
-        return 'error';
-      case CompareLevel.fail:
-        return 'fail';
-      case CompareLevel.loose:
-        return 'loose';
-      default:
-        throw ArgumentError('`$obj` is unknown.');
-    }
+    return obj.name;
   }
   if (obj is Map) {
-    final map = <String, Object?>{};
-    obj.forEach((k, v) {
-      final newKey = k.toString();
-      map[newKey] = v;
-    });
-    return map;
+    return obj
+        .map<String, Object?>((key, value) => MapEntry(key.toString(), value));
   }
   return obj;
 }
diff --git a/pkgs/markdown/tool/update_github_emojis.dart b/pkgs/markdown/tool/update_github_emojis.dart
index 33751ec..fb07ac5 100644
--- a/pkgs/markdown/tool/update_github_emojis.dart
+++ b/pkgs/markdown/tool/update_github_emojis.dart
@@ -30,7 +30,7 @@
 /// Reference to emoji map within legacy_emojis.dart
 const legacyEmojis = legacy.emojis;
 
-/// AUTO GENERATED by [reconcile_emojis.dart] - this only needed to be done ONCE
+/// AUTO GENERATED by `reconcile_emojis.dart` - this only needed to be done ONCE
 /// during the reconciliation process with the legacy emoji.
 /// This array is ONLY USED when the --useGitHubUnicodes option is used to
 /// minimize the visual differences in the output emoji.