From d449a17f8706850388a16d8acc72398c2118cf9a Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 22 May 2023 13:10:40 -0700 Subject: [PATCH] [various] Remove unnecessary null checks (#4060) Removes `unnecessary_null_comparison: ignore` from the repository analysis options. Now that Dart 3 has reached the stable channel, all fully supported customers will be running in strong mode, so the extra null checks are no longer needed. While many packages do support earlier versions, this won't break anyone, it will just mean that people who are both a) using old versions of Flutter and b) violating the API contract by passing null to a non-nullable type, won't get error messages that are as obvious, which is fine for the best-effort support level we give to pre-current-stable versions of Flutter. --- analysis_options.yaml | 2 - packages/camera/camera/CHANGELOG.md | 4 ++ packages/camera/camera/example/lib/main.dart | 6 +- packages/camera/camera/pubspec.yaml | 2 +- packages/camera/camera_android/CHANGELOG.md | 4 ++ .../camera_android/example/lib/main.dart | 6 +- packages/camera/camera_android/pubspec.yaml | 2 +- .../camera_android_camerax/CHANGELOG.md | 4 ++ .../example/lib/main.dart | 6 +- .../lib/src/system_services.dart | 3 - .../camera_android_camerax/pubspec.yaml | 2 +- .../camera/camera_avfoundation/CHANGELOG.md | 3 +- .../camera_avfoundation/example/lib/main.dart | 6 +- .../camera/camera_avfoundation/pubspec.yaml | 2 +- .../camera_platform_interface/CHANGELOG.md | 3 +- .../lib/src/events/camera_event.dart | 2 +- .../camera_platform_interface/pubspec.yaml | 2 +- packages/camera/camera_web/CHANGELOG.md | 3 +- .../camera/camera_web/lib/src/camera.dart | 4 +- packages/camera/camera_web/pubspec.yaml | 2 +- packages/dynamic_layouts/CHANGELOG.md | 3 +- .../lib/src/staggered_layout.dart | 18 ++--- .../dynamic_layouts/lib/src/wrap_layout.dart | 19 +++-- packages/dynamic_layouts/pubspec.yaml | 2 +- packages/flutter_markdown/test/utils.dart | 3 - packages/flutter_migrate/CHANGELOG.md | 4 ++ .../flutter_migrate/lib/src/base/logger.dart | 6 +- .../flutter_migrate/lib/src/base/project.dart | 3 +- .../lib/src/base/terminal.dart | 4 +- .../lib/src/flutter_project_metadata.dart | 6 -- packages/flutter_migrate/pubspec.yaml | 2 +- packages/flutter_migrate/test/src/fakes.dart | 2 - .../test/test_data/migrate_project.dart | 6 +- packages/go_router/CHANGELOG.md | 6 +- packages/go_router/lib/src/route.dart | 2 +- packages/go_router/pubspec.yaml | 2 +- .../google_maps_flutter/CHANGELOG.md | 3 +- .../lib/src/controller.dart | 9 --- .../lib/src/google_map.dart | 12 +--- .../google_maps_flutter/pubspec.yaml | 2 +- .../test/fake_maps_controllers.dart | 3 - .../google_maps_flutter_android/CHANGELOG.md | 3 +- .../lib/src/google_maps_flutter_android.dart | 8 --- .../google_maps_flutter_android/pubspec.yaml | 2 +- .../google_maps_flutter_ios/CHANGELOG.md | 3 +- .../lib/src/google_maps_flutter_ios.dart | 8 --- .../google_maps_flutter_ios/pubspec.yaml | 2 +- .../CHANGELOG.md | 3 +- .../method_channel_google_maps_flutter.dart | 8 --- .../lib/src/types/callbacks.dart | 1 - .../lib/src/types/camera.dart | 5 +- .../lib/src/types/cap.dart | 1 - .../lib/src/types/location.dart | 8 +-- .../lib/src/types/maps_object.dart | 2 +- .../lib/src/types/marker.dart | 2 +- .../lib/src/types/polygon.dart | 8 +-- .../lib/src/types/polyline.dart | 12 +--- .../pubspec.yaml | 2 +- .../google_maps_flutter_web/CHANGELOG.md | 4 ++ .../lib/src/circles.dart | 4 -- .../lib/src/convert.dart | 70 ++++++++----------- .../lib/src/google_maps_flutter_web.dart | 2 +- .../lib/src/marker.dart | 12 +--- .../lib/src/markers.dart | 4 -- .../lib/src/polygons.dart | 12 +--- .../lib/src/polylines.dart | 4 -- .../google_maps_flutter_web/pubspec.yaml | 2 +- .../google_sign_in/CHANGELOG.md | 4 ++ .../google_sign_in/lib/google_sign_in.dart | 4 +- .../google_sign_in/lib/widgets.dart | 2 +- .../google_sign_in/pubspec.yaml | 2 +- .../in_app_purchase_android/CHANGELOG.md | 4 ++ .../billing_client_wrapper.dart | 5 -- .../src/in_app_purchase_android_platform.dart | 5 -- ...pp_purchase_android_platform_addition.dart | 4 -- .../in_app_purchase_android/pubspec.yaml | 2 +- .../CHANGELOG.md | 3 +- .../src/errors/in_app_purchase_exception.dart | 2 +- .../pubspec.yaml | 2 +- .../in_app_purchase_storekit/CHANGELOG.md | 3 +- .../in_app_purchase_storekit_platform.dart | 10 ++- .../sk_payment_queue_wrapper.dart | 2 - .../in_app_purchase_storekit/pubspec.yaml | 2 +- .../example/test/widget_test.dart | 5 +- packages/metrics_center/CHANGELOG.md | 3 +- packages/metrics_center/lib/src/gcs_lock.dart | 4 +- packages/metrics_center/lib/src/skiaperf.dart | 11 ++- packages/metrics_center/pubspec.yaml | 2 +- .../path_provider_linux/CHANGELOG.md | 3 +- .../lib/src/get_application_id_real.dart | 2 +- .../path_provider_linux/pubspec.yaml | 2 +- .../quick_actions/quick_actions/CHANGELOG.md | 4 ++ .../quick_actions/example/lib/main.dart | 4 +- .../quick_actions/quick_actions/pubspec.yaml | 2 +- .../quick_actions_android/CHANGELOG.md | 3 +- .../example/lib/main.dart | 4 +- .../quick_actions_android/pubspec.yaml | 2 +- .../quick_actions_ios/CHANGELOG.md | 3 +- .../quick_actions_ios/example/lib/main.dart | 4 +- .../quick_actions_ios/pubspec.yaml | 2 +- .../url_launcher_web/CHANGELOG.md | 3 +- .../url_launcher_web/lib/src/link.dart | 16 ++--- .../third_party/platform_detect/browser.dart | 5 +- .../lib/url_launcher_web.dart | 6 +- .../url_launcher_web/pubspec.yaml | 2 +- packages/web_benchmarks/CHANGELOG.md | 3 +- packages/web_benchmarks/lib/client.dart | 2 - .../lib/src/benchmark_result.dart | 2 +- packages/web_benchmarks/lib/src/browser.dart | 6 -- packages/web_benchmarks/lib/src/recorder.dart | 10 +-- packages/web_benchmarks/lib/src/runner.dart | 4 +- packages/web_benchmarks/pubspec.yaml | 2 +- .../webview_flutter/CHANGELOG.md | 4 ++ .../webview_flutter/example/lib/main.dart | 2 +- .../lib/src/legacy/webview.dart | 9 +-- .../webview_flutter/pubspec.yaml | 2 +- .../webview_flutter_android/CHANGELOG.md | 4 ++ .../example/lib/legacy/web_view.dart | 9 +-- .../example/lib/main.dart | 2 +- .../webview_flutter_android/pubspec.yaml | 2 +- .../CHANGELOG.md | 4 ++ .../lib/src/legacy/types/creation_params.dart | 2 +- .../src/legacy/types/javascript_channel.dart | 4 +- .../src/legacy/types/javascript_message.dart | 2 +- .../src/legacy/types/web_resource_error.dart | 3 +- .../lib/src/legacy/types/web_settings.dart | 2 +- .../pubspec.yaml | 2 +- .../webview_flutter_web/CHANGELOG.md | 1 + .../example/lib/legacy/web_view.dart | 5 +- .../webview_flutter_wkwebview/CHANGELOG.md | 4 ++ .../example/lib/legacy/web_view.dart | 9 +-- .../example/lib/main.dart | 2 +- .../webview_flutter_wkwebview/pubspec.yaml | 2 +- script/tool/lib/src/common/xcode.dart | 4 +- .../src/federation_safety_check_command.dart | 3 - script/tool/lib/src/publish_command.dart | 1 - 136 files changed, 242 insertions(+), 396 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 498d19dfb4ae..3c924bb88a30 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -13,8 +13,6 @@ analyzer: # allow self-reference to deprecated members (we do this because otherwise we have # to annotate every member in every test, assert, etc, when we deprecate something) deprecated_member_use_from_same_package: ignore - # Turned off until null-safe rollout is complete. - unnecessary_null_comparison: ignore exclude: # DIFFERENT FROM FLUTTER/FLUTTER # Ignore generated files - '**/*.g.dart' diff --git a/packages/camera/camera/CHANGELOG.md b/packages/camera/camera/CHANGELOG.md index b6dc896276e8..856f2bac5b31 100644 --- a/packages/camera/camera/CHANGELOG.md +++ b/packages/camera/camera/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.10.5+1 + +* Removes obsolete null checks on non-nullable values. + ## 0.10.5 * Adds NV21 as an image streaming option for Android. diff --git a/packages/camera/camera/example/lib/main.dart b/packages/camera/camera/example/lib/main.dart index 73c9f052d48c..6dad1ebe7daa 100644 --- a/packages/camera/camera/example/lib/main.dart +++ b/packages/camera/camera/example/lib/main.dart @@ -250,9 +250,7 @@ class _CameraExampleHomeState extends State child: Center( child: AspectRatio( aspectRatio: - localVideoController.value.size != null - ? localVideoController.value.aspectRatio - : 1.0, + localVideoController.value.aspectRatio, child: VideoPlayer(localVideoController)), ), ), @@ -1000,7 +998,7 @@ class _CameraExampleHomeState extends State : VideoPlayerController.file(File(videoFile!.path)); videoPlayerListener = () { - if (videoController != null && videoController!.value.size != null) { + if (videoController != null) { // Refreshing the state to update video player with the correct ratio. if (mounted) { setState(() {}); diff --git a/packages/camera/camera/pubspec.yaml b/packages/camera/camera/pubspec.yaml index 28648adbe690..5f18563836ff 100644 --- a/packages/camera/camera/pubspec.yaml +++ b/packages/camera/camera/pubspec.yaml @@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing Dart. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.10.5 +version: 0.10.5+1 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/camera/camera_android/CHANGELOG.md b/packages/camera/camera_android/CHANGELOG.md index 3e81bba1ed83..28552d33c3ab 100644 --- a/packages/camera/camera_android/CHANGELOG.md +++ b/packages/camera/camera_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.10.8+2 + +* Removes obsolete null checks on non-nullable values. + ## 0.10.8+1 * Fixes lint errors. diff --git a/packages/camera/camera_android/example/lib/main.dart b/packages/camera/camera_android/example/lib/main.dart index dd02be3d7ae6..5162d3a22cfb 100644 --- a/packages/camera/camera_android/example/lib/main.dart +++ b/packages/camera/camera_android/example/lib/main.dart @@ -253,9 +253,7 @@ class _CameraExampleHomeState extends State child: Center( child: AspectRatio( aspectRatio: - localVideoController.value.size != null - ? localVideoController.value.aspectRatio - : 1.0, + localVideoController.value.aspectRatio, child: VideoPlayer(localVideoController)), ), ), @@ -1008,7 +1006,7 @@ class _CameraExampleHomeState extends State : VideoPlayerController.file(File(videoFile!.path)); videoPlayerListener = () { - if (videoController != null && videoController!.value.size != null) { + if (videoController != null) { // Refreshing the state to update video player with the correct ratio. if (mounted) { setState(() {}); diff --git a/packages/camera/camera_android/pubspec.yaml b/packages/camera/camera_android/pubspec.yaml index 9ba23af47c26..9da632825dd4 100644 --- a/packages/camera/camera_android/pubspec.yaml +++ b/packages/camera/camera_android/pubspec.yaml @@ -3,7 +3,7 @@ description: Android implementation of the camera plugin. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.10.8+1 +version: 0.10.8+2 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/camera/camera_android_camerax/CHANGELOG.md b/packages/camera/camera_android_camerax/CHANGELOG.md index a07f2854ccd5..16da75f45970 100644 --- a/packages/camera/camera_android_camerax/CHANGELOG.md +++ b/packages/camera/camera_android_camerax/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.0+4 + +* Removes obsolete null checks on non-nullable values. + ## 0.5.0+3 * Fixes Java lints. diff --git a/packages/camera/camera_android_camerax/example/lib/main.dart b/packages/camera/camera_android_camerax/example/lib/main.dart index 16ba8639a67f..1e051d4582ec 100644 --- a/packages/camera/camera_android_camerax/example/lib/main.dart +++ b/packages/camera/camera_android_camerax/example/lib/main.dart @@ -253,9 +253,7 @@ class _CameraExampleHomeState extends State child: Center( child: AspectRatio( aspectRatio: - localVideoController.value.size != null - ? localVideoController.value.aspectRatio - : 1.0, + localVideoController.value.aspectRatio, child: VideoPlayer(localVideoController)), ), ), @@ -985,7 +983,7 @@ class _CameraExampleHomeState extends State : VideoPlayerController.file(File(videoFile!.path)); videoPlayerListener = () { - if (videoController != null && videoController!.value.size != null) { + if (videoController != null) { // Refreshing the state to update video player with the correct ratio. if (mounted) { setState(() {}); diff --git a/packages/camera/camera_android_camerax/lib/src/system_services.dart b/packages/camera/camera_android_camerax/lib/src/system_services.dart index 2f41861b77f3..a2513e037662 100644 --- a/packages/camera/camera_android_camerax/lib/src/system_services.dart +++ b/packages/camera/camera_android_camerax/lib/src/system_services.dart @@ -125,9 +125,6 @@ class SystemServicesFlutterApiImpl implements SystemServicesFlutterApi { void onDeviceOrientationChanged(String orientation) { final DeviceOrientation deviceOrientation = deserializeDeviceOrientation(orientation); - if (deviceOrientation == null) { - return; - } SystemServices.deviceOrientationChangedStreamController .add(DeviceOrientationChangedEvent(deviceOrientation)); } diff --git a/packages/camera/camera_android_camerax/pubspec.yaml b/packages/camera/camera_android_camerax/pubspec.yaml index 97a95def2e09..7275c68f1ff4 100644 --- a/packages/camera/camera_android_camerax/pubspec.yaml +++ b/packages/camera/camera_android_camerax/pubspec.yaml @@ -3,7 +3,7 @@ description: Android implementation of the camera plugin using the CameraX libra repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.5.0+3 +version: 0.5.0+4 environment: sdk: ">=2.19.0 <4.0.0" diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index bee2ab3d59c9..4a4be5f17c3b 100644 --- a/packages/camera/camera_avfoundation/CHANGELOG.md +++ b/packages/camera/camera_avfoundation/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 0.9.13+2 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 0.9.13+1 diff --git a/packages/camera/camera_avfoundation/example/lib/main.dart b/packages/camera/camera_avfoundation/example/lib/main.dart index dd02be3d7ae6..5162d3a22cfb 100644 --- a/packages/camera/camera_avfoundation/example/lib/main.dart +++ b/packages/camera/camera_avfoundation/example/lib/main.dart @@ -253,9 +253,7 @@ class _CameraExampleHomeState extends State child: Center( child: AspectRatio( aspectRatio: - localVideoController.value.size != null - ? localVideoController.value.aspectRatio - : 1.0, + localVideoController.value.aspectRatio, child: VideoPlayer(localVideoController)), ), ), @@ -1008,7 +1006,7 @@ class _CameraExampleHomeState extends State : VideoPlayerController.file(File(videoFile!.path)); videoPlayerListener = () { - if (videoController != null && videoController!.value.size != null) { + if (videoController != null) { // Refreshing the state to update video player with the correct ratio. if (mounted) { setState(() {}); diff --git a/packages/camera/camera_avfoundation/pubspec.yaml b/packages/camera/camera_avfoundation/pubspec.yaml index 55751196011c..937a1c2ae030 100644 --- a/packages/camera/camera_avfoundation/pubspec.yaml +++ b/packages/camera/camera_avfoundation/pubspec.yaml @@ -2,7 +2,7 @@ name: camera_avfoundation description: iOS implementation of the camera plugin. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_avfoundation issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.9.13+1 +version: 0.9.13+2 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/camera/camera_platform_interface/CHANGELOG.md b/packages/camera/camera_platform_interface/CHANGELOG.md index a889b6f8cd9b..7b21165d8646 100644 --- a/packages/camera/camera_platform_interface/CHANGELOG.md +++ b/packages/camera/camera_platform_interface/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.5.1 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 2.5.0 diff --git a/packages/camera/camera_platform_interface/lib/src/events/camera_event.dart b/packages/camera/camera_platform_interface/lib/src/events/camera_event.dart index 95f61a97a2c8..1c76c341d9b1 100644 --- a/packages/camera/camera_platform_interface/lib/src/events/camera_event.dart +++ b/packages/camera/camera_platform_interface/lib/src/events/camera_event.dart @@ -27,7 +27,7 @@ abstract class CameraEvent { /// Build a Camera Event, that relates a `cameraId`. /// /// The `cameraId` is the ID of the camera that triggered the event. - const CameraEvent(this.cameraId) : assert(cameraId != null); + const CameraEvent(this.cameraId); /// The ID of the Camera this event is associated to. final int cameraId; diff --git a/packages/camera/camera_platform_interface/pubspec.yaml b/packages/camera/camera_platform_interface/pubspec.yaml index 0b0d0a950fef..3dc49cec038e 100644 --- a/packages/camera/camera_platform_interface/pubspec.yaml +++ b/packages/camera/camera_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/camera/camera issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%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.5.0 +version: 2.5.1 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/camera/camera_web/CHANGELOG.md b/packages/camera/camera_web/CHANGELOG.md index 004488a4f40d..1d736b0ac541 100644 --- a/packages/camera/camera_web/CHANGELOG.md +++ b/packages/camera/camera_web/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 0.3.1+4 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 0.3.1+3 diff --git a/packages/camera/camera_web/lib/src/camera.dart b/packages/camera/camera_web/lib/src/camera.dart index 13ef21b1ea46..79bacadcebdc 100644 --- a/packages/camera/camera_web/lib/src/camera.dart +++ b/packages/camera/camera_web/lib/src/camera.dart @@ -471,9 +471,7 @@ class Camera { _onVideoRecordingErrorSubscription = mediaRecorder!.onError.listen((html.Event event) { final html.ErrorEvent error = event as html.ErrorEvent; - if (error != null) { - videoRecordingErrorController.add(error); - } + videoRecordingErrorController.add(error); }); if (maxVideoDuration != null) { diff --git a/packages/camera/camera_web/pubspec.yaml b/packages/camera/camera_web/pubspec.yaml index ade36cda8c14..382444d3624b 100644 --- a/packages/camera/camera_web/pubspec.yaml +++ b/packages/camera/camera_web/pubspec.yaml @@ -2,7 +2,7 @@ name: camera_web description: A Flutter plugin for getting information about and controlling the camera on Web. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.3.1+3 +version: 0.3.1+4 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/dynamic_layouts/CHANGELOG.md b/packages/dynamic_layouts/CHANGELOG.md index 908eb54fb5dc..2c71313585d2 100644 --- a/packages/dynamic_layouts/CHANGELOG.md +++ b/packages/dynamic_layouts/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 0.0.1+1 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. * Aligns Dart and Flutter SDK constraints. * Updates minimum Flutter version to 3.0. diff --git a/packages/dynamic_layouts/lib/src/staggered_layout.dart b/packages/dynamic_layouts/lib/src/staggered_layout.dart index 941875a4701c..f5fb4fb86a01 100644 --- a/packages/dynamic_layouts/lib/src/staggered_layout.dart +++ b/packages/dynamic_layouts/lib/src/staggered_layout.dart @@ -47,9 +47,9 @@ class SliverGridStaggeredTileLayout extends DynamicSliverGridLayout { required this.crossAxisSpacing, required this.childCrossAxisExtent, required this.scrollDirection, - }) : assert(crossAxisCount != null && crossAxisCount > 0), - assert(crossAxisSpacing != null && crossAxisSpacing >= 0), - assert(childCrossAxisExtent != null && childCrossAxisExtent >= 0); + }) : assert(crossAxisCount > 0), + assert(crossAxisSpacing >= 0), + assert(childCrossAxisExtent >= 0); /// The number of children in the cross axis. final int crossAxisCount; @@ -200,9 +200,9 @@ class DynamicSliverGridDelegateWithFixedCrossAxisCount required super.crossAxisCount, super.mainAxisSpacing = 0.0, super.crossAxisSpacing = 0.0, - }) : assert(crossAxisCount != null && crossAxisCount > 0), - assert(mainAxisSpacing != null && mainAxisSpacing >= 0), - assert(crossAxisSpacing != null && crossAxisSpacing >= 0); + }) : assert(crossAxisCount > 0), + assert(mainAxisSpacing >= 0), + assert(crossAxisSpacing >= 0); bool _debugAssertIsValid() { assert(crossAxisCount > 0); @@ -283,9 +283,9 @@ class DynamicSliverGridDelegateWithMaxCrossAxisExtent required super.maxCrossAxisExtent, super.mainAxisSpacing = 0.0, super.crossAxisSpacing = 0.0, - }) : assert(maxCrossAxisExtent != null && maxCrossAxisExtent > 0), - assert(mainAxisSpacing != null && mainAxisSpacing >= 0), - assert(crossAxisSpacing != null && crossAxisSpacing >= 0); + }) : assert(maxCrossAxisExtent > 0), + assert(mainAxisSpacing >= 0), + assert(crossAxisSpacing >= 0); bool _debugAssertIsValid(double crossAxisExtent) { assert(crossAxisExtent > 0.0); diff --git a/packages/dynamic_layouts/lib/src/wrap_layout.dart b/packages/dynamic_layouts/lib/src/wrap_layout.dart index 83b630d5e9c4..b39ab87fa05c 100644 --- a/packages/dynamic_layouts/lib/src/wrap_layout.dart +++ b/packages/dynamic_layouts/lib/src/wrap_layout.dart @@ -54,14 +54,13 @@ class SliverGridWrappingTileLayout extends DynamicSliverGridLayout { required this.childCrossAxisExtent, required this.crossAxisExtent, required this.scrollDirection, - }) : assert(mainAxisSpacing != null && mainAxisSpacing >= 0), - assert(crossAxisSpacing != null && crossAxisSpacing >= 0), - assert(childMainAxisExtent != null && childMainAxisExtent >= 0), - assert(childCrossAxisExtent != null && childCrossAxisExtent >= 0), - assert(crossAxisExtent != null && crossAxisExtent >= 0), - assert(scrollDirection != null && - (scrollDirection == Axis.horizontal || - scrollDirection == Axis.vertical)); + }) : assert(mainAxisSpacing >= 0), + assert(crossAxisSpacing >= 0), + assert(childMainAxisExtent >= 0), + assert(childCrossAxisExtent >= 0), + assert(crossAxisExtent >= 0), + assert(scrollDirection == Axis.horizontal || + scrollDirection == Axis.vertical); /// The direction in which the layout should be built. final Axis scrollDirection; @@ -216,8 +215,8 @@ class SliverGridDelegateWithWrapping extends SliverGridDelegate { this.crossAxisSpacing = 0.0, this.childCrossAxisExtent = double.infinity, this.childMainAxisExtent = double.infinity, - }) : assert(mainAxisSpacing != null && mainAxisSpacing >= 0), - assert(crossAxisSpacing != null && crossAxisSpacing >= 0); + }) : assert(mainAxisSpacing >= 0), + assert(crossAxisSpacing >= 0); /// The number of pixels from the leading edge of one tile to the trailing /// edge of the same tile in the main axis. diff --git a/packages/dynamic_layouts/pubspec.yaml b/packages/dynamic_layouts/pubspec.yaml index 99989e965fca..9803a7fc59bb 100644 --- a/packages/dynamic_layouts/pubspec.yaml +++ b/packages/dynamic_layouts/pubspec.yaml @@ -1,6 +1,6 @@ name: dynamic_layouts description: Widgets for building dynamic grid layouts. -version: 0.0.1 +version: 0.0.1+1 issue_tracker: https://github.com/flutter/flutter/labels/p%3A%20dynamic_layouts repository: https://github.com/flutter/packages/tree/main/packages/dynamic_layouts # Temporarily unpublished while in process of releasing full package in multiple stages. diff --git a/packages/flutter_markdown/test/utils.dart b/packages/flutter_markdown/test/utils.dart index 0ce7f162b3a9..544b8b27a2e4 100644 --- a/packages/flutter_markdown/test/utils.dart +++ b/packages/flutter_markdown/test/utils.dart @@ -208,9 +208,6 @@ class TestAssetBundle extends CachingAssetBundle { io.File('${rootDirectory.path}/test/assets/images/logo.png'); final ByteData asset = ByteData.view(file.readAsBytesSync().buffer); - if (asset == null) { - throw FlutterError('Unable to load asset: $key'); - } return asset; } else { throw ArgumentError('Unknown asset key: $key'); diff --git a/packages/flutter_migrate/CHANGELOG.md b/packages/flutter_migrate/CHANGELOG.md index 5aaff1c1f71c..f71225f718c7 100644 --- a/packages/flutter_migrate/CHANGELOG.md +++ b/packages/flutter_migrate/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.1+3 + +* Removes obsolete null checks on non-nullable values. + ## 0.0.1+2 * Removes use of `runtimeType.toString()`. diff --git a/packages/flutter_migrate/lib/src/base/logger.dart b/packages/flutter_migrate/lib/src/base/logger.dart index c84f098af7fd..70ff228a3901 100644 --- a/packages/flutter_migrate/lib/src/base/logger.dart +++ b/packages/flutter_migrate/lib/src/base/logger.dart @@ -708,7 +708,6 @@ class BufferLogger extends Logger { String? progressId, int progressIndicatorPadding = kDefaultStatusPadding, }) { - assert(progressIndicatorPadding != null); printStatus(message); return SilentStatus( stopwatch: _stopwatchFactory.createStopwatch(), @@ -983,7 +982,6 @@ class AnonymousSpinnerStatus extends Status { void _callback(Timer timer) { assert(this.timer == timer); - assert(timer != null); assert(timer.isActive); _writeToStdOut(_backspaceChar * _lastAnimationFrameLength); ticks += 1; @@ -1147,7 +1145,7 @@ String wrapText( int? indent, }) { assert(columnWidth >= 0); - if (text == null || text.isEmpty) { + if (text.isEmpty) { return ''; } indent ??= 0; @@ -1231,7 +1229,7 @@ List _wrapTextAsLines( required int columnWidth, required bool shouldWrap, }) { - if (text == null || text.isEmpty) { + if (text.isEmpty) { return ['']; } assert(start >= 0); diff --git a/packages/flutter_migrate/lib/src/base/project.dart b/packages/flutter_migrate/lib/src/base/project.dart index b8158d6f5aa0..9aa2cc67fe65 100644 --- a/packages/flutter_migrate/lib/src/base/project.dart +++ b/packages/flutter_migrate/lib/src/base/project.dart @@ -27,7 +27,6 @@ class FlutterProjectFactory { /// Returns a [FlutterProject] view of the given directory or a ToolExit error, /// if `pubspec.yaml` or `example/pubspec.yaml` is invalid. FlutterProject fromDirectory(Directory directory) { - assert(directory != null); return projects.putIfAbsent(directory.path, () { return FlutterProject(directory); }); @@ -36,7 +35,7 @@ class FlutterProjectFactory { /// Represents the contents of a Flutter project at the specified [directory]. class FlutterProject { - FlutterProject(this.directory) : assert(directory != null); + FlutterProject(this.directory); /// Returns a [FlutterProject] view of the current directory or a ToolExit error, /// if `pubspec.yaml` or `example/pubspec.yaml` is invalid. diff --git a/packages/flutter_migrate/lib/src/base/terminal.dart b/packages/flutter_migrate/lib/src/base/terminal.dart index aeb8f2812fd6..8bb5480245fa 100644 --- a/packages/flutter_migrate/lib/src/base/terminal.dart +++ b/packages/flutter_migrate/lib/src/base/terminal.dart @@ -235,7 +235,6 @@ class AnsiTerminal implements Terminal { @override String bolden(String message) { - assert(message != null); if (!supportsColor || message.isEmpty) { return message; } @@ -256,8 +255,7 @@ class AnsiTerminal implements Terminal { @override String color(String message, TerminalColor color) { - assert(message != null); - if (!supportsColor || color == null || message.isEmpty) { + if (!supportsColor || message.isEmpty) { return message; } final StringBuffer buffer = StringBuffer(); diff --git a/packages/flutter_migrate/lib/src/flutter_project_metadata.dart b/packages/flutter_migrate/lib/src/flutter_project_metadata.dart index 281ec8ed9b7e..d8f4026ba11c 100644 --- a/packages/flutter_migrate/lib/src/flutter_project_metadata.dart +++ b/packages/flutter_migrate/lib/src/flutter_project_metadata.dart @@ -195,12 +195,6 @@ class FlutterProjectMetadata { /// needs to be able to write the .migrate_config file into legacy apps. void writeFile({File? outputFile}) { outputFile = outputFile ?? file; - if (outputFile == null) { - // In-memory FlutterProjectMetadata instances requires an output file to - // be passed or specified in the constructor. - throw const FileSystemException( - 'No outputFile specified to write .metadata to. Initialize with a file or provide one when writing.'); - } outputFile ..createSync(recursive: true) ..writeAsStringSync(toString(), flush: true); diff --git a/packages/flutter_migrate/pubspec.yaml b/packages/flutter_migrate/pubspec.yaml index 6b7ea837663a..8d5ee02c668c 100644 --- a/packages/flutter_migrate/pubspec.yaml +++ b/packages/flutter_migrate/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_migrate description: A tool to migrate legacy flutter projects to modern versions. -version: 0.0.1+2 +version: 0.0.1+3 repository: https://github.com/flutter/packages/tree/main/packages/flutter_migrate issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Ap%3A%20flutter_migrate publish_to: none diff --git a/packages/flutter_migrate/test/src/fakes.dart b/packages/flutter_migrate/test/src/fakes.dart index b78ed64bca72..498213a6f7b0 100644 --- a/packages/flutter_migrate/test/src/fakes.dart +++ b/packages/flutter_migrate/test/src/fakes.dart @@ -127,7 +127,6 @@ class MemoryStdout extends MemoryIOSink implements io.Stdout { @override bool get hasTerminal => _hasTerminal; set hasTerminal(bool value) { - assert(value != null); _hasTerminal = value; } @@ -139,7 +138,6 @@ class MemoryStdout extends MemoryIOSink implements io.Stdout { @override bool get supportsAnsiEscapes => _supportsAnsiEscapes; set supportsAnsiEscapes(bool value) { - assert(value != null); _supportsAnsiEscapes = value; } diff --git a/packages/flutter_migrate/test/test_data/migrate_project.dart b/packages/flutter_migrate/test/test_data/migrate_project.dart index 90d68890bc22..e62afdfc58ad 100644 --- a/packages/flutter_migrate/test/test_data/migrate_project.dart +++ b/packages/flutter_migrate/test/test_data/migrate_project.dart @@ -67,10 +67,8 @@ class MigrateProject extends Project { }) async { this.dir = dir; _appPath = dir.path; - if (androidLocalProperties != null) { - writeFile(fileSystem.path.join(dir.path, 'android', 'local.properties'), - androidLocalProperties); - } + writeFile(fileSystem.path.join(dir.path, 'android', 'local.properties'), + androidLocalProperties); final Directory tempDir = createResolvedTempDirectorySync('cipd_dest.'); final Directory depotToolsDir = createResolvedTempDirectorySync('depot_tools.'); diff --git a/packages/go_router/CHANGELOG.md b/packages/go_router/CHANGELOG.md index dc2b5c0360f5..4a0d29b6c6a7 100644 --- a/packages/go_router/CHANGELOG.md +++ b/packages/go_router/CHANGELOG.md @@ -1,3 +1,7 @@ +## 7.1.1 + +* Removes obsolete null checks on non-nullable values. + ## 7.1.0 - Introduces `StatefulShellRoute` to support using separate navigators for child routes as well as preserving state in each navigation tree (flutter/flutter#99124). @@ -39,7 +43,7 @@ ## 6.5.7 -- Fixes a bug that go_router would crash if `GoRoute.pageBuilder` depends on `InheritedWidget`s. +- Fixes a bug that go_router would crash if `GoRoute.pageBuilder` depends on `InheritedWidget`s. ## 6.5.6 diff --git a/packages/go_router/lib/src/route.dart b/packages/go_router/lib/src/route.dart index 69b27e3694ad..80a885ed8afd 100644 --- a/packages/go_router/lib/src/route.dart +++ b/packages/go_router/lib/src/route.dart @@ -1198,7 +1198,7 @@ class _RestorableRouteMatchList extends RestorableProperty { @override Object? toPrimitives() { - if (value != null && value.isNotEmpty) { + if (value.isNotEmpty) { return _matchListCodec.encodeMatchList(value); } return null; diff --git a/packages/go_router/pubspec.yaml b/packages/go_router/pubspec.yaml index 00f849daa36f..7aae5cb12e5e 100644 --- a/packages/go_router/pubspec.yaml +++ b/packages/go_router/pubspec.yaml @@ -1,7 +1,7 @@ name: go_router description: A declarative router for Flutter based on Navigation 2 supporting deep linking, data-driven routes and more -version: 7.1.0 +version: 7.1.1 repository: https://github.com/flutter/packages/tree/main/packages/go_router issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22 diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index dce753c4806c..b3ccb3741d8d 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.2.7 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 2.2.6 diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart b/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart index cd3d0781e471..dedb8400a32e 100644 --- a/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart +++ b/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart @@ -27,7 +27,6 @@ class GoogleMapController { CameraPosition initialCameraPosition, _GoogleMapState googleMapState, ) async { - assert(id != null); await GoogleMapsFlutterPlatform.instance.init(id); return GoogleMapController._( googleMapState, @@ -100,7 +99,6 @@ class GoogleMapController { /// /// The returned [Future] completes after listeners have been notified. Future _updateMarkers(MarkerUpdates markerUpdates) { - assert(markerUpdates != null); return GoogleMapsFlutterPlatform.instance .updateMarkers(markerUpdates, mapId: mapId); } @@ -112,7 +110,6 @@ class GoogleMapController { /// /// The returned [Future] completes after listeners have been notified. Future _updatePolygons(PolygonUpdates polygonUpdates) { - assert(polygonUpdates != null); return GoogleMapsFlutterPlatform.instance .updatePolygons(polygonUpdates, mapId: mapId); } @@ -124,7 +121,6 @@ class GoogleMapController { /// /// The returned [Future] completes after listeners have been notified. Future _updatePolylines(PolylineUpdates polylineUpdates) { - assert(polylineUpdates != null); return GoogleMapsFlutterPlatform.instance .updatePolylines(polylineUpdates, mapId: mapId); } @@ -136,7 +132,6 @@ class GoogleMapController { /// /// The returned [Future] completes after listeners have been notified. Future _updateCircles(CircleUpdates circleUpdates) { - assert(circleUpdates != null); return GoogleMapsFlutterPlatform.instance .updateCircles(circleUpdates, mapId: mapId); } @@ -160,7 +155,6 @@ class GoogleMapController { /// in-memory cache of tiles. If you want to cache tiles for longer, you /// should implement an on-disk cache. Future clearTileCache(TileOverlayId tileOverlayId) async { - assert(tileOverlayId != null); return GoogleMapsFlutterPlatform.instance .clearTileCache(tileOverlayId, mapId: mapId); } @@ -234,7 +228,6 @@ class GoogleMapController { /// * [hideMarkerInfoWindow] to hide the Info Window. /// * [isMarkerInfoWindowShown] to check if the Info Window is showing. Future showMarkerInfoWindow(MarkerId markerId) { - assert(markerId != null); return GoogleMapsFlutterPlatform.instance .showMarkerInfoWindow(markerId, mapId: mapId); } @@ -248,7 +241,6 @@ class GoogleMapController { /// * [showMarkerInfoWindow] to show the Info Window. /// * [isMarkerInfoWindowShown] to check if the Info Window is showing. Future hideMarkerInfoWindow(MarkerId markerId) { - assert(markerId != null); return GoogleMapsFlutterPlatform.instance .hideMarkerInfoWindow(markerId, mapId: mapId); } @@ -262,7 +254,6 @@ class GoogleMapController { /// * [showMarkerInfoWindow] to show the Info Window. /// * [hideMarkerInfoWindow] to hide the Info Window. Future isMarkerInfoWindowShown(MarkerId markerId) { - assert(markerId != null); return GoogleMapsFlutterPlatform.instance .isMarkerInfoWindowShown(markerId, mapId: mapId); } diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart index 15ea6182d7b2..a081eab75859 100644 --- a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart @@ -123,7 +123,7 @@ class GoogleMap extends StatefulWidget { this.onCameraIdle, this.onTap, this.onLongPress, - }) : assert(initialCameraPosition != null); + }); /// Callback method for when the map is ready to be used. /// @@ -418,7 +418,6 @@ class _GoogleMapState extends State { } void onMarkerTap(MarkerId markerId) { - assert(markerId != null); final Marker? marker = _markers[markerId]; if (marker == null) { throw UnknownMapObjectIdError('marker', markerId, 'onTap'); @@ -430,7 +429,6 @@ class _GoogleMapState extends State { } void onMarkerDragStart(MarkerId markerId, LatLng position) { - assert(markerId != null); final Marker? marker = _markers[markerId]; if (marker == null) { throw UnknownMapObjectIdError('marker', markerId, 'onDragStart'); @@ -442,7 +440,6 @@ class _GoogleMapState extends State { } void onMarkerDrag(MarkerId markerId, LatLng position) { - assert(markerId != null); final Marker? marker = _markers[markerId]; if (marker == null) { throw UnknownMapObjectIdError('marker', markerId, 'onDrag'); @@ -454,7 +451,6 @@ class _GoogleMapState extends State { } void onMarkerDragEnd(MarkerId markerId, LatLng position) { - assert(markerId != null); final Marker? marker = _markers[markerId]; if (marker == null) { throw UnknownMapObjectIdError('marker', markerId, 'onDragEnd'); @@ -466,7 +462,6 @@ class _GoogleMapState extends State { } void onPolygonTap(PolygonId polygonId) { - assert(polygonId != null); final Polygon? polygon = _polygons[polygonId]; if (polygon == null) { throw UnknownMapObjectIdError('polygon', polygonId, 'onTap'); @@ -478,7 +473,6 @@ class _GoogleMapState extends State { } void onPolylineTap(PolylineId polylineId) { - assert(polylineId != null); final Polyline? polyline = _polylines[polylineId]; if (polyline == null) { throw UnknownMapObjectIdError('polyline', polylineId, 'onTap'); @@ -490,7 +484,6 @@ class _GoogleMapState extends State { } void onCircleTap(CircleId circleId) { - assert(circleId != null); final Circle? circle = _circles[circleId]; if (circle == null) { throw UnknownMapObjectIdError('marker', circleId, 'onTap'); @@ -502,7 +495,6 @@ class _GoogleMapState extends State { } void onInfoWindowTap(MarkerId markerId) { - assert(markerId != null); final Marker? marker = _markers[markerId]; if (marker == null) { throw UnknownMapObjectIdError('marker', markerId, 'InfoWindow onTap'); @@ -514,7 +506,6 @@ class _GoogleMapState extends State { } void onTap(LatLng position) { - assert(position != null); final ArgumentCallback? onTap = widget.onTap; if (onTap != null) { onTap(position); @@ -522,7 +513,6 @@ class _GoogleMapState extends State { } void onLongPress(LatLng position) { - assert(position != null); final ArgumentCallback? onLongPress = widget.onLongPress; if (onLongPress != null) { onLongPress(position); diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index 46911bc48fed..48b156256899 100644 --- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter description: A Flutter plugin for integrating Google Maps in iOS and Android applications. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.2.6 +version: 2.2.7 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart b/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart index 2c6aba1bb0ba..c28ff1f4f55f 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart @@ -293,9 +293,6 @@ class FakePlatformGoogleMap { } void updateTileOverlays(Map updateTileOverlayUpdates) { - if (updateTileOverlayUpdates == null) { - return; - } final List>? tileOverlaysToAddList = updateTileOverlayUpdates['tileOverlaysToAdd'] != null ? List.castFrom>( diff --git a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md index 4f9339999eb6..7b054ced1270 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.4.15 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 2.4.14 diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart index e072952c3673..132cd4905bea 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart @@ -307,7 +307,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { Map optionsUpdate, { required int mapId, }) { - assert(optionsUpdate != null); return _channel(mapId).invokeMethod( 'map#update', { @@ -321,7 +320,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { MarkerUpdates markerUpdates, { required int mapId, }) { - assert(markerUpdates != null); return _channel(mapId).invokeMethod( 'markers#update', markerUpdates.toJson(), @@ -333,7 +331,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { PolygonUpdates polygonUpdates, { required int mapId, }) { - assert(polygonUpdates != null); return _channel(mapId).invokeMethod( 'polygons#update', polygonUpdates.toJson(), @@ -345,7 +342,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { PolylineUpdates polylineUpdates, { required int mapId, }) { - assert(polylineUpdates != null); return _channel(mapId).invokeMethod( 'polylines#update', polylineUpdates.toJson(), @@ -357,7 +353,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { CircleUpdates circleUpdates, { required int mapId, }) { - assert(circleUpdates != null); return _channel(mapId).invokeMethod( 'circles#update', circleUpdates.toJson(), @@ -468,7 +463,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { MarkerId markerId, { required int mapId, }) { - assert(markerId != null); return _channel(mapId).invokeMethod( 'markers#showInfoWindow', {'markerId': markerId.value}); } @@ -478,7 +472,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { MarkerId markerId, { required int mapId, }) { - assert(markerId != null); return _channel(mapId).invokeMethod( 'markers#hideInfoWindow', {'markerId': markerId.value}); } @@ -488,7 +481,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { MarkerId markerId, { required int mapId, }) async { - assert(markerId != null); return (await _channel(mapId).invokeMethod( 'markers#isInfoWindowShown', {'markerId': markerId.value}))!; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml index 726ad025de86..04c9f12bbbaa 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_android description: Android implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.4.14 +version: 2.4.15 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md index 5913424b9331..703010222f34 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.2.3 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 2.2.2 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart index affd706e022b..b1ecca20817a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart @@ -289,7 +289,6 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { Map optionsUpdate, { required int mapId, }) { - assert(optionsUpdate != null); return _channel(mapId).invokeMethod( 'map#update', { @@ -303,7 +302,6 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { MarkerUpdates markerUpdates, { required int mapId, }) { - assert(markerUpdates != null); return _channel(mapId).invokeMethod( 'markers#update', markerUpdates.toJson(), @@ -315,7 +313,6 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { PolygonUpdates polygonUpdates, { required int mapId, }) { - assert(polygonUpdates != null); return _channel(mapId).invokeMethod( 'polygons#update', polygonUpdates.toJson(), @@ -327,7 +324,6 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { PolylineUpdates polylineUpdates, { required int mapId, }) { - assert(polylineUpdates != null); return _channel(mapId).invokeMethod( 'polylines#update', polylineUpdates.toJson(), @@ -339,7 +335,6 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { CircleUpdates circleUpdates, { required int mapId, }) { - assert(circleUpdates != null); return _channel(mapId).invokeMethod( 'circles#update', circleUpdates.toJson(), @@ -450,7 +445,6 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { MarkerId markerId, { required int mapId, }) { - assert(markerId != null); return _channel(mapId).invokeMethod( 'markers#showInfoWindow', {'markerId': markerId.value}); } @@ -460,7 +454,6 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { MarkerId markerId, { required int mapId, }) { - assert(markerId != null); return _channel(mapId).invokeMethod( 'markers#hideInfoWindow', {'markerId': markerId.value}); } @@ -470,7 +463,6 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { MarkerId markerId, { required int mapId, }) async { - assert(markerId != null); return (await _channel(mapId).invokeMethod( 'markers#isInfoWindowShown', {'markerId': markerId.value}))!; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml index f24935c9105f..499387f64336 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_ios description: iOS implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.2.2 +version: 2.2.3 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md index 0fb0375c0d97..c93d3e2fa5bc 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.2.7 +* Removes obsolete null checks on non-nullable values. * Updates minimum Flutter version to 3.3. * Aligns Dart and Flutter SDK constraints. diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/method_channel_google_maps_flutter.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/method_channel_google_maps_flutter.dart index 3fd860e126eb..dc55e7443276 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/method_channel_google_maps_flutter.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/method_channel_google_maps_flutter.dart @@ -292,7 +292,6 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { Map optionsUpdate, { required int mapId, }) { - assert(optionsUpdate != null); return channel(mapId).invokeMethod( 'map#update', { @@ -306,7 +305,6 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { MarkerUpdates markerUpdates, { required int mapId, }) { - assert(markerUpdates != null); return channel(mapId).invokeMethod( 'markers#update', markerUpdates.toJson(), @@ -318,7 +316,6 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { PolygonUpdates polygonUpdates, { required int mapId, }) { - assert(polygonUpdates != null); return channel(mapId).invokeMethod( 'polygons#update', polygonUpdates.toJson(), @@ -330,7 +327,6 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { PolylineUpdates polylineUpdates, { required int mapId, }) { - assert(polylineUpdates != null); return channel(mapId).invokeMethod( 'polylines#update', polylineUpdates.toJson(), @@ -342,7 +338,6 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { CircleUpdates circleUpdates, { required int mapId, }) { - assert(circleUpdates != null); return channel(mapId).invokeMethod( 'circles#update', circleUpdates.toJson(), @@ -452,7 +447,6 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { MarkerId markerId, { required int mapId, }) { - assert(markerId != null); return channel(mapId).invokeMethod( 'markers#showInfoWindow', {'markerId': markerId.value}); } @@ -462,7 +456,6 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { MarkerId markerId, { required int mapId, }) { - assert(markerId != null); return channel(mapId).invokeMethod( 'markers#hideInfoWindow', {'markerId': markerId.value}); } @@ -472,7 +465,6 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { MarkerId markerId, { required int mapId, }) async { - assert(markerId != null); return (await channel(mapId).invokeMethod('markers#isInfoWindowShown', {'markerId': markerId.value}))!; } diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/callbacks.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/callbacks.dart index 5d6af90290e0..41f0fe23ef14 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/callbacks.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/callbacks.dart @@ -44,7 +44,6 @@ class ArgumentCallbacks { /// Adds a callback to this collection. void add(ArgumentCallback callback) { - assert(callback != null); _callbacks.add(callback); } diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/camera.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/camera.dart index 6d1ce164238b..01126afb869e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/camera.dart @@ -23,10 +23,7 @@ class CameraPosition { required this.target, this.tilt = 0.0, this.zoom = 0.0, - }) : assert(bearing != null), - assert(target != null), - assert(tilt != null), - assert(zoom != null); + }); /// The camera's bearing in degrees, measured clockwise from north. /// diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/cap.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/cap.dart index 5bef7baf0bf4..3ca79583d12a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/cap.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/cap.dart @@ -43,7 +43,6 @@ class Cap { BitmapDescriptor bitmapDescriptor, { double refWidth = 10, }) { - assert(bitmapDescriptor != null); assert(refWidth > 0.0); return Cap._(['customCap', bitmapDescriptor.toJson(), refWidth]); } diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/location.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/location.dart index 81fe08bb1329..b00446a542b4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/location.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/location.dart @@ -16,9 +16,7 @@ class LatLng { /// The longitude is normalized to the half-open interval from -180.0 /// (inclusive) to +180.0 (exclusive). const LatLng(double latitude, double longitude) - : assert(latitude != null), - assert(longitude != null), - latitude = + : latitude = latitude < -90.0 ? -90.0 : (90.0 < latitude ? 90.0 : latitude), // Avoids normalization if possible to prevent unnecessary loss of precision longitude = longitude >= -180 && longitude < 180 @@ -76,9 +74,7 @@ class LatLngBounds { /// The latitude of the southwest corner cannot be larger than the /// latitude of the northeast corner. LatLngBounds({required this.southwest, required this.northeast}) - : assert(southwest != null), - assert(northeast != null), - assert(southwest.latitude <= northeast.latitude); + : assert(southwest.latitude <= northeast.latitude); /// The southwest corner of the rectangle. final LatLng southwest; diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/maps_object.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/maps_object.dart index 953746daa745..2f2216c1b330 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/maps_object.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/maps_object.dart @@ -13,7 +13,7 @@ class MapsObjectId { /// Creates an immutable object representing a [T] among [GoogleMap] Ts. /// /// An [AssertionError] will be thrown if [value] is null. - const MapsObjectId(this.value) : assert(value != null); + const MapsObjectId(this.value); /// The value of the id. final String value; diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/marker.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/marker.dart index da3f89df9f71..cd68b53b58ca 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/marker.dart @@ -155,7 +155,7 @@ class Marker implements MapsObject { this.onDrag, this.onDragStart, this.onDragEnd, - }) : assert(alpha == null || (0.0 <= alpha && alpha <= 1.0)); + }) : assert(0.0 <= alpha && alpha <= 1.0); /// Uniquely identifies a [Marker]. final MarkerId markerId; diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart index ce78d3307155..8298b90ae947 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart @@ -148,13 +148,9 @@ class Polygon implements MapsObject { addIfPresent('visible', visible); addIfPresent('zIndex', zIndex); - if (points != null) { - json['points'] = _pointsToJson(); - } + json['points'] = _pointsToJson(); - if (holes != null) { - json['holes'] = _holesToJson(); - } + json['holes'] = _holesToJson(); return json; } diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polyline.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polyline.dart index cd0a64ee7b82..b7d50cd3962d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polyline.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polyline.dart @@ -180,13 +180,9 @@ class Polyline implements MapsObject { addIfPresent('width', width); addIfPresent('zIndex', zIndex); - if (points != null) { - json['points'] = _pointsToJson(); - } + json['points'] = _pointsToJson(); - if (patterns != null) { - json['pattern'] = _patternToJson(); - } + json['pattern'] = _patternToJson(); return json; } @@ -228,9 +224,7 @@ class Polyline implements MapsObject { Object _patternToJson() { final List result = []; for (final PatternItem patternItem in patterns) { - if (patternItem != null) { - result.add(patternItem.toJson()); - } + result.add(patternItem.toJson()); } return result; } diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml index 879604908815..20abc39b27e3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/google_maps_f issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%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.2.6 +version: 2.2.7 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md index 077d012e5b8b..b42ce52c3d99 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.0+9 + +* Removes obsolete null checks on non-nullable values. + ## 0.4.0+8 * Updates minimum Flutter version to 3.3. diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/circles.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/circles.dart index bc6eac14200f..e307941887a4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/circles.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/circles.dart @@ -30,10 +30,6 @@ class CirclesController extends GeometryController { } void _addCircle(Circle circle) { - if (circle == null) { - return; - } - final gmaps.CircleOptions circleOptions = _circleOptionsFromCircle(circle); final gmaps.Circle gmCircle = gmaps.Circle(circleOptions)..map = googleMap; final CircleController controller = CircleController( diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart index dcce8d35699e..3840ef21cc99 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart @@ -9,23 +9,13 @@ final gmaps.LatLng _nullGmapsLatLng = gmaps.LatLng(0, 0); final gmaps.LatLngBounds _nullGmapsLatLngBounds = gmaps.LatLngBounds(_nullGmapsLatLng, _nullGmapsLatLng); -// Defaults taken from the Google Maps Platform SDK documentation. -const String _defaultCssColor = '#000000'; -const double _defaultCssOpacity = 0.0; - // Converts a [Color] into a valid CSS value #RRGGBB. String _getCssColor(Color color) { - if (color == null) { - return _defaultCssColor; - } return '#${color.value.toRadixString(16).padLeft(8, '0').substring(2)}'; } // Extracts the opacity from a [Color]. double _getCssOpacity(Color color) { - if (color == null) { - return _defaultCssOpacity; - } return color.opacity; } @@ -114,11 +104,9 @@ gmaps.MapOptions _applyInitialPosition( gmaps.MapOptions options, ) { // Adjust the initial position, if passed... - if (initialPosition != null) { - options.zoom = initialPosition.zoom; - options.center = gmaps.LatLng( - initialPosition.target.latitude, initialPosition.target.longitude); - } + options.zoom = initialPosition.zoom; + options.center = gmaps.LatLng( + initialPosition.target.latitude, initialPosition.target.longitude); return options; } @@ -255,33 +243,31 @@ gmaps.Icon? _gmIconFromBitmapDescriptor(BitmapDescriptor bitmapDescriptor) { gmaps.Icon? icon; - if (iconConfig != null) { - if (iconConfig[0] == 'fromAssetImage') { - assert(iconConfig.length >= 2); - // iconConfig[2] contains the DPIs of the screen, but that information is - // already encoded in the iconConfig[1] - icon = gmaps.Icon() - ..url = ui.webOnlyAssetManager.getAssetUrl(iconConfig[1]! as String); - - final gmaps.Size? size = _gmSizeFromIconConfig(iconConfig, 3); - if (size != null) { - icon - ..size = size - ..scaledSize = size; - } - } else if (iconConfig[0] == 'fromBytes') { - // Grab the bytes, and put them into a blob - final List bytes = iconConfig[1]! as List; - // Create a Blob from bytes, but let the browser figure out the encoding - final Blob blob = Blob([bytes]); - icon = gmaps.Icon()..url = Url.createObjectUrlFromBlob(blob); - - final gmaps.Size? size = _gmSizeFromIconConfig(iconConfig, 2); - if (size != null) { - icon - ..size = size - ..scaledSize = size; - } + if (iconConfig[0] == 'fromAssetImage') { + assert(iconConfig.length >= 2); + // iconConfig[2] contains the DPIs of the screen, but that information is + // already encoded in the iconConfig[1] + icon = gmaps.Icon() + ..url = ui.webOnlyAssetManager.getAssetUrl(iconConfig[1]! as String); + + final gmaps.Size? size = _gmSizeFromIconConfig(iconConfig, 3); + if (size != null) { + icon + ..size = size + ..scaledSize = size; + } + } else if (iconConfig[0] == 'fromBytes') { + // Grab the bytes, and put them into a blob + final List bytes = iconConfig[1]! as List; + // Create a Blob from bytes, but let the browser figure out the encoding + final Blob blob = Blob([bytes]); + icon = gmaps.Icon()..url = Url.createObjectUrlFromBlob(blob); + + final gmaps.Size? size = _gmSizeFromIconConfig(iconConfig, 2); + if (size != null) { + icon + ..size = size + ..scaledSize = size; } } diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/google_maps_flutter_web.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/google_maps_flutter_web.dart index c2085a2bddfc..b64f99501fcd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/google_maps_flutter_web.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/google_maps_flutter_web.dart @@ -39,7 +39,7 @@ class GoogleMapsPlugin extends GoogleMapsFlutterPlatform { // The internal instance of our controller is initialized eagerly in `buildView`, // so we don't have to do anything in this method, which is left intentionally // blank. - assert(_map(mapId) != null, 'Must call buildWidget before init!'); + assert(_mapById[mapId] != null, 'Must call buildWidget before init!'); } /// Updates the options of a given `mapId`. diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/marker.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/marker.dart index 9d607e9bbc6a..50b4bd3407ea 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/marker.dart @@ -25,25 +25,19 @@ class MarkerController { } if (onDragStart != null) { marker.onDragstart.listen((gmaps.MapMouseEvent event) { - if (marker != null) { - marker.position = event.latLng; - } + marker.position = event.latLng; onDragStart.call(event.latLng ?? _nullGmapsLatLng); }); } if (onDrag != null) { marker.onDrag.listen((gmaps.MapMouseEvent event) { - if (marker != null) { - marker.position = event.latLng; - } + marker.position = event.latLng; onDrag.call(event.latLng ?? _nullGmapsLatLng); }); } if (onDragEnd != null) { marker.onDragend.listen((gmaps.MapMouseEvent event) { - if (marker != null) { - marker.position = event.latLng; - } + marker.position = event.latLng; onDragEnd.call(event.latLng ?? _nullGmapsLatLng); }); } diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/markers.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/markers.dart index 1a712b109677..0c378f9daba3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/markers.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/markers.dart @@ -30,10 +30,6 @@ class MarkersController extends GeometryController { } void _addMarker(Marker marker) { - if (marker == null) { - return; - } - final gmaps.InfoWindowOptions? infoWindowOptions = _infoWindowOptionsFromMarker(marker); gmaps.InfoWindow? gmInfoWindow; diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/polygons.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/polygons.dart index 12e378cfc59c..412fd156524b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/polygons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/polygons.dart @@ -26,16 +26,10 @@ class PolygonsController extends GeometryController { /// /// Wraps each Polygon into its corresponding [PolygonController]. void addPolygons(Set polygonsToAdd) { - if (polygonsToAdd != null) { - polygonsToAdd.forEach(_addPolygon); - } + polygonsToAdd.forEach(_addPolygon); } void _addPolygon(Polygon polygon) { - if (polygon == null) { - return; - } - final gmaps.PolygonOptions polygonOptions = _polygonOptionsFromPolygon(googleMap, polygon); final gmaps.Polygon gmPolygon = gmaps.Polygon(polygonOptions) @@ -51,9 +45,7 @@ class PolygonsController extends GeometryController { /// Updates a set of [Polygon] objects with new options. void changePolygons(Set polygonsToChange) { - if (polygonsToChange != null) { - polygonsToChange.forEach(_changePolygon); - } + polygonsToChange.forEach(_changePolygon); } void _changePolygon(Polygon polygon) { diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/polylines.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/polylines.dart index 2d3f1618b42c..0384ea16cc4b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/polylines.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/polylines.dart @@ -30,10 +30,6 @@ class PolylinesController extends GeometryController { } void _addPolyline(Polyline polyline) { - if (polyline == null) { - return; - } - final gmaps.PolylineOptions polylineOptions = _polylineOptionsFromPolyline(googleMap, polyline); final gmaps.Polyline gmPolyline = gmaps.Polyline(polylineOptions) diff --git a/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml index 67df16f00167..c88b2aefaba5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_web description: Web platform implementation of google_maps_flutter repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 0.4.0+8 +version: 0.4.0+9 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md index 2b728ba9cb4c..1751c5cbfc99 100644 --- a/packages/google_sign_in/google_sign_in/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.1.1 + +* Removes obsolete null checks on non-nullable values. + ## 6.1.0 * Exposes the new method `canAccessScopes`. diff --git a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart index f3afb11c8e93..4af1229882c5 100644 --- a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart +++ b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart @@ -48,9 +48,7 @@ class GoogleSignInAccount implements GoogleIdentity { id = data.id, photoUrl = data.photoUrl, serverAuthCode = data.serverAuthCode, - _idToken = data.idToken { - assert(id != null); - } + _idToken = data.idToken; // These error codes must match with ones declared on Android and iOS sides. diff --git a/packages/google_sign_in/google_sign_in/lib/widgets.dart b/packages/google_sign_in/google_sign_in/lib/widgets.dart index 8d67e60739b3..ab04de4319d5 100644 --- a/packages/google_sign_in/google_sign_in/lib/widgets.dart +++ b/packages/google_sign_in/google_sign_in/lib/widgets.dart @@ -27,7 +27,7 @@ class GoogleUserCircleAvatar extends StatelessWidget { this.placeholderPhotoUrl, this.foregroundColor, this.backgroundColor, - }) : assert(identity != null); + }); /// A regular expression that matches against the "size directive" path /// segment of Google profile image URLs. diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml index f2b7bdd1aa8e..3ac3bf5aa796 100644 --- a/packages/google_sign_in/google_sign_in/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Google Sign-In, a secure authentication system for signing in with a Google account on Android and iOS. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 6.1.0 +version: 6.1.1 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md index 053daa4478dd..cf62ad38ec96 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.0+2 + +* Removes obsolete null checks on non-nullable values. + ## 0.3.0+1 * Fixes misaligned method signature strings. diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.dart index 564b7b4b3686..8132c5b359da 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.dart @@ -205,7 +205,6 @@ class BillingClient { String? oldProduct, String? purchaseToken, ProrationMode? prorationMode}) async { - assert(product != null); assert((oldProduct == null) == (purchaseToken == null), 'oldProduct and purchaseToken must both be set, or both be null.'); final Map arguments = { @@ -237,7 +236,6 @@ class BillingClient { /// This wraps /// [`BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener)`](https://developer.android.com/reference/com/android/billingclient/api/BillingClient#queryPurchasesAsync(com.android.billingclient.api.QueryPurchasesParams,%20com.android.billingclient.api.PurchasesResponseListener)). Future queryPurchases(ProductType productType) async { - assert(productType != null); return PurchasesResultWrapper.fromJson( (await channel.invokeMapMethod( 'BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener)', @@ -262,7 +260,6 @@ class BillingClient { /// [`BillingClient#queryPurchaseHistoryAsync(QueryPurchaseHistoryParams, PurchaseHistoryResponseListener)`](https://developer.android.com/reference/com/android/billingclient/api/BillingClient#queryPurchaseHistoryAsync(com.android.billingclient.api.QueryPurchaseHistoryParams,%20com.android.billingclient.api.PurchaseHistoryResponseListener)). Future queryPurchaseHistory( ProductType productType) async { - assert(productType != null); return PurchasesHistoryResult.fromJson((await channel.invokeMapMethod< String, dynamic>( 'BillingClient#queryPurchaseHistoryAsync(QueryPurchaseHistoryParams, PurchaseHistoryResponseListener)', @@ -280,7 +277,6 @@ class BillingClient { /// This wraps /// [`BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener)`](https://developer.android.com/reference/com/android/billingclient/api/BillingClient.html#consumeAsync(java.lang.String,%20com.android.billingclient.api.ConsumeResponseListener)) Future consumeAsync(String purchaseToken) async { - assert(purchaseToken != null); return BillingResultWrapper.fromJson((await channel.invokeMapMethod( 'BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener)', @@ -309,7 +305,6 @@ class BillingClient { /// This wraps /// [`BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener)`](https://developer.android.com/reference/com/android/billingclient/api/BillingClient.html#acknowledgePurchase(com.android.billingclient.api.AcknowledgePurchaseParams,%20com.android.billingclient.api.AcknowledgePurchaseResponseListener)) Future acknowledgePurchase(String purchaseToken) async { - assert(purchaseToken != null); return BillingResultWrapper.fromJson((await channel.invokeMapMethod( 'BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener)', diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart index ead862098ebe..2e4ed5b0f927 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart @@ -184,11 +184,6 @@ class InAppPurchaseAndroidPlatform extends InAppPurchasePlatform { return const BillingResultWrapper(responseCode: BillingResponse.ok); } - if (googlePurchase.verificationData == null) { - throw ArgumentError( - 'completePurchase unsuccessful. The `purchase.verificationData` is not valid'); - } - return billingClientManager.runWithClient( (BillingClient client) => client.acknowledgePurchase( purchase.verificationData.serverVerificationData), diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart index 3917ac6f264f..eb58d1536c20 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart @@ -50,10 +50,6 @@ class InAppPurchaseAndroidPlatformAddition /// delivered. The user won't be able to buy the same product again until the /// purchase of the product is consumed. Future consumePurchase(PurchaseDetails purchase) { - if (purchase.verificationData == null) { - throw ArgumentError( - 'consumePurchase unsuccessful. The `purchase.verificationData` is not valid'); - } return _billingClientManager.runWithClient( (BillingClient client) => client.consumeAsync(purchase.verificationData.serverVerificationData), diff --git a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml index 3bf2e84fe870..a29be3d68bca 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase_android description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.3.0+1 +version: 0.3.0+2 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md index c639d58ad2a4..25fed8d617d6 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 1.3.4 +* Removes obsolete null checks on non-nullable values. * Updates minimum Flutter version to 3.3. * Aligns Dart and Flutter SDK constraints. diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/errors/in_app_purchase_exception.dart b/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/errors/in_app_purchase_exception.dart index 0a89a6e39a5e..8bac26f17c7d 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/errors/in_app_purchase_exception.dart +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/errors/in_app_purchase_exception.dart @@ -11,7 +11,7 @@ class InAppPurchaseException implements Exception { required this.source, required this.code, this.message, - }) : assert(code != null); + }); /// An error code. final String code; diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml index 868f7587b752..ae851c7609c9 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/in_app_purcha issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%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: 1.3.3 +version: 1.3.4 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md index 7f05c0ff8ec0..4c13eabc32f7 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 0.3.6+4 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 0.3.6+3 diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart index 0e5e420ece85..36d706ce5fe9 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart @@ -131,12 +131,10 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { invalidProductIdentifiers: identifiers.toList()); } List productDetails = []; - if (response.products != null) { - productDetails = response.products - .map((SKProductWrapper productWrapper) => - AppStoreProductDetails.fromSKProduct(productWrapper)) - .toList(); - } + productDetails = response.products + .map((SKProductWrapper productWrapper) => + AppStoreProductDetails.fromSKProduct(productWrapper)) + .toList(); List invalidIdentifiers = response.invalidProductIdentifiers; if (productDetails.isEmpty) { invalidIdentifiers = identifiers.toList(); diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_wrappers/sk_payment_queue_wrapper.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_wrappers/sk_payment_queue_wrapper.dart index 859946b557bf..361cb3af2d9e 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_wrappers/sk_payment_queue_wrapper.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_wrappers/sk_payment_queue_wrapper.dart @@ -398,7 +398,6 @@ class SKPaymentWrapper { /// types of all of the members on this class. The `map` parameter must not be /// null. factory SKPaymentWrapper.fromJson(Map map) { - assert(map != null); return _$SKPaymentWrapperFromJson(map); } @@ -515,7 +514,6 @@ class SKPaymentDiscountWrapper { /// The map needs to have named string keys with values matching the names and /// types of all of the members on this class. factory SKPaymentDiscountWrapper.fromJson(Map map) { - assert(map != null); return _$SKPaymentDiscountWrapperFromJson(map); } diff --git a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml index 79a41cbab264..48a6e34e8610 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase_storekit description: An implementation for the iOS and macOS platforms of the Flutter `in_app_purchase` plugin. This uses the StoreKit Framework. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_storekit issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.3.6+3 +version: 0.3.6+4 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/ios_platform_images/example/test/widget_test.dart b/packages/ios_platform_images/example/test/widget_test.dart index f3cd4c68b65b..5b50a0f001e2 100644 --- a/packages/ios_platform_images/example/test/widget_test.dart +++ b/packages/ios_platform_images/example/test/widget_test.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:io'; - import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -16,8 +14,7 @@ void main() { expect( find.byWidgetPredicate( - (Widget widget) => - widget is Image && (!Platform.isIOS || widget.image != null), + (Widget widget) => widget is Image, ), findsOneWidget, ); diff --git a/packages/metrics_center/CHANGELOG.md b/packages/metrics_center/CHANGELOG.md index ca2168267ab5..ba74ca19a830 100644 --- a/packages/metrics_center/CHANGELOG.md +++ b/packages/metrics_center/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 1.0.8 +* Removes obsolete null checks on non-nullable values. * Updates minimum Flutter version to 3.3. ## 1.0.7 diff --git a/packages/metrics_center/lib/src/gcs_lock.dart b/packages/metrics_center/lib/src/gcs_lock.dart index 5e6b2dfdca77..6f89fc83df53 100644 --- a/packages/metrics_center/lib/src/gcs_lock.dart +++ b/packages/metrics_center/lib/src/gcs_lock.dart @@ -12,9 +12,7 @@ class GcsLock { /// Create a lock with an authenticated client and a GCS bucket name. /// /// The client is used to communicate with Google Cloud Storage APIs. - GcsLock(this._client, this._bucketName) - : assert(_client != null), - assert(_bucketName != null) { + GcsLock(this._client, this._bucketName) { _api = StorageApi(_client); } diff --git a/packages/metrics_center/lib/src/skiaperf.dart b/packages/metrics_center/lib/src/skiaperf.dart index 1e30e635588d..45a00f34f502 100644 --- a/packages/metrics_center/lib/src/skiaperf.dart +++ b/packages/metrics_center/lib/src/skiaperf.dart @@ -201,7 +201,7 @@ class SkiaPerfPoint extends MetricPoint { class SkiaPerfGcsAdaptor { /// Construct the adaptor given the associated GCS bucket where the data is /// read from and written to. - SkiaPerfGcsAdaptor(this._gcsBucket) : assert(_gcsBucket != null); + SkiaPerfGcsAdaptor(this._gcsBucket); /// Used by Skia to differentiate json file format versions. static const int version = 1; @@ -285,7 +285,6 @@ class SkiaPerfGcsAdaptor { final String firstGcsNameComponent = objectName.split('/')[0]; _populateGcsNameToGithubRepoMapIfNeeded(); final String githubRepo = _gcsNameToGithubRepo[firstGcsNameComponent]!; - assert(githubRepo != null); final String? gitHash = decodedJson[kSkiaPerfGitHashKey] as String?; final Map results = @@ -403,11 +402,9 @@ class SkiaPerfDestination extends MetricDestination { >>{}; for (final SkiaPerfPoint p in points.map((MetricPoint x) => SkiaPerfPoint.fromPoint(x))) { - if (p != null) { - pointMap[p.githubRepo] ??= >{}; - pointMap[p.githubRepo]![p.gitHash] ??= {}; - pointMap[p.githubRepo]![p.gitHash]![p.id] = p; - } + pointMap[p.githubRepo] ??= >{}; + pointMap[p.githubRepo]![p.gitHash] ??= {}; + pointMap[p.githubRepo]![p.gitHash]![p.id] = p; } // All created locks must be released before returning diff --git a/packages/metrics_center/pubspec.yaml b/packages/metrics_center/pubspec.yaml index 289810749cee..488efd4a1a6e 100644 --- a/packages/metrics_center/pubspec.yaml +++ b/packages/metrics_center/pubspec.yaml @@ -1,5 +1,5 @@ name: metrics_center -version: 1.0.7 +version: 1.0.8 description: Support multiple performance metrics sources/formats and destinations. repository: https://github.com/flutter/packages/tree/main/packages/metrics_center diff --git a/packages/path_provider/path_provider_linux/CHANGELOG.md b/packages/path_provider/path_provider_linux/CHANGELOG.md index 248150a726bb..7b4f83da3fd9 100644 --- a/packages/path_provider/path_provider_linux/CHANGELOG.md +++ b/packages/path_provider/path_provider_linux/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.1.11 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 2.1.10 diff --git a/packages/path_provider/path_provider_linux/lib/src/get_application_id_real.dart b/packages/path_provider/path_provider_linux/lib/src/get_application_id_real.dart index f01c3e4ee15e..5e16df06c410 100644 --- a/packages/path_provider/path_provider_linux/lib/src/get_application_id_real.dart +++ b/packages/path_provider/path_provider_linux/lib/src/get_application_id_real.dart @@ -71,7 +71,7 @@ String? getApplicationId() { return null; } final Pointer appId = gio.gApplicationGetApplicationId(app); - if (appId == null || appId == nullptr) { + if (appId == nullptr) { return null; } return appId.toDartString(); diff --git a/packages/path_provider/path_provider_linux/pubspec.yaml b/packages/path_provider/path_provider_linux/pubspec.yaml index e5b1f8ae32cd..a72228fd93d4 100644 --- a/packages/path_provider/path_provider_linux/pubspec.yaml +++ b/packages/path_provider/path_provider_linux/pubspec.yaml @@ -2,7 +2,7 @@ name: path_provider_linux description: Linux implementation of the path_provider plugin repository: https://github.com/flutter/packages/tree/main/packages/path_provider/path_provider_linux issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22 -version: 2.1.10 +version: 2.1.11 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/quick_actions/quick_actions/CHANGELOG.md b/packages/quick_actions/quick_actions/CHANGELOG.md index 47e1dcc59b7e..4c5a3cec9967 100644 --- a/packages/quick_actions/quick_actions/CHANGELOG.md +++ b/packages/quick_actions/quick_actions/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.4 + +* Removes obsolete null checks on non-nullable values. + ## 1.0.3 * Updates iOS minimum version in README. diff --git a/packages/quick_actions/quick_actions/example/lib/main.dart b/packages/quick_actions/quick_actions/example/lib/main.dart index 759f7f132158..14429284c621 100644 --- a/packages/quick_actions/quick_actions/example/lib/main.dart +++ b/packages/quick_actions/quick_actions/example/lib/main.dart @@ -43,9 +43,7 @@ class _MyHomePageState extends State { const QuickActions quickActions = QuickActions(); quickActions.initialize((String shortcutType) { setState(() { - if (shortcutType != null) { - shortcut = shortcutType; - } + shortcut = shortcutType; }); }); diff --git a/packages/quick_actions/quick_actions/pubspec.yaml b/packages/quick_actions/quick_actions/pubspec.yaml index 6c3c4ff2569f..5fea6a036be1 100644 --- a/packages/quick_actions/quick_actions/pubspec.yaml +++ b/packages/quick_actions/quick_actions/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for creating shortcuts on home screen, also known as Quick Actions on iOS and App Shortcuts on Android. repository: https://github.com/flutter/packages/tree/main/packages/quick_actions/quick_actions issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+quick_actions%22 -version: 1.0.3 +version: 1.0.4 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/quick_actions/quick_actions_android/CHANGELOG.md b/packages/quick_actions/quick_actions_android/CHANGELOG.md index 7b64d19f9749..c1a07dcda768 100644 --- a/packages/quick_actions/quick_actions_android/CHANGELOG.md +++ b/packages/quick_actions/quick_actions_android/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 1.0.6 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 1.0.5 diff --git a/packages/quick_actions/quick_actions_android/example/lib/main.dart b/packages/quick_actions/quick_actions_android/example/lib/main.dart index e39e6afef539..a0352c8e482e 100644 --- a/packages/quick_actions/quick_actions_android/example/lib/main.dart +++ b/packages/quick_actions/quick_actions_android/example/lib/main.dart @@ -43,9 +43,7 @@ class _MyHomePageState extends State { final QuickActionsAndroid quickActions = QuickActionsAndroid(); quickActions.initialize((String shortcutType) { setState(() { - if (shortcutType != null) { - shortcut = '$shortcutType has launched'; - } + shortcut = '$shortcutType has launched'; }); }); diff --git a/packages/quick_actions/quick_actions_android/pubspec.yaml b/packages/quick_actions/quick_actions_android/pubspec.yaml index 2091c289ee43..04884c40e4a5 100644 --- a/packages/quick_actions/quick_actions_android/pubspec.yaml +++ b/packages/quick_actions/quick_actions_android/pubspec.yaml @@ -2,7 +2,7 @@ name: quick_actions_android description: An implementation for the Android platform of the Flutter `quick_actions` plugin. repository: https://github.com/flutter/packages/tree/main/packages/quick_actions/quick_actions_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 1.0.5 +version: 1.0.6 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/quick_actions/quick_actions_ios/CHANGELOG.md b/packages/quick_actions/quick_actions_ios/CHANGELOG.md index 904db78433ab..205e1ce43c21 100644 --- a/packages/quick_actions/quick_actions_ios/CHANGELOG.md +++ b/packages/quick_actions/quick_actions_ios/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 1.0.6 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 1.0.5 diff --git a/packages/quick_actions/quick_actions_ios/example/lib/main.dart b/packages/quick_actions/quick_actions_ios/example/lib/main.dart index f2c8d61b8def..f3e9f92b2cbb 100644 --- a/packages/quick_actions/quick_actions_ios/example/lib/main.dart +++ b/packages/quick_actions/quick_actions_ios/example/lib/main.dart @@ -43,9 +43,7 @@ class _MyHomePageState extends State { final QuickActionsIos quickActions = QuickActionsIos(); quickActions.initialize((String shortcutType) { setState(() { - if (shortcutType != null) { - shortcut = shortcutType; - } + shortcut = shortcutType; }); }); diff --git a/packages/quick_actions/quick_actions_ios/pubspec.yaml b/packages/quick_actions/quick_actions_ios/pubspec.yaml index aa9cfb04ed3e..6800f01ac221 100644 --- a/packages/quick_actions/quick_actions_ios/pubspec.yaml +++ b/packages/quick_actions/quick_actions_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: quick_actions_ios description: An implementation for the iOS platform of the Flutter `quick_actions` plugin. repository: https://github.com/flutter/packages/tree/main/packages/quick_actions/quick_actions_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 1.0.5 +version: 1.0.6 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/url_launcher/url_launcher_web/CHANGELOG.md b/packages/url_launcher/url_launcher_web/CHANGELOG.md index 91ef9e42e4fa..ad65f305d64d 100644 --- a/packages/url_launcher/url_launcher_web/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_web/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.0.17 +* Removes obsolete null checks on non-nullable values. * Updates minimum Flutter version to 3.3. ## 2.0.16 diff --git a/packages/url_launcher/url_launcher_web/lib/src/link.dart b/packages/url_launcher/url_launcher_web/lib/src/link.dart index df1fd140a2d1..ecb595c21f01 100644 --- a/packages/url_launcher/url_launcher_web/lib/src/link.dart +++ b/packages/url_launcher/url_launcher_web/lib/src/link.dart @@ -166,8 +166,6 @@ class LinkViewController extends PlatformViewController { late html.Element _element; - bool get _isInitialized => _element != null; - Future _initialize() async { _element = html.Element.tag('a'); setProperty(_element, linkViewIdProperty, viewId); @@ -219,7 +217,6 @@ class LinkViewController extends PlatformViewController { /// /// When Uri is null, the `href` attribute of the link is removed. void setUri(Uri? uri) { - assert(_isInitialized); _uri = uri; if (uri == null) { _element.removeAttribute('href'); @@ -236,7 +233,6 @@ class LinkViewController extends PlatformViewController { /// Set the [LinkTarget] value for this link. void setTarget(LinkTarget target) { - assert(_isInitialized); _element.setAttribute('target', _getHtmlTarget(target)); } @@ -270,14 +266,12 @@ class LinkViewController extends PlatformViewController { @override Future dispose() async { - if (_isInitialized) { - assert(_instances[viewId] == this); - _instances.remove(viewId); - if (_instances.isEmpty) { - await _clickSubscription.cancel(); - } - await SystemChannels.platform_views.invokeMethod('dispose', viewId); + assert(_instances[viewId] == this); + _instances.remove(viewId); + if (_instances.isEmpty) { + await _clickSubscription.cancel(); } + await SystemChannels.platform_views.invokeMethod('dispose', viewId); } } diff --git a/packages/url_launcher/url_launcher_web/lib/src/third_party/platform_detect/browser.dart b/packages/url_launcher/url_launcher_web/lib/src/third_party/platform_detect/browser.dart index 6935cb55df77..ed24b924d515 100644 --- a/packages/url_launcher/url_launcher_web/lib/src/third_party/platform_detect/browser.dart +++ b/packages/url_launcher/url_launcher_web/lib/src/third_party/platform_detect/browser.dart @@ -28,8 +28,5 @@ bool navigatorIsSafari(html.Navigator navigator) { // An web view running in an iOS app does not have a 'Version/X.X.X' string in the appVersion final String vendor = navigator.vendor; final String appVersion = navigator.appVersion; - return vendor != null && - vendor.contains('Apple') && - appVersion != null && - appVersion.contains('Version'); + return vendor.contains('Apple') && appVersion.contains('Version'); } diff --git a/packages/url_launcher/url_launcher_web/lib/url_launcher_web.dart b/packages/url_launcher/url_launcher_web/lib/url_launcher_web.dart index 636cd8c513a3..4764d5c48e06 100644 --- a/packages/url_launcher/url_launcher_web/lib/url_launcher_web.dart +++ b/packages/url_launcher/url_launcher_web/lib/url_launcher_web.dart @@ -83,8 +83,8 @@ class UrlLauncherPlugin extends UrlLauncherPlatform { bool universalLinksOnly = false, Map headers = const {}, String? webOnlyWindowName, - }) { - return Future.value( - openNewWindow(url, webOnlyWindowName: webOnlyWindowName) != null); + }) async { + openNewWindow(url, webOnlyWindowName: webOnlyWindowName); + return true; } } diff --git a/packages/url_launcher/url_launcher_web/pubspec.yaml b/packages/url_launcher/url_launcher_web/pubspec.yaml index 755dcd507a58..b8b1869681cd 100644 --- a/packages/url_launcher/url_launcher_web/pubspec.yaml +++ b/packages/url_launcher/url_launcher_web/pubspec.yaml @@ -2,7 +2,7 @@ name: url_launcher_web description: Web platform implementation of url_launcher repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22 -version: 2.0.16 +version: 2.0.17 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/web_benchmarks/CHANGELOG.md b/packages/web_benchmarks/CHANGELOG.md index 9fba3a540a9e..f01d493d7922 100644 --- a/packages/web_benchmarks/CHANGELOG.md +++ b/packages/web_benchmarks/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 0.1.0+4 +* Removes obsolete null checks on non-nullable values. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 0.1.0+3 diff --git a/packages/web_benchmarks/lib/client.dart b/packages/web_benchmarks/lib/client.dart index 6676dc8f6ba9..43ef711918cd 100644 --- a/packages/web_benchmarks/lib/client.dart +++ b/packages/web_benchmarks/lib/client.dart @@ -30,8 +30,6 @@ final LocalBenchmarkServerClient _client = LocalBenchmarkServerClient(); /// When used without a server, prompts the user to select a benchmark to /// run next. Future runBenchmarks(Map benchmarks) async { - assert(benchmarks != null); - // Set local benchmarks. _benchmarks = benchmarks; diff --git a/packages/web_benchmarks/lib/src/benchmark_result.dart b/packages/web_benchmarks/lib/src/benchmark_result.dart index f4326291fbf8..125bc2cd4ec9 100644 --- a/packages/web_benchmarks/lib/src/benchmark_result.dart +++ b/packages/web_benchmarks/lib/src/benchmark_result.dart @@ -10,7 +10,7 @@ class BenchmarkScore { BenchmarkScore({ required this.metric, required this.value, - }) : assert(metric != null && value != null); + }); /// The name of the metric that this score is categorized under. /// diff --git a/packages/web_benchmarks/lib/src/browser.dart b/packages/web_benchmarks/lib/src/browser.dart index 40894ddd4b32..0918730d5cc8 100644 --- a/packages/web_benchmarks/lib/src/browser.dart +++ b/packages/web_benchmarks/lib/src/browser.dart @@ -345,12 +345,6 @@ class BlinkTraceSummary { orElse: () => throw noMeasuredFramesFound(), ); - if (firstMeasuredFrameEvent == null) { - // This happens in benchmarks that do not measure frames, such as some - // of the text layout benchmarks. - return null; - } - final int tabPid = firstMeasuredFrameEvent.pid; // Filter out data from unrelated processes diff --git a/packages/web_benchmarks/lib/src/recorder.dart b/packages/web_benchmarks/lib/src/recorder.dart index 52dc6b8c567e..51fa697cecfd 100644 --- a/packages/web_benchmarks/lib/src/recorder.dart +++ b/packages/web_benchmarks/lib/src/recorder.dart @@ -827,8 +827,7 @@ class Profile { /// /// [name] and [useCustomWarmUp] must not be null. Profile({required this.name, this.useCustomWarmUp = false}) - : assert(name != null), - _isWarmingUp = useCustomWarmUp; + : _isWarmingUp = useCustomWarmUp; /// The name of the benchmark that produced this profile. final String name; @@ -1213,13 +1212,6 @@ final Map _engineBenchmarkListeners = /// If another listener is already registered, overrides it. void registerEngineBenchmarkValueListener( String name, EngineBenchmarkValueListener listener) { - if (listener == null) { - throw ArgumentError( - 'Listener must not be null. To stop listening to engine benchmark values ' - 'under label "$name", call stopListeningToEngineBenchmarkValues(\'$name\').', - ); - } - if (_engineBenchmarkListeners.containsKey(name)) { throw StateError('A listener for "$name" is already registered.\n' 'Call `stopListeningToEngineBenchmarkValues` to unregister the previous ' diff --git a/packages/web_benchmarks/lib/src/runner.dart b/packages/web_benchmarks/lib/src/runner.dart index 7c58e620001c..8ab5d2709b6b 100644 --- a/packages/web_benchmarks/lib/src/runner.dart +++ b/packages/web_benchmarks/lib/src/runner.dart @@ -278,11 +278,11 @@ class BenchmarkServer { final List scoreKeys = List.from(profile['scoreKeys'] as Iterable); - if (scoreKeys == null || scoreKeys.isEmpty) { + if (scoreKeys.isEmpty) { throw StateError('No score keys in benchmark "$benchmarkName"'); } for (final String scoreKey in scoreKeys) { - if (scoreKey == null || scoreKey.isEmpty) { + if (scoreKey.isEmpty) { throw StateError( 'Score key is empty in benchmark "$benchmarkName". ' 'Received [${scoreKeys.join(', ')}]'); diff --git a/packages/web_benchmarks/pubspec.yaml b/packages/web_benchmarks/pubspec.yaml index 3bc83242062d..18c833792ba3 100644 --- a/packages/web_benchmarks/pubspec.yaml +++ b/packages/web_benchmarks/pubspec.yaml @@ -2,7 +2,7 @@ name: web_benchmarks description: A benchmark harness for performance-testing Flutter apps in Chrome. repository: https://github.com/flutter/packages/tree/main/packages/web_benchmarks issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+web_benchmarks%22 -version: 0.1.0+3 +version: 0.1.0+4 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/webview_flutter/webview_flutter/CHANGELOG.md b/packages/webview_flutter/webview_flutter/CHANGELOG.md index 3b05257195c2..bf535d2b1a9d 100644 --- a/packages/webview_flutter/webview_flutter/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.2.1 + +* Removes obsolete null checks on non-nullable values. + ## 4.2.0 * Adds support to receive permission requests. See `WebViewController(onPermissionRequest)`. diff --git a/packages/webview_flutter/webview_flutter/example/lib/main.dart b/packages/webview_flutter/webview_flutter/example/lib/main.dart index 9cbfc01de56e..c7fbd63958fd 100644 --- a/packages/webview_flutter/webview_flutter/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter/example/lib/main.dart @@ -440,7 +440,7 @@ class SampleMenu extends StatelessWidget { } Widget _getCookieList(String cookies) { - if (cookies == null || cookies == '""') { + if (cookies == '""') { return Container(); } final List cookieList = cookies.split(';'); diff --git a/packages/webview_flutter/webview_flutter/lib/src/legacy/webview.dart b/packages/webview_flutter/webview_flutter/lib/src/legacy/webview.dart index 06ba026cada4..55826a533b17 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/legacy/webview.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/legacy/webview.dart @@ -98,9 +98,7 @@ class WebView extends StatefulWidget { AutoMediaPlaybackPolicy.require_user_action_for_all_media_types, this.allowsInlineMediaPlayback = false, this.backgroundColor, - }) : assert(javascriptMode != null), - assert(initialMediaPlaybackPolicy != null), - assert(allowsInlineMediaPlayback != null); + }); static WebViewPlatform? _platform; @@ -395,11 +393,9 @@ WebSettings _clearUnchangedWebSettings( assert(currentValue.hasNavigationDelegate != null); assert(currentValue.hasProgressTracking != null); assert(currentValue.debuggingEnabled != null); - assert(currentValue.userAgent != null); assert(newValue.javascriptMode != null); assert(newValue.hasNavigationDelegate != null); assert(newValue.debuggingEnabled != null); - assert(newValue.userAgent != null); assert(newValue.zoomEnabled != null); JavascriptMode? javascriptMode; @@ -500,7 +496,7 @@ class WebViewController { this._widget, this._webViewPlatformController, this._javascriptChannelRegistry, - ) : assert(_webViewPlatformController != null) { + ) { _settings = _webSettingsFromWidget(_widget); } @@ -561,7 +557,6 @@ class WebViewController { String url, { Map? headers, }) async { - assert(url != null); _validateUrlString(url); return _webViewPlatformController.loadUrl(url, headers); } diff --git a/packages/webview_flutter/webview_flutter/pubspec.yaml b/packages/webview_flutter/webview_flutter/pubspec.yaml index 05d6cd29bd7c..b931c9e04fd4 100644 --- a/packages/webview_flutter/webview_flutter/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter description: A Flutter plugin that provides a WebView widget on Android and iOS. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 4.2.0 +version: 4.2.1 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index 3f95f7a67a9d..3160b8594f6e 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.7.1 + +* Removes obsolete null checks on non-nullable values. + ## 3.7.0 * Adds support to accept third party cookies. See diff --git a/packages/webview_flutter/webview_flutter_android/example/lib/legacy/web_view.dart b/packages/webview_flutter/webview_flutter_android/example/lib/legacy/web_view.dart index bd5778675c25..909056f4ea9c 100644 --- a/packages/webview_flutter/webview_flutter_android/example/lib/legacy/web_view.dart +++ b/packages/webview_flutter/webview_flutter_android/example/lib/legacy/web_view.dart @@ -81,9 +81,7 @@ class WebView extends StatefulWidget { AutoMediaPlaybackPolicy.require_user_action_for_all_media_types, this.allowsInlineMediaPlayback = false, this.backgroundColor, - }) : assert(javascriptMode != null), - assert(initialMediaPlaybackPolicy != null), - assert(allowsInlineMediaPlayback != null); + }); /// The WebView platform that's used by this WebView. /// @@ -366,7 +364,7 @@ class WebViewController { this._widget, this._webViewPlatformController, this._javascriptChannelRegistry, - ) : assert(_webViewPlatformController != null) { + ) { _settings = _webSettingsFromWidget(_widget); } @@ -420,7 +418,6 @@ class WebViewController { String url, { Map? headers, }) async { - assert(url != null); _validateUrlString(url); return _webViewPlatformController.loadUrl(url, headers); } @@ -607,11 +604,9 @@ class WebViewController { assert(currentValue.hasNavigationDelegate != null); assert(currentValue.hasProgressTracking != null); assert(currentValue.debuggingEnabled != null); - assert(currentValue.userAgent != null); assert(newValue.javascriptMode != null); assert(newValue.hasNavigationDelegate != null); assert(newValue.debuggingEnabled != null); - assert(newValue.userAgent != null); assert(newValue.zoomEnabled != null); JavascriptMode? javascriptMode; diff --git a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart index a8714d3ae3b8..b618c8f3e2cc 100644 --- a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart @@ -441,7 +441,7 @@ class SampleMenu extends StatelessWidget { } Widget _getCookieList(String cookies) { - if (cookies == null || cookies == '""') { + if (cookies == '""') { return Container(); } final List cookieList = cookies.split(';'); diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index b674a5a6b645..b398dfa9413f 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_android description: A Flutter plugin that provides a WebView widget on Android. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.7.0 +version: 3.7.1 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md b/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md index af8135f270b7..a407df5f5a04 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.3.1 + +* Removes obsolete null checks on non-nullable values. + ## 2.3.0 * Adds support to receive permission requests. See diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/creation_params.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/creation_params.dart index 7c3edf3cf8b0..0c33cde7bc63 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/creation_params.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/creation_params.dart @@ -23,7 +23,7 @@ class CreationParams { AutoMediaPlaybackPolicy.require_user_action_for_all_media_types, this.backgroundColor, this.cookies = const [], - }) : assert(autoMediaPlaybackPolicy != null); + }); /// The initialUrl to load in the webview. /// diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/javascript_channel.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/javascript_channel.dart index 49e505ef5e58..e340625f91a3 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/javascript_channel.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/javascript_channel.dart @@ -17,9 +17,7 @@ class JavascriptChannel { JavascriptChannel({ required this.name, required this.onMessageReceived, - }) : assert(name != null), - assert(onMessageReceived != null), - assert(_validChannelNames.hasMatch(name)); + }) : assert(_validChannelNames.hasMatch(name)); /// The channel's name. /// diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/javascript_message.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/javascript_message.dart index 8d080452c54a..c3aceec99e56 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/javascript_message.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/javascript_message.dart @@ -7,7 +7,7 @@ class JavascriptMessage { /// Constructs a JavaScript message object. /// /// The `message` parameter must not be null. - const JavascriptMessage(this.message) : assert(message != null); + const JavascriptMessage(this.message); /// The contents of the message that was sent by the JavaScript code. final String message; diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/web_resource_error.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/web_resource_error.dart index b61671f0ac45..fdd814310221 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/web_resource_error.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/web_resource_error.dart @@ -16,8 +16,7 @@ class WebResourceError { this.domain, this.errorType, this.failingUrl, - }) : assert(errorCode != null), - assert(description != null); + }); /// Raw code of the error from the respective platform. /// diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/web_settings.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/web_settings.dart index 102ab10ccea7..91f0768e38cb 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/web_settings.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/legacy/types/web_settings.dart @@ -85,7 +85,7 @@ class WebSettings { this.allowsInlineMediaPlayback, this.zoomEnabled, required this.userAgent, - }) : assert(userAgent != null); + }); /// The JavaScript execution mode to be used by the webview. final JavascriptMode? javascriptMode; diff --git a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml index 12c4050cccaf..7e48f6c99290 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/webview_flutt issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview_flutter%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.3.0 +version: 2.3.1 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/webview_flutter/webview_flutter_web/CHANGELOG.md b/packages/webview_flutter/webview_flutter_web/CHANGELOG.md index 38f28aaf222e..658efbec9118 100644 --- a/packages/webview_flutter/webview_flutter_web/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_web/CHANGELOG.md @@ -1,5 +1,6 @@ ## NEXT +* Removes obsolete null checks on non-nullable values. * Updates minimum Flutter version to 3.3. * Aligns Dart and Flutter SDK constraints. diff --git a/packages/webview_flutter/webview_flutter_web/example/lib/legacy/web_view.dart b/packages/webview_flutter/webview_flutter_web/example/lib/legacy/web_view.dart index 7f1eead8f17b..8b390c7565cc 100644 --- a/packages/webview_flutter/webview_flutter_web/example/lib/legacy/web_view.dart +++ b/packages/webview_flutter/webview_flutter_web/example/lib/legacy/web_view.dart @@ -129,7 +129,7 @@ class WebViewController { WebViewController( this._widget, this._webViewPlatformController, - ) : assert(_webViewPlatformController != null) { + ) { _settings = _webSettingsFromWidget(_widget); } @@ -151,7 +151,6 @@ class WebViewController { String url, { Map? headers, }) async { - assert(url != null); _validateUrlString(url); return _webViewPlatformController.loadUrl(url, headers); } @@ -317,11 +316,9 @@ class WebViewController { assert(currentValue.hasNavigationDelegate != null); assert(currentValue.hasProgressTracking != null); assert(currentValue.debuggingEnabled != null); - assert(currentValue.userAgent != null); assert(newValue.javascriptMode != null); assert(newValue.hasNavigationDelegate != null); assert(newValue.debuggingEnabled != null); - assert(newValue.userAgent != null); assert(newValue.zoomEnabled != null); JavascriptMode? javascriptMode; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md index f4f4c1e8dfaa..566f23fb67be 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.4.4 + +* Removes obsolete null checks on non-nullable values. + ## 3.4.3 * Replace `describeEnum` with the `name` getter. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/legacy/web_view.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/legacy/web_view.dart index 8f4d3917de64..afb5f2065616 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/legacy/web_view.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/legacy/web_view.dart @@ -74,9 +74,7 @@ class WebView extends StatefulWidget { AutoMediaPlaybackPolicy.require_user_action_for_all_media_types, this.allowsInlineMediaPlayback = false, this.backgroundColor, - }) : assert(javascriptMode != null), - assert(initialMediaPlaybackPolicy != null), - assert(allowsInlineMediaPlayback != null); + }); /// The WebView platform that's used by this WebView. static final WebViewPlatform platform = CupertinoWebView(); @@ -308,7 +306,7 @@ class WebViewController { this._widget, this._webViewPlatformController, this._javascriptChannelRegistry, - ) : assert(_webViewPlatformController != null) { + ) { _settings = _webSettingsFromWidget(_widget); } @@ -369,7 +367,6 @@ class WebViewController { String url, { Map? headers, }) async { - assert(url != null); _validateUrlString(url); return _webViewPlatformController.loadUrl(url, headers); } @@ -560,11 +557,9 @@ class WebViewController { assert(currentValue.hasNavigationDelegate != null); assert(currentValue.hasProgressTracking != null); assert(currentValue.debuggingEnabled != null); - assert(currentValue.userAgent != null); assert(newValue.javascriptMode != null); assert(newValue.hasNavigationDelegate != null); assert(newValue.debuggingEnabled != null); - assert(newValue.userAgent != null); JavascriptMode? javascriptMode; bool? hasNavigationDelegate; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart index 29c42969b475..8c3f75312943 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart @@ -442,7 +442,7 @@ class SampleMenu extends StatelessWidget { } Widget _getCookieList(String cookies) { - if (cookies == null || cookies == '""') { + if (cookies == '""') { return Container(); } final List cookieList = cookies.split(';'); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index 7675d58a15d9..c0e47c83d5ff 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_wkwebview description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.4.3 +version: 3.4.4 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/script/tool/lib/src/common/xcode.dart b/script/tool/lib/src/common/xcode.dart index 83f681bcb492..fc0fdbc13361 100644 --- a/script/tool/lib/src/common/xcode.dart +++ b/script/tool/lib/src/common/xcode.dart @@ -42,8 +42,8 @@ class Xcode { final List args = [ _xcodeBuildCommand, ...actions, - if (workspace != null) ...['-workspace', workspace], - if (scheme != null) ...['-scheme', scheme], + ...['-workspace', workspace], + ...['-scheme', scheme], if (configuration != null) ...['-configuration', configuration], ...extraFlags, ]; diff --git a/script/tool/lib/src/federation_safety_check_command.dart b/script/tool/lib/src/federation_safety_check_command.dart index 86767f15f7a1..30d4d178d065 100644 --- a/script/tool/lib/src/federation_safety_check_command.dart +++ b/script/tool/lib/src/federation_safety_check_command.dart @@ -200,9 +200,6 @@ class FederationSafetyCheckCommand extends PackageLoopingCommand { Future _changeIsCommentOnly( GitVersionFinder git, String repoPath) async { - if (git == null) { - return false; - } final List diff = await git.getDiffContents(targetPath: repoPath); final RegExp changeLine = RegExp(r'^[+-] '); // This will not catch /**/-style comments, but false negatives are fine diff --git a/script/tool/lib/src/publish_command.dart b/script/tool/lib/src/publish_command.dart index eb042fb6faa5..fb197ccd3abe 100644 --- a/script/tool/lib/src/publish_command.dart +++ b/script/tool/lib/src/publish_command.dart @@ -388,7 +388,6 @@ Safe to ignore if the package is deleted in this commit. required String tag, required _RemoteInfo remote, }) async { - assert(remote != null && tag != null); if (!getBoolArg(_dryRunFlag)) { final io.ProcessResult result = await (await gitDir).runCommand( ['push', remote.name, tag],