Migrate channels to null safety (#80641)

diff --git a/dev/integration_tests/channels/lib/main.dart b/dev/integration_tests/channels/lib/main.dart
index 2e1838b..3bda1da 100644
--- a/dev/integration_tests/channels/lib/main.dart
+++ b/dev/integration_tests/channels/lib/main.dart
@@ -19,7 +19,7 @@
 }
 
 class TestApp extends StatefulWidget {
-  const TestApp({Key key}) : super(key: key);
+  const TestApp({Key? key}) : super(key: key);
 
   @override
   _TestAppState createState() => _TestAppState();
@@ -155,7 +155,7 @@
     () => basicJsonMessageToUnknownChannel(),
     () => basicStandardMessageToUnknownChannel(),
   ];
-  Future<TestStepResult> _result;
+  Future<TestStepResult>? _result;
   int _step = 0;
 
   void _executeNextStep() {
diff --git a/dev/integration_tests/channels/lib/src/basic_messaging.dart b/dev/integration_tests/channels/lib/src/basic_messaging.dart
index 2a9f17c..7eaf673 100644
--- a/dev/integration_tests/channels/lib/src/basic_messaging.dart
+++ b/dev/integration_tests/channels/lib/src/basic_messaging.dart
@@ -42,25 +42,25 @@
   }
 }
 
-Future<TestStepResult> basicBinaryHandshake(ByteData message) async {
+Future<TestStepResult> basicBinaryHandshake(ByteData? message) async {
   const BasicMessageChannel<ByteData> channel =
       BasicMessageChannel<ByteData>(
     'binary-msg',
     BinaryCodec(),
   );
-  return _basicMessageHandshake<ByteData>(
+  return _basicMessageHandshake<ByteData?>(
       'Binary >${toString(message)}<', channel, message);
 }
 
-Future<TestStepResult> basicStringHandshake(String message) async {
+Future<TestStepResult> basicStringHandshake(String? message) async {
   const BasicMessageChannel<String> channel = BasicMessageChannel<String>(
     'string-msg',
     StringCodec(),
   );
-  return _basicMessageHandshake<String>('String >$message<', channel, message);
+  return _basicMessageHandshake<String?>('String >$message<', channel, message);
 }
 
-Future<TestStepResult> basicJsonHandshake(dynamic message) async {
+Future<TestStepResult> basicJsonHandshake(Object? message) async {
   const BasicMessageChannel<dynamic> channel =
       BasicMessageChannel<dynamic>(
     'json-msg',
@@ -126,9 +126,9 @@
   T message,
 ) async {
   final List<dynamic> received = <dynamic>[];
-  channel.setMessageHandler((T message) async {
+  channel.setMessageHandler((T? message) async {
     received.add(message);
-    return message;
+    return message!;
   });
   dynamic messageEcho = nothing;
   dynamic error = nothing;
@@ -150,7 +150,7 @@
 /// Sends a message on a channel that no one listens on.
 Future<TestStepResult> _basicMessageToUnknownChannel<T>(
   String description,
-  BasicMessageChannel<T> channel,
+  BasicMessageChannel<T?> channel,
 ) async {
   dynamic messageEcho = nothing;
   dynamic error = nothing;
diff --git a/dev/integration_tests/channels/lib/src/test_step.dart b/dev/integration_tests/channels/lib/src/test_step.dart
index 2a26467..c9ebb17 100644
--- a/dev/integration_tests/channels/lib/src/test_step.dart
+++ b/dev/integration_tests/channels/lib/src/test_step.dart
@@ -44,12 +44,11 @@
         return const TestStepResult('Executing', nothing, TestStatus.pending);
       case ConnectionState.done:
         if (snapshot.hasData) {
-          return snapshot.data;
+          return snapshot.data!;
         } else {
-          final TestStepResult result = snapshot.error as TestStepResult;
+          final TestStepResult result = snapshot.error! as TestStepResult;
           return result;
         }
-        break;
       default:
         throw 'Unsupported state ${snapshot.connectionState}';
     }
diff --git a/dev/integration_tests/channels/pubspec.yaml b/dev/integration_tests/channels/pubspec.yaml
index 5b82f5c..3c3d9b8 100644
--- a/dev/integration_tests/channels/pubspec.yaml
+++ b/dev/integration_tests/channels/pubspec.yaml
@@ -2,7 +2,7 @@
 description: Integration test for platform channels.
 
 environment:
-  sdk: ">=2.0.0-dev.68.0 <3.0.0"
+  sdk: ">=2.12.0 <3.0.0"
 
 dependencies:
   flutter:
diff --git a/dev/integration_tests/channels/test_driver/main_test.dart b/dev/integration_tests/channels/test_driver/main_test.dart
index 42c4ed3..dcba327 100644
--- a/dev/integration_tests/channels/test_driver/main_test.dart
+++ b/dev/integration_tests/channels/test_driver/main_test.dart
@@ -7,7 +7,7 @@
 
 void main() {
   group('channel suite', () {
-    FlutterDriver driver;
+    late FlutterDriver driver;
 
     setUpAll(() async {
       driver = await FlutterDriver.connect();
@@ -28,7 +28,7 @@
     }, timeout: const Timeout(Duration(minutes: 1)));
 
     tearDownAll(() async {
-      driver?.close();
+      driver.close();
     });
   });
 }