Prepare plugin repo for binding API improvements. (#4136)

diff --git a/packages/url_launcher/url_launcher/CHANGELOG.md b/packages/url_launcher/url_launcher/CHANGELOG.md
index 1e7104c..1dcf7a1 100644
--- a/packages/url_launcher/url_launcher/CHANGELOG.md
+++ b/packages/url_launcher/url_launcher/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 6.0.9
+
+* Silenced warnings that may occur during build when using a very
+  recent version of Flutter relating to null safety.
+
 ## 6.0.8
 
 * Adding API level 30 required package visibility configuration to the example's AndroidManifest.xml and README
diff --git a/packages/url_launcher/url_launcher/lib/url_launcher.dart b/packages/url_launcher/url_launcher/lib/url_launcher.dart
index e8d9670..8c46520 100644
--- a/packages/url_launcher/url_launcher/lib/url_launcher.dart
+++ b/packages/url_launcher/url_launcher/lib/url_launcher.dart
@@ -84,10 +84,13 @@
   bool previousAutomaticSystemUiAdjustment = true;
   if (statusBarBrightness != null &&
       defaultTargetPlatform == TargetPlatform.iOS &&
-      WidgetsBinding.instance != null) {
-    previousAutomaticSystemUiAdjustment =
-        WidgetsBinding.instance!.renderView.automaticSystemUiAdjustment;
-    WidgetsBinding.instance!.renderView.automaticSystemUiAdjustment = false;
+      _ambiguate(WidgetsBinding.instance) != null) {
+    previousAutomaticSystemUiAdjustment = _ambiguate(WidgetsBinding.instance)!
+        .renderView
+        .automaticSystemUiAdjustment;
+    _ambiguate(WidgetsBinding.instance)!
+        .renderView
+        .automaticSystemUiAdjustment = false;
     SystemChrome.setSystemUIOverlayStyle(statusBarBrightness == Brightness.light
         ? SystemUiOverlayStyle.dark
         : SystemUiOverlayStyle.light);
@@ -104,9 +107,11 @@
     webOnlyWindowName: webOnlyWindowName,
   );
 
-  if (statusBarBrightness != null && WidgetsBinding.instance != null) {
-    WidgetsBinding.instance!.renderView.automaticSystemUiAdjustment =
-        previousAutomaticSystemUiAdjustment;
+  if (statusBarBrightness != null &&
+      _ambiguate(WidgetsBinding.instance) != null) {
+    _ambiguate(WidgetsBinding.instance)!
+        .renderView
+        .automaticSystemUiAdjustment = previousAutomaticSystemUiAdjustment;
   }
 
   return result;
@@ -139,3 +144,10 @@
 Future<void> closeWebView() async {
   return await UrlLauncherPlatform.instance.closeWebView();
 }
+
+/// This allows a value of type T or T? to be treated as a value of type T?.
+///
+/// We use this so that APIs that have become non-nullable can still be used
+/// with `!` and `?` on the stable branch.
+// TODO(ianh): Remove this once we roll stable in late 2021.
+T? _ambiguate<T>(T? value) => value;
diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml
index 28dc71c..f6294ab 100644
--- a/packages/url_launcher/url_launcher/pubspec.yaml
+++ b/packages/url_launcher/url_launcher/pubspec.yaml
@@ -3,7 +3,7 @@
   web, phone, SMS, and email schemes.
 repository: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
-version: 6.0.8
+version: 6.0.9
 
 environment:
   sdk: ">=2.12.0 <3.0.0"
diff --git a/packages/url_launcher/url_launcher/test/url_launcher_test.dart b/packages/url_launcher/url_launcher/test/url_launcher_test.dart
index 9b2d167..04f727a 100644
--- a/packages/url_launcher/url_launcher/test/url_launcher_test.dart
+++ b/packages/url_launcher/url_launcher/test/url_launcher_test.dart
@@ -239,7 +239,7 @@
         ..setResponse(true);
 
       final TestWidgetsFlutterBinding binding =
-          TestWidgetsFlutterBinding.ensureInitialized()
+          _anonymize(TestWidgetsFlutterBinding.ensureInitialized())
               as TestWidgetsFlutterBinding;
       debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
       binding.renderView.automaticSystemUiAdjustment = true;
@@ -268,7 +268,7 @@
         ..setResponse(true);
 
       final TestWidgetsFlutterBinding binding =
-          TestWidgetsFlutterBinding.ensureInitialized()
+          _anonymize(TestWidgetsFlutterBinding.ensureInitialized())
               as TestWidgetsFlutterBinding;
       debugDefaultTargetPlatformOverride = TargetPlatform.android;
       expect(binding.renderView.automaticSystemUiAdjustment, true);
@@ -283,3 +283,11 @@
     });
   });
 }
+
+/// This removes the type information from a value so that it can be cast
+/// to another type even if that cast is redundant.
+///
+/// We use this so that APIs whose type have become more descriptive can still
+/// be used on the stable branch where they require a cast.
+// TODO(ianh): Remove this once we roll stable in late 2021.
+Object? _anonymize<T>(T? value) => value;
diff --git a/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md b/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md
index 06a2efe..fc56473 100644
--- a/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md
+++ b/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 2.0.4
+
+* Silenced warnings that may occur during build when using a very
+  recent version of Flutter relating to null safety.
+
 ## 2.0.3
 
 * Migrate `pushRouteNameToFramework` to use ChannelBuffers API.
diff --git a/packages/url_launcher/url_launcher_platform_interface/lib/link.dart b/packages/url_launcher/url_launcher_platform_interface/lib/link.dart
index 4a414ae..ffff14f 100644
--- a/packages/url_launcher/url_launcher_platform_interface/lib/link.dart
+++ b/packages/url_launcher/url_launcher_platform_interface/lib/link.dart
@@ -87,9 +87,10 @@
 Future<ByteData> pushRouteNameToFramework(Object? _, String routeName) {
   final Completer<ByteData> completer = Completer<ByteData>();
   SystemNavigator.routeInformationUpdated(location: routeName);
-  final _SendMessage sendMessage =
-      WidgetsBinding.instance?.platformDispatcher.onPlatformMessage ??
-          ui.channelBuffers.push;
+  final _SendMessage sendMessage = _ambiguate(WidgetsBinding.instance)
+          ?.platformDispatcher
+          .onPlatformMessage ??
+      ui.channelBuffers.push;
   sendMessage(
     'flutter/navigation',
     _codec.encodeMethodCall(
@@ -102,3 +103,10 @@
   );
   return completer.future;
 }
+
+/// This allows a value of type T or T? to be treated as a value of type T?.
+///
+/// We use this so that APIs that have become non-nullable can still be used
+/// with `!` and `?` on the stable branch.
+// TODO(ianh): Remove this once we roll stable in late 2021.
+T? _ambiguate<T>(T? value) => value;
diff --git a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml
index 9bb30c6..074e95b 100644
--- a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml
+++ b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml
@@ -4,7 +4,7 @@
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
 # NOTE: We strongly prefer non-breaking changes, even at the expense of a
 # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
-version: 2.0.3
+version: 2.0.4
 
 environment:
   sdk: ">=2.12.0 <3.0.0"