Latest lints, require Dart ^3.1 (#146)

diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index 0155ce9..030f9a4 100644
--- a/.github/workflows/test-package.yml
+++ b/.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.18.0, dev]
+        sdk: [3.1, dev]
     steps:
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
       - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 063cc49..2c4c77c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.11.2-wip
+
+* Require Dart 3.1 or greater
+
 ## 1.11.1
 
 * Make use of `@pragma('vm:awaiter-link')` to make package work better with
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 48d93f2..ad62f91 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,5 +1,5 @@
-# https://dart.dev/guides/language/analysis-options
-include: package:lints/recommended.yaml
+# https://dart.dev/tools/analysis#the-analysis-options-file
+include: package:dart_flutter_team_lints/analysis_options.yaml
 
 analyzer:
   language:
@@ -8,37 +8,16 @@
 
 linter:
   rules:
-    - always_declare_return_types
-    - avoid_catching_errors
-    - avoid_dynamic_calls
     - avoid_private_typedef_functions
     - avoid_redundant_argument_values
     - avoid_unused_constructor_parameters
     - avoid_void_async
     - cancel_subscriptions
-    - comment_references
-    - directives_ordering
-    - lines_longer_than_80_chars
     - literal_only_boolean_expressions
     - missing_whitespace_between_adjacent_strings
     - no_adjacent_strings_in_list
     - no_runtimeType_toString
-    - omit_local_variable_types
     - package_api_docs
-    - prefer_asserts_in_initializer_lists
-    - prefer_const_constructors
     - prefer_const_declarations
-    - prefer_relative_imports
-    - prefer_single_quotes
-    - sort_pub_dependencies
-    - test_types_in_equals
-    - throw_in_finally
-    - type_annotate_public_apis
-    - unawaited_futures
     - unnecessary_await_in_return
-    - unnecessary_lambdas
-    - unnecessary_parenthesis
-    - unnecessary_statements
-    - use_is_even_rather_than_modulo
     - use_string_buffers
-    - use_super_parameters
diff --git a/example/example.dart b/example/example.dart
index 7d71221..d601ca4 100644
--- a/example/example.dart
+++ b/example/example.dart
@@ -7,9 +7,9 @@
 }
 
 void _scheduleAsync() {
-  Future.delayed(const Duration(seconds: 1)).then((_) => _runAsync());
+  Future<void>.delayed(const Duration(seconds: 1)).then((_) => _runAsync());
 }
 
 void _runAsync() {
-  throw 'oh no!';
+  throw StateError('oh no!');
 }
diff --git a/pubspec.yaml b/pubspec.yaml
index 93fd3e5..b3a9d92 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,14 +1,14 @@
 name: stack_trace
-version: 1.11.1
+version: 1.11.2-wip
 description: A package for manipulating stack traces and printing them readably.
 repository: https://github.com/dart-lang/stack_trace
 
 environment:
-  sdk: ">=2.18.0 <3.0.0"
+  sdk: ^3.1.0
 
 dependencies:
   path: ^1.8.0
 
 dev_dependencies:
-  lints: ^2.0.0
+  dart_flutter_team_lints: ^2.0.0
   test: ^1.16.0
diff --git a/test/chain/chain_test.dart b/test/chain/chain_test.dart
index aa4256b..d5426dd 100644
--- a/test/chain/chain_test.dart
+++ b/test/chain/chain_test.dart
@@ -10,16 +10,16 @@
 
 import 'utils.dart';
 
-typedef ChainErrorCallback = void Function(dynamic stack, Chain chain);
-
 void main() {
   group('Chain.parse()', () {
-    test('parses a real Chain', () {
-      return captureFuture(() => inMicrotask(() => throw 'error'))
-          .then((chain) {
-        expect(
-            Chain.parse(chain.toString()).toString(), equals(chain.toString()));
-      });
+    test('parses a real Chain', () async {
+      // ignore: only_throw_errors
+      final chain = await captureFuture(() => inMicrotask(() => throw 'error'));
+
+      expect(
+        Chain.parse(chain.toString()).toString(),
+        equals(chain.toString()),
+      );
     });
 
     test('parses an empty string', () {
@@ -61,7 +61,7 @@
   group('Chain.capture()', () {
     test('with onError blocks errors', () {
       Chain.capture(() {
-        return Future.error('oh no');
+        return Future<void>.error('oh no');
       }, onError: expectAsync2((error, chain) {
         expect(error, equals('oh no'));
         expect(chain, isA<Chain>());
@@ -71,7 +71,7 @@
 
     test('with no onError blocks errors', () {
       runZonedGuarded(() {
-        Chain.capture(() => Future.error('oh no')).then(
+        Chain.capture(() => Future<void>.error('oh no')).then(
             expectAsync1((_) {}, count: 0),
             onError: expectAsync2((_, __) {}, count: 0));
       }, expectAsync2((error, chain) {
@@ -81,7 +81,7 @@
     });
 
     test("with errorZone: false doesn't block errors", () {
-      expect(Chain.capture(() => Future.error('oh no'), errorZone: false),
+      expect(Chain.capture(() => Future<void>.error('oh no'), errorZone: false),
           throwsA('oh no'));
     });
 
@@ -92,13 +92,13 @@
 
     group('with when: false', () {
       test("with no onError doesn't block errors", () {
-        expect(Chain.capture(() => Future.error('oh no'), when: false),
+        expect(Chain.capture(() => Future<void>.error('oh no'), when: false),
             throwsA('oh no'));
       });
 
       test('with onError blocks errors', () {
         Chain.capture(() {
-          return Future.error('oh no');
+          return Future<void>.error('oh no');
         }, onError: expectAsync2((error, chain) {
           expect(error, equals('oh no'));
           expect(chain, isA<Chain>());
diff --git a/test/chain/dart2js_test.dart b/test/chain/dart2js_test.dart
index 5841466..abb842d 100644
--- a/test/chain/dart2js_test.dart
+++ b/test/chain/dart2js_test.dart
@@ -2,11 +2,14 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+// ignore_for_file: only_throw_errors
+
 // dart2js chain tests are separated out because dart2js stack traces are
 // inconsistent due to inlining and browser differences. These tests don't
 // assert anything about the content of the traces, just the number of traces in
 // a chain.
 @TestOn('js')
+library;
 
 import 'dart:async';
 
@@ -73,7 +76,7 @@
     });
 
     test('multiple times', () {
-      var completer = Completer();
+      var completer = Completer<void>();
       var first = true;
 
       Chain.capture(() {
@@ -138,7 +141,7 @@
     });
 
     test('and relays them to the parent zone', () {
-      var completer = Completer();
+      var completer = Completer<void>();
 
       runZonedGuarded(() {
         Chain.capture(() {
@@ -164,7 +167,7 @@
   });
 
   test('capture() without onError passes exceptions to parent zone', () {
-    var completer = Completer();
+    var completer = Completer<void>();
 
     runZonedGuarded(() {
       Chain.capture(() => inMicrotask(() => throw 'error'));
diff --git a/test/chain/utils.dart b/test/chain/utils.dart
index 2cc6452..27fb0e6 100644
--- a/test/chain/utils.dart
+++ b/test/chain/utils.dart
@@ -47,7 +47,7 @@
 ///
 /// If [trace] is passed, it's used as the stack trace for the error.
 Future<void> completerErrorFuture([StackTrace? trace]) {
-  var completer = Completer();
+  var completer = Completer<void>();
   completer.completeError('error', trace);
   return completer.future;
 }
@@ -56,7 +56,7 @@
 ///
 /// If [trace] is passed, it's used as the stack trace for the error.
 Stream<void> controllerErrorStream([StackTrace? trace]) {
-  var controller = StreamController();
+  var controller = StreamController<void>();
   controller.addError('error', trace);
   return controller.stream;
 }
@@ -71,7 +71,9 @@
     // [new Future.sync] because those methods don't pass the exception through
     // the zone specification before propagating it, so there's no chance to
     // attach a chain to its stack trace. See issue 15105.
-    Future.value().then((_) => callback()).catchError(completer.completeError);
+    Future<void>.value()
+        .then((_) => callback())
+        .catchError(completer.completeError);
   });
 
   return completer.future
diff --git a/test/chain/vm_test.dart b/test/chain/vm_test.dart
index 83e01d4..5c6c0b7 100644
--- a/test/chain/vm_test.dart
+++ b/test/chain/vm_test.dart
@@ -2,9 +2,12 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+// ignore_for_file: only_throw_errors
+
 // VM chain tests can rely on stronger guarantees about the contents of the
 // stack traces than dart2js.
 @TestOn('dart-vm')
+library;
 
 import 'dart:async';
 
@@ -136,7 +139,7 @@
     });
 
     test('multiple times', () {
-      var completer = Completer();
+      var completer = Completer<void>();
       var first = true;
 
       Chain.capture(() {
@@ -231,7 +234,7 @@
     });
 
     test('and relays them to the parent zone', () {
-      var completer = Completer();
+      var completer = Completer<void>();
 
       runZonedGuarded(() {
         Chain.capture(() {
@@ -260,7 +263,7 @@
   });
 
   test('capture() without onError passes exceptions to parent zone', () {
-    var completer = Completer();
+    var completer = Completer<void>();
 
     runZonedGuarded(() {
       Chain.capture(() => inMicrotask(() => throw 'error'));
diff --git a/test/trace_test.dart b/test/trace_test.dart
index 15c86aa..d4bce76 100644
--- a/test/trace_test.dart
+++ b/test/trace_test.dart
@@ -6,10 +6,6 @@
 import 'package:stack_trace/stack_trace.dart';
 import 'package:test/test.dart';
 
-Trace getCurrentTrace([int level = 0]) => Trace.current(level);
-
-Trace nestedGetCurrentTrace(int level) => getCurrentTrace(level);
-
 void main() {
   // This just shouldn't crash.
   test('a native stack trace is parseable', Trace.current);
diff --git a/test/vm_test.dart b/test/vm_test.dart
index e0dbcff..70ac014 100644
--- a/test/vm_test.dart
+++ b/test/vm_test.dart
@@ -7,6 +7,7 @@
 /// platform to platform. No similar file exists for dart2js since the specific
 /// method names there are implementation details.
 @TestOn('vm')
+library;
 
 import 'package:path/path.dart' as path;
 import 'package:stack_trace/stack_trace.dart';