From 3620b2c727af9815ed66924673c9ee1991652486 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 24 Nov 2025 12:31:41 -0500 Subject: [PATCH 01/13] Update rules --- analysis_options.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index a5de895abc4..0d631cee7a2 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -29,7 +29,7 @@ linter: - always_declare_return_types - always_put_control_body_on_new_line # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 - - always_specify_types + # - always_specify_types # conflicts with omit_obvious_local_variable_types # - always_use_package_imports # we do this commonly - annotate_overrides # - avoid_annotating_with_dynamic # conflicts with always_specify_types @@ -128,7 +128,8 @@ linter: - noop_primitive_operations - null_check_on_nullable_type_parameter - null_closures - # - omit_local_variable_types # opposite of always_specify_types + # - omit_local_variable_types # conflicts with specify_nonobvious_local_variable_types + - omit_obvious_local_variable_types # - one_member_abstracts # too many false positives - only_throw_errors # this does get disabled in a few places where we have legacy code that uses strings et al - overridden_fields @@ -187,10 +188,12 @@ linter: - sort_constructors_first - sort_pub_dependencies # DIFFERENT FROM FLUTTER/FLUTTER: Flutter's use case for not sorting does not apply to this repository. - sort_unnamed_constructors_first + - specify_nonobvious_local_variable_types + - specify_nonobvious_property_types - test_types_in_equals - throw_in_finally - tighten_type_of_initializing_formals - # - type_annotate_public_apis # subset of always_specify_types + - type_annotate_public_apis - type_init_formals - type_literal_in_constant_pattern - unawaited_futures # DIFFERENT FROM FLUTTER/FLUTTER: It's disabled there for "too many false positives"; that's not an issue here, and missing awaits have caused production issues in plugins. From c89acceffa48b4e8743c337368c19d1e1f2d698e Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 24 Nov 2025 12:40:59 -0500 Subject: [PATCH 02/13] fix --apply --- .../example/lib/container_transition.dart | 2 +- .../example/lib/shared_axis_transition.dart | 2 +- .../animations/lib/src/open_container.dart | 12 +- .../lib/src/page_transition_switcher.dart | 10 +- .../test/dual_transition_builder_test.dart | 8 +- .../test/fade_scale_transition_test.dart | 6 +- .../test/fade_through_transition_test.dart | 36 +- packages/animations/test/modal_test.dart | 8 +- .../animations/test/open_container_test.dart | 100 +- .../test/page_transition_switcher_test.dart | 44 +- .../test/shared_axis_transition_test.dart | 146 +- .../example/integration_test/camera_test.dart | 46 +- packages/camera/camera/example/lib/main.dart | 8 +- .../camera/camera/example/test/main_test.dart | 2 +- .../example/test_driver/integration_test.dart | 4 +- .../camera/lib/src/camera_controller.dart | 4 +- .../camera/camera/lib/src/camera_preview.dart | 2 +- .../camera/test/camera_image_stream_test.dart | 18 +- .../camera/camera/test/camera_image_test.dart | 20 +- .../camera/test/camera_preview_test.dart | 26 +- packages/camera/camera/test/camera_test.dart | 118 +- .../camera/camera/test/camera_value_test.dart | 14 +- .../example/integration_test/camera_test.dart | 68 +- .../example/lib/camera_controller.dart | 2 +- .../example/lib/camera_preview.dart | 2 +- .../camera_android/example/lib/main.dart | 8 +- .../example/test_driver/integration_test.dart | 4 +- .../lib/src/android_camera.dart | 4 +- .../test/android_camera_test.dart | 44 +- .../integration_test/integration_test.dart | 42 +- .../example/lib/camera_controller.dart | 2 +- .../example/lib/camera_preview.dart | 2 +- .../example/lib/main.dart | 8 +- .../lib/src/android_camera_camerax.dart | 34 +- .../test/android_camera_camerax_test.dart | 1411 ++++++++--------- .../test/preview_rotation_test.dart | 100 +- .../example/integration_test/camera_test.dart | 78 +- .../example/lib/camera_controller.dart | 2 +- .../example/lib/camera_preview.dart | 2 +- .../camera_avfoundation/example/lib/main.dart | 8 +- .../lib/src/avfoundation_camera.dart | 4 +- .../test/avfoundation_camera_test.dart | 108 +- .../method_channel/method_channel_camera.dart | 8 +- .../test/camera_platform_interface_test.dart | 72 +- .../test/events/camera_event_test.dart | 102 +- .../test/events/device_event_test.dart | 18 +- .../method_channel_camera_test.dart | 106 +- .../test/types/camera_description_test.dart | 22 +- .../test/types/camera_exception_test.dart | 16 +- .../test/types/camera_image_data_test.dart | 2 +- .../test/types/media_settings_test.dart | 30 +- .../integration_test/camera_bitrate_test.dart | 42 +- .../integration_test/camera_options_test.dart | 4 +- .../integration_test/camera_service_test.dart | 6 +- .../example/integration_test/camera_test.dart | 218 +-- .../camera_web_exception_test.dart | 12 +- .../integration_test/camera_web_test.dart | 296 ++-- .../integration_test/helpers/mocks.dart | 4 +- .../zoom_level_capability_test.dart | 10 +- .../camera/camera_web/lib/src/camera.dart | 16 +- .../camera/camera_web/lib/src/camera_web.dart | 16 +- .../lib/src/types/camera_options.dart | 2 +- .../example/integration_test/camera_test.dart | 2 +- .../camera_windows/example/lib/main.dart | 6 +- .../test/camera_windows_test.dart | 56 +- .../example/lib/readme_excerpts.dart | 2 +- packages/cross_file/lib/src/types/html.dart | 4 +- packages/cross_file/lib/src/types/io.dart | 2 +- .../cross_file/test/x_file_html_test.dart | 28 +- packages/cross_file/test/x_file_io_test.dart | 20 +- .../example/lib/main.dart | 2 +- ...ion_google_sign_in_as_googleapis_auth.dart | 2 +- ...oogle_sign_in_as_googleapis_auth_test.dart | 4 +- .../example/lib/get_directory_page.dart | 2 +- .../lib/get_multiple_directories_page.dart | 6 +- .../example/lib/open_image_page.dart | 2 +- .../lib/open_multiple_images_page.dart | 4 +- .../example/lib/open_text_page.dart | 2 +- .../lib/readme_standalone_excerpts.dart | 8 +- .../example/lib/save_text_page.dart | 6 +- .../test/file_selector_test.dart | 26 +- .../example/lib/open_image_page.dart | 2 +- .../lib/open_multiple_images_page.dart | 8 +- .../example/lib/open_text_page.dart | 2 +- .../lib/src/file_selector_android.dart | 4 +- .../test/file_selector_android_test.dart | 8 +- .../example/lib/open_image_page.dart | 2 +- .../lib/open_multiple_images_page.dart | 4 +- .../example/lib/open_text_page.dart | 2 +- .../lib/file_selector_ios.dart | 4 +- .../test/file_selector_ios_test.dart | 16 +- .../example/lib/get_directory_page.dart | 2 +- .../lib/get_multiple_directories_page.dart | 2 +- .../example/lib/open_image_page.dart | 2 +- .../lib/open_multiple_images_page.dart | 4 +- .../example/lib/open_text_page.dart | 2 +- .../example/lib/save_text_page.dart | 6 +- .../test/file_selector_linux_test.dart | 74 +- .../example/lib/get_directory_page.dart | 2 +- .../lib/get_multiple_directories_page.dart | 2 +- .../example/lib/open_image_page.dart | 2 +- .../lib/open_multiple_images_page.dart | 4 +- .../example/lib/open_text_page.dart | 2 +- .../example/lib/save_text_page.dart | 6 +- .../lib/file_selector_macos.dart | 2 +- .../test/file_selector_macos_test.dart | 32 +- .../method_channel_file_selector_test.dart | 16 +- .../test/x_type_group_test.dart | 46 +- .../integration_test/dom_helper_test.dart | 12 +- .../file_selector_web_test.dart | 20 +- .../file_selector_web/lib/src/dom_helper.dart | 6 +- .../file_selector_web/lib/src/utils.dart | 2 +- .../file_selector_web/test/utils_test.dart | 12 +- .../example/lib/get_directory_page.dart | 2 +- .../lib/get_multiple_directories_page.dart | 2 +- .../example/lib/open_image_page.dart | 2 +- .../lib/open_multiple_images_page.dart | 4 +- .../example/lib/open_text_page.dart | 2 +- .../example/lib/save_text_page.dart | 4 +- .../test/file_selector_windows_test.dart | 38 +- .../example/lib/async_redirection.dart | 2 +- .../go_router/example/lib/books/main.dart | 2 +- .../example/lib/books/src/data/library.dart | 4 +- .../go_router/example/lib/extra_codec.dart | 2 +- .../example/lib/others/extra_param.dart | 2 +- .../go_router/example/lib/redirection.dart | 2 +- .../example/lib/top_level_on_enter.dart | 4 +- .../example/test/extra_codec_test.dart | 4 +- .../test/path_and_query_params_test.dart | 2 +- .../example/test/redirection_test.dart | 2 +- .../go_route_state_restoration_test.dart | 8 +- .../shell_route_state_restoration_test.dart | 10 +- ...ul_shell_route_state_restoration_test.dart | 8 +- packages/go_router/lib/src/builder.dart | 10 +- packages/go_router/lib/src/configuration.dart | 36 +- packages/go_router/lib/src/delegate.dart | 12 +- .../lib/src/information_provider.dart | 8 +- packages/go_router/lib/src/match.dart | 24 +- packages/go_router/lib/src/parser.dart | 2 +- packages/go_router/lib/src/path_utils.dart | 12 +- packages/go_router/lib/src/route.dart | 24 +- packages/go_router/lib/src/router.dart | 4 +- packages/go_router/lib/src/state.dart | 2 +- packages/go_router/test/builder_test.dart | 38 +- .../go_router/test/configuration_test.dart | 96 +- packages/go_router/test/cupertino_test.dart | 16 +- .../test/custom_transition_page_test.dart | 26 +- packages/go_router/test/delegate_test.dart | 54 +- packages/go_router/test/error_page_test.dart | 2 +- .../test/exception_handling_test.dart | 6 +- packages/go_router/test/extension_test.dart | 2 +- packages/go_router/test/extra_codec_test.dart | 14 +- packages/go_router/test/go_route_test.dart | 24 +- .../go_router/test/go_router_state_test.dart | 24 +- packages/go_router/test/go_router_test.dart | 550 +++---- .../test/helpers/error_screen_helpers.dart | 2 +- .../go_router/test/imperative_api_test.dart | 42 +- .../test/information_provider_test.dart | 34 +- packages/go_router/test/inherited_test.dart | 20 +- packages/go_router/test/logging_test.dart | 4 +- packages/go_router/test/match_test.dart | 42 +- packages/go_router/test/matching_test.dart | 16 +- packages/go_router/test/material_test.dart | 16 +- packages/go_router/test/name_case_test.dart | 2 +- packages/go_router/test/on_enter_test.dart | 62 +- packages/go_router/test/on_exit_test.dart | 80 +- packages/go_router/test/parser_test.dart | 62 +- packages/go_router/test/path_utils_test.dart | 22 +- packages/go_router/test/rebuild_test.dart | 2 +- packages/go_router/test/request_focus.dart | 4 +- packages/go_router/test/route_data_test.dart | 50 +- .../go_router/test/routing_config_test.dart | 24 +- .../test/shell_route_observers_test.dart | 6 +- packages/go_router/test/test_helpers.dart | 6 +- packages/go_router/tool/run_tests.dart | 6 +- .../go_router_builder/example/lib/main.dart | 2 +- .../example/lib/readme_excerpts.dart | 10 +- .../example/test/all_types_test.dart | 4 +- .../example/test/location_test.dart | 4 +- .../lib/src/go_router_generator.dart | 6 +- .../go_router_builder/lib/src/path_utils.dart | 4 +- .../lib/src/route_config.dart | 30 +- .../lib/src/type_helpers.dart | 26 +- .../go_router_builder/tool/run_tests.dart | 16 +- .../example/integration_test/core_test.dart | 6 +- .../experimental_ad_unit_widget_test.dart | 12 +- .../example/integration_test/h5_test.dart | 8 +- .../adsense_test_js_interop.dart | 6 +- .../integration_test/script_tag_test.dart | 4 +- packages/google_adsense/example/lib/h5.dart | 2 +- .../lib/src/adsense/ad_unit_widget.dart | 6 +- .../lib/src/core/js_interop/js_loader.dart | 8 +- packages/google_adsense/lib/src/h5/enums.dart | 2 +- .../example/lib/readme_excerpts.dart | 2 +- .../example/test/widget_test.dart | 2 +- .../google_fonts/generator/generator.dart | 46 +- .../lib/src/google_fonts_base.dart | 14 +- .../lib/src/google_fonts_variant.dart | 2 +- .../test/generated_font_methods_test.dart | 126 +- ...google_fonts_family_with_variant_test.dart | 8 +- .../test/google_fonts_variant_test.dart | 36 +- .../test/load_font_if_necessary_test.dart | 18 +- ...nt_if_necessary_with_local_fonts_test.dart | 4 +- .../integration_test/js_interop_id_test.dart | 12 +- .../js_interop_oauth_test.dart | 22 +- .../example/integration_test/utils.dart | 6 +- .../example/lib/main.dart | 2 +- .../example/lib/main_oauth.dart | 4 +- .../lib/src/js_interop/shared.dart | 2 +- .../lib/src/js_loader.dart | 6 +- .../test/js_loader_test.dart | 24 +- .../test/js_loader_tt_custom_test.dart | 2 +- .../test/js_loader_tt_forbidden_test.dart | 2 +- .../test/tools.dart | 2 +- .../integration_test/src/maps_controller.dart | 62 +- .../integration_test/src/maps_inspector.dart | 72 +- .../integration_test/src/tiles_inspector.dart | 56 +- .../example/lib/clustering.dart | 14 +- .../example/lib/custom_marker_icon.dart | 8 +- .../example/lib/ground_overlay.dart | 6 +- .../google_maps_flutter/example/lib/main.dart | 2 +- .../example/lib/map_click.dart | 8 +- .../example/lib/map_coordinates.dart | 2 +- .../example/lib/map_map_id.dart | 4 +- .../example/lib/map_ui.dart | 4 +- .../example/lib/marker_icons.dart | 12 +- .../example/lib/padding.dart | 4 +- .../example/lib/place_circle.dart | 6 +- .../example/lib/place_marker.dart | 16 +- .../example/lib/place_polygon.dart | 14 +- .../example/lib/place_polyline.dart | 8 +- .../example/lib/tile_overlay.dart | 12 +- .../google_maps_flutter/test/camera_test.dart | 4 +- .../test/circle_updates_test.dart | 58 +- .../test/clustermanager_updates_test.dart | 30 +- .../test/controller_test.dart | 6 +- .../test/google_map_test.dart | 2 +- .../test/groundoverlay_updates_test.dart | 54 +- .../test/heatmap_updates_test.dart | 44 +- .../test/marker_updates_test.dart | 58 +- .../test/polygon_updates_test.dart | 88 +- .../test/polyline_updates_test.dart | 62 +- .../test/tile_overlay_updates_test.dart | 12 +- .../integration_test/google_maps_test.dart | 188 +-- .../example/lib/clustering.dart | 14 +- .../example/lib/custom_marker_icon.dart | 8 +- .../example/lib/ground_overlay.dart | 6 +- .../example/lib/main.dart | 4 +- .../example/lib/map_click.dart | 8 +- .../example/lib/map_coordinates.dart | 2 +- .../example/lib/map_map_id.dart | 4 +- .../example/lib/map_ui.dart | 4 +- .../example/lib/marker_icons.dart | 12 +- .../example/lib/padding.dart | 4 +- .../example/lib/place_circle.dart | 6 +- .../example/lib/place_marker.dart | 16 +- .../example/lib/place_polygon.dart | 14 +- .../example/lib/place_polyline.dart | 8 +- .../example/lib/tile_overlay.dart | 12 +- .../example/test/example_google_map_test.dart | 32 +- .../lib/src/google_map_inspector_android.dart | 2 +- .../lib/src/google_maps_flutter_android.dart | 8 +- .../lib/src/serialization.dart | 12 +- .../google_maps_flutter_android_test.dart | 382 ++--- .../integration_test/google_maps_test.dart | 186 +-- .../maps_example_dart/lib/clustering.dart | 14 +- .../lib/custom_marker_icon.dart | 8 +- .../maps_example_dart/lib/ground_overlay.dart | 6 +- .../maps_example_dart/lib/map_click.dart | 8 +- .../lib/map_coordinates.dart | 2 +- .../maps_example_dart/lib/map_map_id.dart | 4 +- .../shared/maps_example_dart/lib/map_ui.dart | 4 +- .../maps_example_dart/lib/marker_icons.dart | 12 +- .../shared/maps_example_dart/lib/padding.dart | 4 +- .../maps_example_dart/lib/place_circle.dart | 6 +- .../maps_example_dart/lib/place_marker.dart | 16 +- .../maps_example_dart/lib/place_polygon.dart | 14 +- .../maps_example_dart/lib/place_polyline.dart | 8 +- .../maps_example_dart/lib/tile_overlay.dart | 12 +- .../test/example_google_map_test.dart | 32 +- .../lib/src/google_map_inspector_ios.dart | 2 +- .../lib/src/google_maps_flutter_ios.dart | 6 +- .../lib/src/serialization.dart | 12 +- .../test/google_maps_flutter_ios_test.dart | 352 ++-- .../method_channel_google_maps_flutter.dart | 12 +- .../lib/src/method_channel/serialization.dart | 14 +- .../lib/src/types/bitmap.dart | 14 +- .../lib/src/types/callbacks.dart | 2 +- .../lib/src/types/circle.dart | 2 +- .../lib/src/types/cluster_manager.dart | 2 +- .../lib/src/types/ground_overlay.dart | 2 +- .../lib/src/types/heatmap.dart | 4 +- .../lib/src/types/location.dart | 4 +- .../lib/src/types/maps_object_updates.dart | 2 +- .../lib/src/types/marker.dart | 4 +- .../lib/src/types/polygon.dart | 10 +- .../lib/src/types/polyline.dart | 6 +- .../lib/src/types/tile.dart | 2 +- .../lib/src/types/tile_overlay.dart | 2 +- ...thod_channel_google_maps_flutter_test.dart | 20 +- .../google_maps_flutter_platform_test.dart | 4 +- .../test/types/advanced_marker_test.dart | 30 +- .../test/types/bitmap_test.dart | 12 +- .../test/types/camera_test.dart | 38 +- .../test/types/cluster_manager_test.dart | 12 +- .../test/types/cluster_test.dart | 2 +- .../test/types/ground_overlay_test.dart | 50 +- .../test/types/heatmap_test.dart | 168 +- .../test/types/location_test.dart | 30 +- .../test/types/map_configuration_test.dart | 168 +- .../test/types/maps_object_test.dart | 24 +- .../test/types/maps_object_updates_test.dart | 94 +- .../test/types/marker_test.dart | 34 +- .../test/types/tile_overlay_test.dart | 24 +- .../test/types/tile_overlay_updates_test.dart | 94 +- .../test/types/tile_test.dart | 6 +- .../test/utils/cluster_manager_test.dart | 8 +- .../map_configuration_serialization_test.dart | 8 +- .../cloud_map_styles_test.dart | 14 +- .../google_maps_controller_test.dart | 70 +- .../google_maps_plugin_test.dart | 72 +- .../marker_clustering_test.dart | 20 +- .../example/integration_test/marker_test.dart | 24 +- .../integration_test/markers_test.dart | 72 +- .../integration_test/overlay_test.dart | 14 +- .../integration_test/overlays_test.dart | 4 +- .../integration_test/projection_test.dart | 22 +- .../example/integration_test/shape_test.dart | 24 +- .../example/integration_test/shapes_test.dart | 64 +- .../lib/src/circles.dart | 4 +- .../lib/src/convert.dart | 40 +- .../lib/src/google_maps_controller.dart | 2 +- .../lib/src/google_maps_flutter_web.dart | 4 +- .../lib/src/ground_overlays.dart | 6 +- .../lib/src/heatmaps.dart | 6 +- .../lib/src/marker_clustering_js_interop.dart | 2 +- .../lib/src/markers.dart | 6 +- .../lib/src/overlay.dart | 2 +- .../lib/src/overlays.dart | 2 +- .../lib/src/polygons.dart | 4 +- .../lib/src/polylines.dart | 4 +- .../google_sign_in/example/lib/main.dart | 10 +- .../google_sign_in/lib/google_sign_in.dart | 6 +- .../google_sign_in/lib/src/fife.dart | 4 +- .../google_sign_in/lib/widgets.dart | 2 +- .../google_sign_in/test/fife_test.dart | 26 +- .../test/google_sign_in_test.dart | 106 +- .../example/lib/main.dart | 2 +- .../lib/google_sign_in_android.dart | 4 +- .../test/google_sign_in_android_test.dart | 90 +- .../google_sign_in_ios/example/lib/main.dart | 2 +- .../lib/google_sign_in_ios.dart | 4 +- .../test/google_sign_in_ios_test.dart | 118 +- ...oogle_sign_in_platform_interface_test.dart | 18 +- ..._size_html_element_view_test_disabled.dart | 20 +- .../google_sign_in_web_test.dart | 32 +- .../example/integration_test/utils_test.dart | 6 +- .../lib/src/button_configuration_column.dart | 2 +- .../src/flexible_size_html_element_view.dart | 2 +- .../lib/src/gis_client.dart | 10 +- .../image_picker/example/lib/main.dart | 10 +- .../example/lib/readme_excerpts.dart | 4 +- .../image_picker/lib/image_picker.dart | 4 +- .../image_picker/test/image_picker_test.dart | 74 +- .../example/lib/main.dart | 10 +- .../test/image_picker_android_test.dart | 18 +- .../image_picker_for_web_test.dart | 24 +- .../integration_test/image_resizer_test.dart | 6 +- .../readme_excerpts_test.dart | 2 +- .../lib/image_picker_for_web.dart | 6 +- .../lib/src/image_resizer.dart | 10 +- .../test/image_resizer_utils_test.dart | 14 +- .../image_picker_ios/example/lib/main.dart | 10 +- .../image_picker_linux/example/lib/main.dart | 10 +- .../lib/image_picker_linux.dart | 10 +- .../test/image_picker_linux_test.dart | 4 +- .../image_picker_macos/example/lib/main.dart | 10 +- .../lib/image_picker_macos.dart | 10 +- .../test/image_picker_macos_test.dart | 4 +- .../method_channel_image_picker.dart | 10 +- .../test/image_picker_platform_test.dart | 18 +- .../method_channel_image_picker_test.dart | 4 +- .../test/picked_file_html_test.dart | 2 +- .../test/picked_file_io_test.dart | 2 +- .../example/lib/main.dart | 10 +- .../lib/image_picker_windows.dart | 10 +- .../test/image_picker_windows_test.dart | 2 +- .../in_app_purchase/example/lib/main.dart | 14 +- .../test/in_app_purchase_test.dart | 8 +- .../example/lib/main.dart | 34 +- .../src/in_app_purchase_android_platform.dart | 2 +- .../types/google_play_product_details.dart | 4 +- .../types/google_play_purchase_details.dart | 2 +- .../billing_client_manager_test.dart | 10 +- .../billing_client_wrapper_test.dart | 100 +- .../product_details_wrapper_test.dart | 8 +- ...rchase_android_platform_addition_test.dart | 16 +- ...in_app_purchase_android_platform_test.dart | 140 +- .../test/types/translator_test.dart | 8 +- .../test/in_app_purchase_platform_test.dart | 20 +- .../errors/in_app_purchase_error_test.dart | 4 +- .../in_app_purchase_exception_test.dart | 4 +- .../test/src/types/product_details_test.dart | 2 +- .../example/lib/main.dart | 22 +- .../in_app_purchase_storekit_platform.dart | 14 +- .../sk_payment_queue_wrapper.dart | 14 +- .../src/types/app_store_purchase_details.dart | 2 +- .../test/fakes/fake_storekit_platform.dart | 28 +- ...app_purchase_storekit_2_platform_test.dart | 48 +- ...rchase_storekit_platform_addtion_test.dart | 2 +- ...n_app_purchase_storekit_platform_test.dart | 100 +- .../pigeon_converter_test.dart | 16 +- .../sk_methodchannel_apis_test.dart | 16 +- .../sk_payment_queue_delegate_api_test.dart | 20 +- .../store_kit_wrappers/sk_product_test.dart | 38 +- .../sk_test_stub_objects.dart | 4 +- .../android/android_ad_display_container.dart | 2 +- .../android_ads_rendering_settings.dart | 2 +- .../lib/src/ios/ios_ima_settings.dart | 2 +- .../test/ad_display_container_test.dart | 4 +- .../test/ads_loader_test.dart | 10 +- .../test/ads_manager_delegate_test.dart | 2 +- .../test/ads_manager_test.dart | 24 +- .../android/ad_display_container_test.dart | 100 +- .../test/android/ad_test.dart | 18 +- .../test/android/ads_loader_test.dart | 60 +- .../test/android/ads_manager_test.dart | 58 +- .../test/android/companion_ad_slot_test.dart | 20 +- .../content_progress_provider_test.dart | 4 +- .../test/android/ima_settings_test.dart | 40 +- .../test/companion_ad_slot_test.dart | 2 +- .../test/content_progress_provider_test.dart | 4 +- .../test/ima_settings_test.dart | 48 +- .../test/ios/ad_display_container_test.dart | 34 +- .../test/ios/ad_test.dart | 6 +- .../test/ios/ads_loader_test.dart | 42 +- .../test/ios/ads_manager_delegate_test.dart | 24 +- .../test/ios/ads_manager_test.dart | 44 +- .../test/ios/companion_ad_slot_test.dart | 14 +- .../ios/content_progress_provider_test.dart | 4 +- .../test/ios/ima_settings_test.dart | 38 +- .../test/version_test.dart | 8 +- .../local_auth/example/lib/main.dart | 6 +- .../local_auth_android/example/lib/main.dart | 6 +- .../lib/local_auth_android.dart | 2 +- .../test/local_auth_test.dart | 32 +- .../local_auth_darwin/example/lib/main.dart | 6 +- .../lib/local_auth_darwin.dart | 4 +- .../test/local_auth_darwin_test.dart | 94 +- .../lib/default_method_channel_platform.dart | 8 +- .../default_method_channel_platform_test.dart | 2 +- .../local_auth_windows/example/lib/main.dart | 2 +- packages/metrics_center/lib/src/common.dart | 4 +- packages/metrics_center/lib/src/gcs_lock.dart | 12 +- .../lib/src/google_benchmark.dart | 10 +- packages/metrics_center/lib/src/skiaperf.dart | 34 +- .../metrics_center/test/flutter_test.dart | 6 +- .../metrics_center/test/gcs_lock_test.dart | 30 +- .../test/google_benchmark_test.dart | 2 +- .../metrics_center/test/skiaperf_test.dart | 109 +- packages/metrics_center/test/utility.dart | 2 +- packages/multicast_dns/example/main.dart | 4 +- .../multicast_dns/example/mdns_resolve.dart | 2 +- packages/multicast_dns/example/mdns_sd.dart | 2 +- packages/multicast_dns/lib/multicast_dns.dart | 6 +- .../lib/src/lookup_resolver.dart | 8 +- .../lib/src/native_protocol_client.dart | 6 +- packages/multicast_dns/lib/src/packet.dart | 38 +- .../lib/src/resource_record.dart | 4 +- packages/multicast_dns/test/client_test.dart | 40 +- packages/multicast_dns/test/decode_test.dart | 8 +- .../test/lookup_resolver_test.dart | 26 +- .../test/resource_record_cache_test.dart | 12 +- packages/multicast_dns/tool/packet_gen.dart | 12 +- .../integration_test/path_provider_test.dart | 6 +- .../path_provider/example/lib/main.dart | 4 +- .../path_provider/lib/path_provider.dart | 2 +- .../integration_test/path_provider_test.dart | 8 +- .../example/lib/main.dart | 4 +- .../integration_test/path_provider_test.dart | 58 +- .../example/lib/main.dart | 2 +- .../test/path_provider_foundation_test.dart | 8 +- .../path_provider_foundation/tool/ffigen.dart | 2 +- .../integration_test/path_provider_test.dart | 14 +- .../lib/src/path_provider_linux.dart | 6 +- .../test/get_application_id_test.dart | 2 +- .../method_channel_path_provider_test.dart | 20 +- ...path_provider_platform_interface_test.dart | 2 +- .../integration_test/path_provider_test.dart | 14 +- .../example/lib/main.dart | 2 +- .../path_provider_windows/lib/src/guid.dart | 4 +- .../lib/src/path_provider_windows_real.dart | 6 +- .../path_provider_windows/test/guid_test.dart | 2 +- .../test/path_provider_windows_test.dart | 24 +- packages/pigeon/example/app/lib/main.dart | 2 +- packages/pigeon/lib/src/ast.dart | 20 +- packages/pigeon/lib/src/ast_generator.dart | 8 +- .../pigeon/lib/src/cpp/cpp_generator.dart | 98 +- .../pigeon/lib/src/dart/dart_generator.dart | 110 +- .../src/dart/proxy_api_generator_helper.dart | 59 +- packages/pigeon/lib/src/functional.dart | 14 +- packages/pigeon/lib/src/generator.dart | 2 +- packages/pigeon/lib/src/generator_tools.dart | 34 +- .../lib/src/gobject/gobject_generator.dart | 88 +- .../pigeon/lib/src/java/java_generator.dart | 70 +- .../lib/src/kotlin/kotlin_generator.dart | 84 +- .../pigeon/lib/src/objc/objc_generator.dart | 70 +- packages/pigeon/lib/src/pigeon_lib.dart | 22 +- .../pigeon/lib/src/pigeon_lib_internal.dart | 118 +- .../pigeon/lib/src/swift/swift_generator.dart | 164 +- .../lib/integration_tests.dart | 624 ++++---- .../background_platform_channels.gen.dart | 6 +- .../lib/src/generated/core_tests.gen.dart | 1154 +++++++------- .../lib/src/generated/enum.gen.dart | 13 +- .../generated/event_channel_tests.gen.dart | 10 +- ...ent_channel_without_classes_tests.gen.dart | 2 +- .../src/generated/flutter_unittests.gen.dart | 24 +- .../lib/src/generated/message.gen.dart | 25 +- .../lib/src/generated/multiple_arity.gen.dart | 13 +- .../src/generated/non_null_fields.gen.dart | 13 +- .../lib/src/generated/null_fields.gen.dart | 13 +- .../src/generated/nullable_returns.gen.dart | 38 +- .../lib/src/generated/primitive.gen.dart | 95 +- .../src/generated/proxy_api_tests.gen.dart | 738 +++++---- .../test/generated_dart_test_code_test.dart | 82 +- .../test/instance_manager_test.dart | 44 +- .../test/multiple_arity_test.dart | 4 +- .../test/non_null_fields_test.dart | 2 +- .../test/null_fields_test.dart | 18 +- .../test/null_safe_test.dart | 60 +- .../test/primitive_test.dart | 8 +- .../test/proxy_api_overrides_test.dart | 6 +- .../test/test_message.gen.dart | 15 +- .../test/test_util.dart | 2 +- packages/pigeon/test/ast_generator_test.dart | 8 +- packages/pigeon/test/cpp_generator_test.dart | 322 ++-- packages/pigeon/test/dart/proxy_api_test.dart | 152 +- packages/pigeon/test/dart_generator_test.dart | 376 ++--- packages/pigeon/test/functional_test.dart | 6 +- .../pigeon/test/generator_tools_test.dart | 48 +- .../pigeon/test/gobject_generator_test.dart | 184 +-- packages/pigeon/test/java_generator_test.dart | 432 ++--- .../pigeon/test/kotlin/proxy_api_test.dart | 150 +- .../pigeon/test/kotlin_generator_test.dart | 440 ++--- packages/pigeon/test/objc_generator_test.dart | 780 ++++----- packages/pigeon/test/pigeon_lib_test.dart | 234 +-- packages/pigeon/test/pigeon_test.dart | 8 +- .../pigeon/test/swift/proxy_api_test.dart | 166 +- .../pigeon/test/swift_generator_test.dart | 396 ++--- packages/pigeon/test/version_test.dart | 4 +- packages/pigeon/tool/generate.dart | 2 +- packages/pigeon/tool/run_tests.dart | 8 +- .../pigeon/tool/shared/flutter_utils.dart | 6 +- packages/pigeon/tool/shared/generation.dart | 22 +- .../pigeon/tool/shared/process_utils.dart | 4 +- packages/pigeon/tool/shared/test_runner.dart | 6 +- packages/pigeon/tool/shared/test_suites.dart | 74 +- packages/pigeon/tool/test.dart | 16 +- .../lib/plugin_platform_interface.dart | 2 +- .../lib/platforms/native_widget_ios.dart | 4 +- .../example/lib/main.dart | 4 +- .../default_pointer_interceptor_test.dart | 2 +- .../pointer_interceptor_platform_test.dart | 2 +- .../example/integration_test/widget_test.dart | 4 +- .../integration_test/quick_actions_test.dart | 4 +- .../quick_actions/example/lib/main.dart | 2 +- .../test/quick_actions_test.dart | 8 +- .../example/lib/main.dart | 2 +- .../lib/quick_actions_android.dart | 2 +- .../test/quick_actions_android_test.dart | 20 +- .../integration_test/quick_actions_test.dart | 4 +- .../quick_actions_ios/example/lib/main.dart | 2 +- .../lib/quick_actions_ios.dart | 2 +- .../test/quick_actions_ios_test.dart | 20 +- .../method_channel_quick_actions_test.dart | 24 +- ...quick_actions_platform_interface_test.dart | 6 +- packages/rfw/example/remote/lib/main.dart | 6 +- packages/rfw/lib/src/dart/binary.dart | 22 +- packages/rfw/lib/src/dart/model.dart | 4 +- packages/rfw/lib/src/dart/text.dart | 24 +- .../lib/src/flutter/argument_decoders.dart | 4 +- .../rfw/lib/src/flutter/core_widgets.dart | 4 +- .../rfw/lib/src/flutter/material_widgets.dart | 10 +- packages/rfw/lib/src/flutter/runtime.dart | 32 +- packages/rfw/test/argument_decoders_test.dart | 18 +- packages/rfw/test/binary_test.dart | 8 +- packages/rfw/test/core_widgets_test.dart | 12 +- packages/rfw/test/material_widgets_test.dart | 36 +- packages/rfw/test/model_test.dart | 42 +- packages/rfw/test/readme_test.dart | 8 +- packages/rfw/test/remote_widget_test.dart | 6 +- packages/rfw/test/runtime_test.dart | 254 +-- packages/rfw/test/source_locations_test.dart | 4 +- packages/rfw/test/text_test.dart | 6 +- packages/rfw/test/tolerant_comparator.dart | 2 +- .../rfw/test_coverage/bin/test_coverage.dart | 24 +- ...hared_preferences_migration_util_test.dart | 10 +- .../shared_preferences_test.dart | 76 +- .../shared_preferences/example/lib/main.dart | 4 +- .../example/lib/readme_excerpts.dart | 4 +- .../example/test/readme_excerpts_test.dart | 2 +- .../lib/src/shared_preferences_async.dart | 8 +- ...d_preferences_devtools_extension_data.dart | 2 +- .../lib/src/shared_preferences_legacy.dart | 14 +- .../util/legacy_to_async_migration_util.dart | 4 +- .../test/shared_preferences_async_test.dart | 44 +- ...ferences_devtools_extension_data_test.dart | 88 +- .../test/shared_preferences_test.dart | 46 +- .../shared_preferences_test.dart | 52 +- .../src/shared_preferences_async_android.dart | 2 +- .../test/shared_preferences_android_test.dart | 14 +- .../test/shared_preferences_async_test.dart | 32 +- .../shared_preferences_test.dart | 42 +- ...red_preferences_async_foundation_test.dart | 32 +- .../shared_preferences_foundation_test.dart | 38 +- .../shared_preferences_test.dart | 36 +- .../lib/shared_preferences_linux.dart | 6 +- .../legacy_shared_preferences_linux_test.dart | 10 +- .../shared_preferences_linux_async_test.dart | 28 +- .../in_memory_shared_preferences_async.dart | 4 +- ...shared_preferences_platform_interface.dart | 2 +- ...ethod_channel_shared_preferences_test.dart | 28 +- .../shared_preferences_state_notifier.dart | 2 +- .../shared_preferences_state_provider.dart | 4 +- .../lib/src/shared_preferences_tool_eval.dart | 2 +- .../lib/src/ui/keys_panel.dart | 2 +- ...hared_preferences_state_notifier_test.dart | 40 +- .../src/shared_preferences_state_test.dart | 42 +- .../shared_preferences_tool_eval_test.dart | 36 +- .../test/src/ui/data_panel_test.dart | 22 +- .../test/src/ui/error_panel_test.dart | 2 +- .../test/src/ui/keys_panel_test.dart | 12 +- .../src/ui/shared_preferences_body_test.dart | 2 +- .../shared_preferences_web_test.dart | 52 +- .../lib/shared_preferences_web.dart | 4 +- .../shared_preferences_test.dart | 36 +- .../lib/shared_preferences_windows.dart | 6 +- ...egacy_shared_preferences_windows_test.dart | 10 +- ...shared_preferences_windows_async_test.dart | 28 +- .../lib/src/serialization.dart | 4 +- .../lib/standard_message_codec.dart | 18 +- .../test/standard_message_codec_test.dart | 56 +- .../example/lib/table_view/merged_table.dart | 2 +- .../example/lib/table_view/simple_table.dart | 4 +- .../example/lib/tree_view/custom_tree.dart | 4 +- .../test/tree_view/custom_tree_test.dart | 2 +- .../test/tree_view/simple_tree_test.dart | 2 +- .../lib/src/common/span.dart | 6 +- .../lib/src/table_view/table.dart | 75 +- .../lib/src/table_view/table_cell.dart | 6 +- .../lib/src/tree_view/render_tree.dart | 43 +- .../lib/src/tree_view/tree.dart | 14 +- .../lib/src/tree_view/tree_span.dart | 2 +- .../test/common/span_test.dart | 24 +- .../test/table_view/table_cell_test.dart | 18 +- .../test/table_view/table_delegate_test.dart | 18 +- .../test/table_view/table_span_test.dart | 44 +- .../test/table_view/table_test.dart | 134 +- .../test/tree_view/render_tree_test.dart | 44 +- .../test/tree_view/tree_delegate_test.dart | 10 +- .../test/tree_view/tree_span_test.dart | 24 +- .../test/tree_view/tree_test.dart | 46 +- .../url_launcher/example/lib/encoding.dart | 2 +- .../url_launcher/example/lib/files.dart | 4 +- .../url_launcher/example/lib/main.dart | 4 +- .../url_launcher/lib/src/legacy_api.dart | 2 +- .../url_launcher/lib/src/link.dart | 2 +- .../url_launcher/test/link_test.dart | 6 +- .../test/src/legacy_api_test.dart | 6 +- .../test/src/url_launcher_string_test.dart | 34 +- .../test/src/url_launcher_uri_test.dart | 4 +- .../integration_test/url_launcher_test.dart | 4 +- .../example/lib/main.dart | 4 +- .../lib/url_launcher_android.dart | 2 +- .../test/url_launcher_android_test.dart | 70 +- .../url_launcher_ios/example/lib/main.dart | 2 +- .../test/url_launcher_ios_test.dart | 64 +- .../url_launcher_linux/example/lib/main.dart | 2 +- .../test/url_launcher_linux_test.dart | 36 +- .../url_launcher_macos/example/lib/main.dart | 2 +- .../test/url_launcher_macos_test.dart | 24 +- .../lib/link.dart | 2 +- .../test/launch_options_test.dart | 4 +- .../method_channel_url_launcher_test.dart | 8 +- .../test/url_launcher_platform_test.dart | 8 +- .../integration_test/link_widget_test.dart | 14 +- .../url_launcher_web_test.dart | 2 +- .../url_launcher_web/lib/src/link.dart | 6 +- .../example/lib/main.dart | 2 +- .../test/url_launcher_windows_test.dart | 8 +- .../vector_graphics/example/lib/main.dart | 2 +- .../vector_graphics/lib/src/listener.dart | 36 +- .../lib/src/render_object_selection.dart | 2 +- .../lib/src/render_vector_graphic.dart | 14 +- .../lib/src/vector_graphics.dart | 4 +- .../vector_graphics/test/caching_test.dart | 20 +- .../vector_graphics/test/listener_test.dart | 20 +- .../test/render_vector_graphics_test.dart | 82 +- .../test/vector_graphics_test.dart | 98 +- .../vector_graphics_codec/lib/src/fp16.dart | 8 +- .../lib/vector_graphics_codec.dart | 22 +- .../vector_graphics_codec/test/fp16_test.dart | 8 +- .../test/vector_graphics_codec_test.dart | 86 +- .../bin/util/isolate_processor.dart | 8 +- .../bin/vector_graphics_compiler.dart | 24 +- .../lib/src/_initialize_path_ops_io.dart | 2 +- .../lib/src/_initialize_tessellator_io.dart | 2 +- .../lib/src/debug_format.dart | 8 +- .../lib/src/draw_command_builder.dart | 4 +- .../lib/src/geometry/matrix.dart | 18 +- .../lib/src/geometry/path.dart | 34 +- .../lib/src/geometry/vertices.dart | 16 +- .../lib/src/image/image_info.dart | 2 +- .../lib/src/paint.dart | 20 +- .../lib/src/svg/_path_ops_ffi.dart | 6 +- .../lib/src/svg/_path_ops_unsupported.dart | 2 +- .../lib/src/svg/_tessellator_ffi.dart | 12 +- .../lib/src/svg/clipping_optimizer.dart | 54 +- .../lib/src/svg/masking_optimizer.dart | 60 +- .../lib/src/svg/numbers.dart | 2 +- .../lib/src/svg/overdraw_optimizer.dart | 46 +- .../lib/src/svg/parser.dart | 74 +- .../lib/src/svg/parsers.dart | 8 +- .../lib/src/svg/resolver.dart | 10 +- .../lib/src/util.dart | 2 +- .../lib/src/vector_instructions.dart | 2 +- .../lib/vector_graphics_compiler.dart | 28 +- .../test/cli_test.dart | 18 +- .../test/clipping_optimizer_test.dart | 14 +- .../test/draw_command_builder_test.dart | 2 +- .../test/end_to_end_test.dart | 34 +- .../test/helpers.dart | 2 +- .../test/masking_optimizer_test.dart | 16 +- .../test/matrix_test.dart | 34 +- .../test/node_test.dart | 6 +- .../test/overdraw_optimizer_test.dart | 14 +- .../test/paint_test.dart | 12 +- .../test/parser_test.dart | 42 +- .../test/parsers_test.dart | 8 +- .../test/path_ops_test.dart | 12 +- .../test/path_test.dart | 24 +- .../test/resolver_test.dart | 6 +- .../test/theme_test.dart | 8 +- .../test/util_test.dart | 8 +- .../test/vertices_test.dart | 8 +- .../controller_swap_test.dart | 10 +- .../integration_test/video_player_test.dart | 11 +- .../video_player/lib/src/sub_rip.dart | 14 +- .../video_player/lib/src/web_vtt.dart | 20 +- .../video_player/lib/video_player.dart | 8 +- .../test/closed_caption_file_test.dart | 2 +- .../video_player/test/sub_rip_file_test.dart | 2 +- .../video_player_initialization_test.dart | 8 +- .../video_player/test/video_player_test.dart | 232 +-- .../integration_test/video_player_test.dart | 2 +- .../example/lib/mini_controller.dart | 14 +- .../lib/src/android_video_player.dart | 6 +- .../lib/src/platform_view_player.dart | 4 +- .../test/android_video_player_test.dart | 102 +- .../integration_test/video_player_test.dart | 12 +- .../example/lib/mini_controller.dart | 14 +- .../lib/src/avfoundation_video_player.dart | 12 +- .../test/avfoundation_video_player_test.dart | 88 +- .../lib/video_player_platform_interface.dart | 2 +- .../test/video_player_options_test.dart | 4 +- .../test/video_player_web_options_test.dart | 10 +- .../integration_test/video_player_test.dart | 12 +- .../lib/src/video_player.dart | 6 +- .../lib/video_player_web.dart | 4 +- .../example/analyze_example.dart | 4 +- packages/web_benchmarks/lib/analysis.dart | 8 +- packages/web_benchmarks/lib/client.dart | 12 +- .../lib/src/benchmark_result.dart | 6 +- packages/web_benchmarks/lib/src/browser.dart | 28 +- .../web_benchmarks/lib/src/computations.dart | 10 +- packages/web_benchmarks/lib/src/recorder.dart | 14 +- packages/web_benchmarks/lib/src/runner.dart | 32 +- .../test/src/analysis_test.dart | 16 +- .../test/src/benchmark_result_test.dart | 8 +- .../benchmark/test_infra/automator.dart | 6 +- .../benchmark/web_benchmarks_test.dart | 4 +- .../webview_flutter_test.dart | 164 +- .../webview_flutter_test_legacy.dart | 140 +- .../webview_flutter/example/lib/main.dart | 14 +- .../lib/src/legacy/webview.dart | 6 +- .../test/legacy/webview_flutter_test.dart | 92 +- .../test/navigation_delegate_test.dart | 22 +- .../test/webview_controller_test.dart | 157 +- .../test/webview_cookie_manager_test.dart | 12 +- .../test/webview_widget_test.dart | 8 +- .../webview_flutter_test.dart | 254 +-- .../webview_flutter_test_legacy.dart | 172 +- .../example/lib/legacy/web_view.dart | 4 +- .../example/lib/main.dart | 14 +- .../example/lib/readme_excerpts.dart | 8 +- .../lib/src/android_webview_controller.dart | 10 +- .../src/legacy/webview_android_widget.dart | 4 +- .../lib/src/weak_reference_utils.dart | 2 +- .../android_navigation_delegate_test.dart | 84 +- .../test/android_webview_controller_test.dart | 302 ++-- .../android_webview_cookie_manager_test.dart | 18 +- .../webview_android_cookie_manager_test.dart | 4 +- .../legacy/webview_android_widget_test.dart | 56 +- .../javascript_channel_registry_test.dart | 20 +- .../webview_cookie_manager_test.dart | 2 +- .../legacy/types/javascript_channel_test.dart | 14 +- .../platform_navigation_delegate_test.dart | 6 +- .../platform_webview_controller_test.dart | 8 +- .../test/platform_webview_widget_test.dart | 12 +- .../test/types_test.dart | 8 +- .../test/webview_platform_test.dart | 2 +- .../legacy_webview_flutter_test_manual.dart | 12 +- .../webview_flutter_test.dart | 10 +- .../example/lib/legacy/web_view.dart | 4 +- .../webview_flutter_web/example/lib/main.dart | 2 +- .../lib/src/content_type.dart | 2 +- .../lib/src/http_request_factory.dart | 2 +- .../lib/src/web_webview_controller.dart | 6 +- .../lib/src/webview_flutter_web_legacy.dart | 2 +- .../test/content_type_test.dart | 14 +- .../test/legacy/webview_flutter_web_test.dart | 34 +- .../test/web_webview_controller_test.dart | 30 +- .../test/web_webview_widget_test.dart | 4 +- .../legacy/webview_flutter_test.dart | 140 +- .../webview_flutter_test.dart | 264 +-- .../example/lib/legacy/web_view.dart | 4 +- .../example/lib/main.dart | 12 +- .../lib/src/common/weak_reference_utils.dart | 2 +- .../src/legacy/web_kit_webview_widget.dart | 12 +- .../lib/src/webkit_webview_controller.dart | 30 +- .../legacy/web_kit_webview_widget_test.dart | 70 +- .../test/webkit_navigation_delegate_test.dart | 76 +- .../test/webkit_webview_controller_test.dart | 228 +-- .../webkit_webview_cookie_manager_test.dart | 18 +- .../test/webkit_webview_widget_test.dart | 16 +- .../xdg_directories/lib/xdg_directories.dart | 8 +- .../test/xdg_directories_test.dart | 6 +- .../test/cupertino_icons_golden_test.dart | 14 +- .../test/cupertino_icons_test.dart | 2 +- .../flutter_svg/example/lib/grid.dart | 2 +- .../example/lib/readme_excerpts.dart | 16 +- .../example/test_driver/bench_test.dart | 2 +- .../example/test_driver/repaint_test.dart | 2 +- .../packages/flutter_svg/test/cache_test.dart | 22 +- .../flutter_svg/test/default_theme_test.dart | 22 +- .../flutter_svg/test/loaders_test.dart | 34 +- .../flutter_svg/test/widget_svg_test.dart | 42 +- .../lib/flutter_svg_test.dart | 2 +- .../test/flutter_svg_test_test.dart | 18 +- .../lib/src/lambda_context.dart | 12 +- .../mustache_template/lib/src/parser.dart | 14 +- .../mustache_template/lib/src/renderer.dart | 18 +- .../mustache_template/lib/src/scanner.dart | 14 +- .../mustache_template/lib/src/template.dart | 4 +- .../lib/src/template_exception.dart | 20 +- .../test/mustache_specs.dart | 16 +- .../mustache_template/test/mustache_test.dart | 102 +- .../mustache_template/test/parser_test.dart | 106 +- .../packages/path_parsing/example/main.dart | 2 +- .../path_parsing/lib/src/path_parsing.dart | 26 +- .../test/parse_path_deep_test.dart | 2 +- .../path_parsing/test/parse_path_test.dart | 2 +- 862 files changed, 13845 insertions(+), 14007 deletions(-) diff --git a/packages/animations/example/lib/container_transition.dart b/packages/animations/example/lib/container_transition.dart index 4f188eae2b2..26e91cccdc5 100644 --- a/packages/animations/example/lib/container_transition.dart +++ b/packages/animations/example/lib/container_transition.dart @@ -384,7 +384,7 @@ class _ExampleSingleTile extends StatelessWidget { @override Widget build(BuildContext context) { - const double height = 100.0; + const height = 100.0; return _InkWellOverlay( openContainer: openContainer, diff --git a/packages/animations/example/lib/shared_axis_transition.dart b/packages/animations/example/lib/shared_axis_transition.dart index 299f32cbaba..4806644caf2 100644 --- a/packages/animations/example/lib/shared_axis_transition.dart +++ b/packages/animations/example/lib/shared_axis_transition.dart @@ -152,7 +152,7 @@ class _CourseSwitchState extends State<_CourseSwitch> { @override Widget build(BuildContext context) { - final String subtitle = _value ? 'Bundled' : 'Shown Individually'; + final subtitle = _value ? 'Bundled' : 'Shown Individually'; return SwitchListTile( title: Text(widget.course), subtitle: Text(subtitle), diff --git a/packages/animations/lib/src/open_container.dart b/packages/animations/lib/src/open_container.dart index 56b3446e230..fdf7beb02fe 100644 --- a/packages/animations/lib/src/open_container.dart +++ b/packages/animations/lib/src/open_container.dart @@ -643,7 +643,7 @@ class _OpenContainerRoute extends ModalRoute { required BuildContext navigatorContext, bool delayForSourceRoute = false, }) { - final RenderBox navigator = + final navigator = Navigator.of( navigatorContext, rootNavigator: useRootNavigator, @@ -679,7 +679,7 @@ class _OpenContainerRoute extends ModalRoute { Rect _getRect(GlobalKey key, RenderBox ancestor) { assert(key.currentContext != null); assert(ancestor.hasSize); - final RenderBox render = + final render = key.currentContext!.findRenderObject()! as RenderBox; assert(render.hasSize); return MatrixUtils.transformRect( @@ -689,8 +689,8 @@ class _OpenContainerRoute extends ModalRoute { } bool get _transitionWasInterrupted { - bool wasInProgress = false; - bool isInProgress = false; + var wasInProgress = false; + var isInProgress = false; switch (_currentAnimationStatus) { case AnimationStatus.completed: @@ -884,8 +884,8 @@ class _FlippableTweenSequence extends TweenSequence { _FlippableTweenSequence? get flipped { if (_flipped == null) { - final List> newItems = >[]; - for (int i = 0; i < _items.length; i++) { + final newItems = >[]; + for (var i = 0; i < _items.length; i++) { newItems.add( TweenSequenceItem( tween: _items[i].tween, diff --git a/packages/animations/lib/src/page_transition_switcher.dart b/packages/animations/lib/src/page_transition_switcher.dart index 1b2e7365d9f..53d4f7479a0 100644 --- a/packages/animations/lib/src/page_transition_switcher.dart +++ b/packages/animations/lib/src/page_transition_switcher.dart @@ -293,8 +293,8 @@ class _PageTransitionSwitcherState extends State _activeEntries.forEach(_updateTransitionForEntry); } - final bool hasNewChild = widget.child != null; - final bool hasOldChild = _currentEntry != null; + final hasNewChild = widget.child != null; + final hasOldChild = _currentEntry != null; if (hasNewChild != hasOldChild || hasNewChild && !Widget.canUpdate(widget.child!, _currentEntry!.widgetChild)) { @@ -327,11 +327,11 @@ class _PageTransitionSwitcherState extends State if (widget.child == null) { return; } - final AnimationController primaryController = AnimationController( + final primaryController = AnimationController( duration: widget.duration, vsync: this, ); - final AnimationController secondaryController = AnimationController( + final secondaryController = AnimationController( duration: widget.duration, vsync: this, ); @@ -373,7 +373,7 @@ class _PageTransitionSwitcherState extends State primaryController, secondaryController, ); - final _ChildEntry entry = _ChildEntry( + final entry = _ChildEntry( widgetChild: child, transition: KeyedSubtree.wrap(transition, _childNumber), primaryController: primaryController, diff --git a/packages/animations/test/dual_transition_builder_test.dart b/packages/animations/test/dual_transition_builder_test.dart index c8fd4cea946..7c7e25fc8b0 100644 --- a/packages/animations/test/dual_transition_builder_test.dart +++ b/packages/animations/test/dual_transition_builder_test.dart @@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('runs animations', (WidgetTester tester) async { - final AnimationController controller = AnimationController( + final controller = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); @@ -75,7 +75,7 @@ void main() { }); testWidgets('keeps state', (WidgetTester tester) async { - final AnimationController controller = AnimationController( + final controller = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); @@ -146,7 +146,7 @@ void main() { testWidgets('does not jump when interrupted - forward', ( WidgetTester tester, ) async { - final AnimationController controller = AnimationController( + final controller = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); @@ -212,7 +212,7 @@ void main() { testWidgets('does not jump when interrupted - reverse', ( WidgetTester tester, ) async { - final AnimationController controller = AnimationController( + final controller = AnimationController( value: 1.0, vsync: const TestVSync(), duration: const Duration(milliseconds: 300), diff --git a/packages/animations/test/fade_scale_transition_test.dart b/packages/animations/test/fade_scale_transition_test.dart index b8a30e3f96c..f5631c7695c 100644 --- a/packages/animations/test/fade_scale_transition_test.dart +++ b/packages/animations/test/fade_scale_transition_test.dart @@ -361,7 +361,7 @@ void main() { }); testWidgets('should preserve state', (WidgetTester tester) async { - final AnimationController controller = AnimationController( + final controller = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); @@ -416,7 +416,7 @@ double _getOpacity(GlobalKey key, WidgetTester tester) { matching: find.byType(FadeTransition), ); return tester.widgetList(finder).fold(1.0, (double a, Widget widget) { - final FadeTransition transition = widget as FadeTransition; + final transition = widget as FadeTransition; return a * transition.opacity.value; }); } @@ -427,7 +427,7 @@ double _getScale(GlobalKey key, WidgetTester tester) { matching: find.byType(ScaleTransition), ); return tester.widgetList(finder).fold(1.0, (double a, Widget widget) { - final ScaleTransition transition = widget as ScaleTransition; + final transition = widget as ScaleTransition; return a * transition.scale.value; }); } diff --git a/packages/animations/test/fade_through_transition_test.dart b/packages/animations/test/fade_through_transition_test.dart index 82d26b6e552..f539d56fc9b 100644 --- a/packages/animations/test/fade_through_transition_test.dart +++ b/packages/animations/test/fade_through_transition_test.dart @@ -10,10 +10,10 @@ void main() { testWidgets( 'FadeThroughPageTransitionsBuilder builds a FadeThroughTransition', (WidgetTester tester) async { - final AnimationController animation = AnimationController( + final animation = AnimationController( vsync: const TestVSync(), ); - final AnimationController secondaryAnimation = AnimationController( + final secondaryAnimation = AnimationController( vsync: const TestVSync(), ); @@ -34,9 +34,9 @@ void main() { testWidgets('FadeThroughTransition runs forward', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget(_TestWidget(navigatorKey: navigator)); expect(find.text(bottomRoute), findsOneWidget); @@ -116,9 +116,9 @@ void main() { testWidgets('FadeThroughTransition runs backwards', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget(_TestWidget(navigatorKey: navigator)); navigator.currentState!.pushNamed('/a'); @@ -206,9 +206,9 @@ void main() { testWidgets('FadeThroughTransition does not jump when interrupted', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget(_TestWidget(navigatorKey: navigator)); expect(find.text(bottomRoute), findsOneWidget); @@ -271,9 +271,9 @@ void main() { testWidgets('State is not lost when transitioning', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -358,11 +358,11 @@ void main() { }); testWidgets('should keep state', (WidgetTester tester) async { - final AnimationController animation = AnimationController( + final animation = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); - final AnimationController secondaryAnimation = AnimationController( + final secondaryAnimation = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); @@ -431,7 +431,7 @@ double _getOpacity(String key, WidgetTester tester) { matching: find.byType(FadeTransition), ); return tester.widgetList(finder).fold(1.0, (double a, Widget widget) { - final FadeTransition transition = widget as FadeTransition; + final transition = widget as FadeTransition; return a * transition.opacity.value; }); } @@ -442,7 +442,7 @@ double _getScale(String key, WidgetTester tester) { matching: find.byType(ScaleTransition), ); return tester.widgetList(finder).fold(1.0, (double a, Widget widget) { - final ScaleTransition transition = widget as ScaleTransition; + final transition = widget as ScaleTransition; return a * transition.scale.value; }); } diff --git a/packages/animations/test/modal_test.dart b/packages/animations/test/modal_test.dart index 2f3bbe90182..eb2963176e8 100644 --- a/packages/animations/test/modal_test.dart +++ b/packages/animations/test/modal_test.dart @@ -430,7 +430,7 @@ void main() { testWidgets('showModal builds a new route with specified route settings', ( WidgetTester tester, ) async { - const RouteSettings routeSettings = RouteSettings( + const routeSettings = RouteSettings( name: 'route-name', arguments: 'arguments', ); @@ -473,7 +473,7 @@ void main() { testWidgets('showModal builds a new route with specified image filter', ( WidgetTester tester, ) async { - final ui.ImageFilter filter = ui.ImageFilter.blur(sigmaX: 1, sigmaY: 1); + final filter = ui.ImageFilter.blur(sigmaX: 1, sigmaY: 1); final Widget button = Builder( builder: (BuildContext context) { @@ -518,7 +518,7 @@ double _getOpacity(GlobalKey key, WidgetTester tester) { matching: find.byType(FadeTransition), ); return tester.widgetList(finder).fold(1.0, (double a, Widget widget) { - final FadeTransition transition = widget as FadeTransition; + final transition = widget as FadeTransition; return a * transition.opacity.value; }); } @@ -529,7 +529,7 @@ double _getScale(GlobalKey key, WidgetTester tester) { matching: find.byType(ScaleTransition), ); return tester.widgetList(finder).fold(1.0, (double a, Widget widget) { - final ScaleTransition transition = widget as ScaleTransition; + final transition = widget as ScaleTransition; return a * transition.scale.value; }); } diff --git a/packages/animations/test/open_container_test.dart b/packages/animations/test/open_container_test.dart index 916f5ed3f12..854c4fc6b92 100644 --- a/packages/animations/test/open_container_test.dart +++ b/packages/animations/test/open_container_test.dart @@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Can be opened via GlobalKey', (WidgetTester tester) async { - final GlobalKey openContainerKey = + final openContainerKey = GlobalKey(); await tester.pumpWidget( @@ -43,8 +43,8 @@ void main() { const ShapeBorder shape = RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(8.0)), ); - bool closedBuilderCalled = false; - bool openBuilderCalled = false; + var closedBuilderCalled = false; + var openBuilderCalled = false; await tester.pumpWidget( _boilerplate( @@ -72,7 +72,7 @@ void main() { final Element srcMaterialElement = tester.firstElement( find.ancestor(of: find.text('Closed'), matching: find.byType(Material)), ); - final Material srcMaterial = srcMaterialElement.widget as Material; + final srcMaterial = srcMaterialElement.widget as Material; expect(srcMaterial.color, Colors.green); expect(srcMaterial.elevation, 4.0); expect(srcMaterial.shape, shape); @@ -94,7 +94,7 @@ void main() { final Element destMaterialElement = tester.firstElement( find.ancestor(of: find.text('Closed'), matching: find.byType(Material)), ); - final Material closedMaterial = destMaterialElement.widget as Material; + final closedMaterial = destMaterialElement.widget as Material; expect(closedMaterial.color, Colors.green); expect(closedMaterial.elevation, 4.0); expect(closedMaterial.shape, shape); @@ -107,14 +107,14 @@ void main() { expect(_getOpacity(tester, 'Open'), 0.0); expect(_getOpacity(tester, 'Closed'), 1.0); - final _TrackedData dataClosed = _TrackedData( + final dataClosed = _TrackedData( closedMaterial, closedMaterialRect, ); // Jump to the start of the fade in. await tester.pump(const Duration(milliseconds: 60)); // 300ms * 1/5 = 60ms - final _TrackedData dataPreFade = _TrackedData( + final dataPreFade = _TrackedData( destMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == destMaterialElement), @@ -130,7 +130,7 @@ void main() { // Jump to the middle of the fade in. await tester.pump(const Duration(milliseconds: 30)); // 300ms * 3/10 = 90ms - final _TrackedData dataMidFadeIn = _TrackedData( + final dataMidFadeIn = _TrackedData( destMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == destMaterialElement), @@ -149,7 +149,7 @@ void main() { // Jump to the end of the fade in at 2/5 of 300ms. await tester.pump(const Duration(milliseconds: 30)); // 300ms * 2/5 = 120ms - final _TrackedData dataPostFadeIn = _TrackedData( + final dataPostFadeIn = _TrackedData( destMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == destMaterialElement), @@ -165,7 +165,7 @@ void main() { // Jump almost to the end of the transition. await tester.pump(const Duration(milliseconds: 180)); - final _TrackedData dataTransitionDone = _TrackedData( + final dataTransitionDone = _TrackedData( destMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == destMaterialElement), @@ -188,7 +188,7 @@ void main() { final Element finalMaterialElement = tester.firstElement( find.ancestor(of: find.text('Open'), matching: find.byType(Material)), ); - final _TrackedData dataOpen = _TrackedData( + final dataOpen = _TrackedData( finalMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == finalMaterialElement), @@ -236,7 +236,7 @@ void main() { final Element initialMaterialElement = tester.firstElement( find.ancestor(of: find.text('Open'), matching: find.byType(Material)), ); - final _TrackedData dataOpen = _TrackedData( + final dataOpen = _TrackedData( initialMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == initialMaterialElement), @@ -257,7 +257,7 @@ void main() { final Element materialElement = tester.firstElement( find.ancestor(of: find.text('Open'), matching: find.byType(Material)), ); - final _TrackedData dataTransitionStart = _TrackedData( + final dataTransitionStart = _TrackedData( materialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == materialElement), @@ -271,7 +271,7 @@ void main() { // Jump to start of fade out: 1/5 of 300. await tester.pump(const Duration(milliseconds: 60)); // 300 * 1/5 = 60 - final _TrackedData dataPreFadeOut = _TrackedData( + final dataPreFadeOut = _TrackedData( materialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == materialElement), @@ -287,7 +287,7 @@ void main() { // Jump to the middle of the fade out. await tester.pump(const Duration(milliseconds: 30)); // 300 * 3/10 = 90 - final _TrackedData dataMidpoint = _TrackedData( + final dataMidpoint = _TrackedData( materialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == materialElement), @@ -305,7 +305,7 @@ void main() { // Jump to the end of the fade out. await tester.pump(const Duration(milliseconds: 30)); // 300 * 2/5 = 120 - final _TrackedData dataPostFadeOut = _TrackedData( + final dataPostFadeOut = _TrackedData( materialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == materialElement), @@ -321,7 +321,7 @@ void main() { // Jump almost to the end of the transition. await tester.pump(const Duration(milliseconds: 180)); - final _TrackedData dataTransitionDone = _TrackedData( + final dataTransitionDone = _TrackedData( materialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == materialElement), @@ -344,7 +344,7 @@ void main() { final Element finalMaterialElement = tester.firstElement( find.ancestor(of: find.text('Closed'), matching: find.byType(Material)), ); - final _TrackedData dataClosed = _TrackedData( + final dataClosed = _TrackedData( finalMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == finalMaterialElement), @@ -363,8 +363,8 @@ void main() { const ShapeBorder shape = RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(8.0)), ); - bool closedBuilderCalled = false; - bool openBuilderCalled = false; + var closedBuilderCalled = false; + var openBuilderCalled = false; await tester.pumpWidget( _boilerplate( @@ -394,7 +394,7 @@ void main() { final Element srcMaterialElement = tester.firstElement( find.ancestor(of: find.text('Closed'), matching: find.byType(Material)), ); - final Material srcMaterial = srcMaterialElement.widget as Material; + final srcMaterial = srcMaterialElement.widget as Material; expect(srcMaterial.color, Colors.green); expect(srcMaterial.elevation, 4.0); expect(srcMaterial.shape, shape); @@ -416,7 +416,7 @@ void main() { final Element destMaterialElement = tester.firstElement( find.ancestor(of: find.text('Closed'), matching: find.byType(Material)), ); - final Material closedMaterial = destMaterialElement.widget as Material; + final closedMaterial = destMaterialElement.widget as Material; expect(closedMaterial.color, Colors.green); expect(closedMaterial.elevation, 4.0); expect(closedMaterial.shape, shape); @@ -429,14 +429,14 @@ void main() { expect(_getOpacity(tester, 'Open'), 0.0); expect(_getOpacity(tester, 'Closed'), 1.0); - final _TrackedData dataClosed = _TrackedData( + final dataClosed = _TrackedData( closedMaterial, closedMaterialRect, ); // The fade-out takes 1/5 of 300ms. Let's jump to the midpoint of that. await tester.pump(const Duration(milliseconds: 30)); // 300ms * 1/10 = 30ms - final _TrackedData dataMidFadeOut = _TrackedData( + final dataMidFadeOut = _TrackedData( destMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == destMaterialElement), @@ -454,7 +454,7 @@ void main() { // Let's jump to the crossover point at 1/5 of 300ms. await tester.pump(const Duration(milliseconds: 30)); // 300ms * 1/5 = 60ms - final _TrackedData dataMidpoint = _TrackedData( + final dataMidpoint = _TrackedData( destMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == destMaterialElement), @@ -471,7 +471,7 @@ void main() { // Let's jump to the middle of the fade-in at 3/5 of 300ms await tester.pump(const Duration(milliseconds: 120)); // 300ms * 3/5 = 180ms - final _TrackedData dataMidFadeIn = _TrackedData( + final dataMidFadeIn = _TrackedData( destMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == destMaterialElement), @@ -489,7 +489,7 @@ void main() { // Let's jump almost to the end of the transition. await tester.pump(const Duration(milliseconds: 120)); - final _TrackedData dataTransitionDone = _TrackedData( + final dataTransitionDone = _TrackedData( destMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == destMaterialElement), @@ -517,7 +517,7 @@ void main() { final Element finalMaterialElement = tester.firstElement( find.ancestor(of: find.text('Open'), matching: find.byType(Material)), ); - final _TrackedData dataOpen = _TrackedData( + final dataOpen = _TrackedData( finalMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == finalMaterialElement), @@ -565,7 +565,7 @@ void main() { final Element initialMaterialElement = tester.firstElement( find.ancestor(of: find.text('Open'), matching: find.byType(Material)), ); - final _TrackedData dataOpen = _TrackedData( + final dataOpen = _TrackedData( initialMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == initialMaterialElement), @@ -587,7 +587,7 @@ void main() { final Element materialElement = tester.firstElement( find.ancestor(of: find.text('Open'), matching: find.byType(Material)), ); - final _TrackedData dataTransitionStart = _TrackedData( + final dataTransitionStart = _TrackedData( materialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == materialElement), @@ -602,7 +602,7 @@ void main() { // Jump to mid-point of fade-out: 1/10 of 300ms. await tester.pump(const Duration(milliseconds: 30)); // 300ms * 1/10 = 30ms - final _TrackedData dataMidFadeOut = _TrackedData( + final dataMidFadeOut = _TrackedData( materialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == materialElement), @@ -623,7 +623,7 @@ void main() { // Let's jump to the crossover point at 1/5 of 300ms. await tester.pump(const Duration(milliseconds: 30)); // 300ms * 1/5 = 60ms - final _TrackedData dataMidpoint = _TrackedData( + final dataMidpoint = _TrackedData( materialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == materialElement), @@ -640,7 +640,7 @@ void main() { // Let's jump to the middle of the fade-in at 3/5 of 300ms await tester.pump(const Duration(milliseconds: 120)); // 300ms * 3/5 = 180ms - final _TrackedData dataMidFadeIn = _TrackedData( + final dataMidFadeIn = _TrackedData( materialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == materialElement), @@ -658,7 +658,7 @@ void main() { // Let's jump almost to the end of the transition. await tester.pump(const Duration(milliseconds: 120)); - final _TrackedData dataTransitionDone = _TrackedData( + final dataTransitionDone = _TrackedData( materialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == materialElement), @@ -685,7 +685,7 @@ void main() { final Element finalMaterialElement = tester.firstElement( find.ancestor(of: find.text('Closed'), matching: find.byType(Material)), ); - final _TrackedData dataClosed = _TrackedData( + final dataClosed = _TrackedData( finalMaterialElement.widget as Material, tester.getRect( find.byElementPredicate((Element e) => e == finalMaterialElement), @@ -1040,7 +1040,7 @@ void main() { ), ), ); - const Rect fullNavigator = Rect.fromLTWH(250, 100, 300, 400); + const fullNavigator = Rect.fromLTWH(250, 100, 300, 400); expect(tester.getRect(find.byType(Navigator)), fullNavigator); final Rect materialRectClosed = tester.getRect( @@ -1306,7 +1306,7 @@ void main() { testWidgets( 'Container partly offscreen can be opened without crash - vertical', (WidgetTester tester) async { - final ScrollController controller = ScrollController( + final controller = ScrollController( initialScrollOffset: 50, ); await tester.pumpWidget( @@ -1382,7 +1382,7 @@ void main() { testWidgets( 'Container partly offscreen can be opened without crash - horizontal', (WidgetTester tester) async { - final ScrollController controller = ScrollController( + final controller = ScrollController( initialScrollOffset: 50, ); await tester.pumpWidget( @@ -1494,7 +1494,7 @@ void main() { testWidgets('onClosed callback is called when container has closed', ( WidgetTester tester, ) async { - bool hasClosed = false; + var hasClosed = false; final Widget openContainer = OpenContainer( onClosed: (dynamic _) { hasClosed = true; @@ -1666,8 +1666,8 @@ void main() { testWidgets( 'Verify that "useRootNavigator: false" uses the correct navigator', (WidgetTester tester) async { - const Key appKey = Key('App'); - const Key nestedNavigatorKey = Key('Nested Navigator'); + const appKey = Key('App'); + const nestedNavigatorKey = Key('Nested Navigator'); await tester.pumpWidget( createRootNavigatorTest( @@ -1698,8 +1698,8 @@ void main() { testWidgets( 'Verify that "useRootNavigator: true" uses the correct navigator', (WidgetTester tester) async { - const Key appKey = Key('App'); - const Key nestedNavigatorKey = Key('Nested Navigator'); + const appKey = Key('App'); + const nestedNavigatorKey = Key('Nested Navigator'); await tester.pumpWidget( createRootNavigatorTest( @@ -1730,8 +1730,8 @@ void main() { testWidgets('Verify correct opened size when "useRootNavigator: false"', ( WidgetTester tester, ) async { - const Key appKey = Key('App'); - const Key nestedNavigatorKey = Key('Nested Navigator'); + const appKey = Key('App'); + const nestedNavigatorKey = Key('Nested Navigator'); await tester.pumpWidget( createRootNavigatorTest( @@ -1753,8 +1753,8 @@ void main() { testWidgets('Verify correct opened size when "useRootNavigator: true"', ( WidgetTester tester, ) async { - const Key appKey = Key('App'); - const Key nestedNavigatorKey = Key('Nested Navigator'); + const appKey = Key('App'); + const nestedNavigatorKey = Key('Nested Navigator'); await tester.pumpWidget( createRootNavigatorTest( @@ -1776,7 +1776,7 @@ void main() { testWidgets('Verify routeSettings passed to Navigator', ( WidgetTester tester, ) async { - const RouteSettings routeSettings = RouteSettings( + const routeSettings = RouteSettings( name: 'route-name', arguments: 'arguments', ); @@ -1852,12 +1852,12 @@ class _TrackedData { } double _getRadius(Material material) { - final RoundedRectangleBorder? shape = + final shape = material.shape as RoundedRectangleBorder?; if (shape == null) { return 0.0; } - final BorderRadius radius = shape.borderRadius as BorderRadius; + final radius = shape.borderRadius as BorderRadius; return radius.topRight.x; } diff --git a/packages/animations/test/page_transition_switcher_test.dart b/packages/animations/test/page_transition_switcher_test.dart index 930729893c7..56f4c774b81 100644 --- a/packages/animations/test/page_transition_switcher_test.dart +++ b/packages/animations/test/page_transition_switcher_test.dart @@ -8,9 +8,9 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('transitions in a new child.', (WidgetTester tester) async { - final UniqueKey containerOne = UniqueKey(); - final UniqueKey containerTwo = UniqueKey(); - final UniqueKey containerThree = UniqueKey(); + final containerOne = UniqueKey(); + final containerTwo = UniqueKey(); + final containerThree = UniqueKey(); await tester.pumpWidget( PageTransitionSwitcher( duration: const Duration(milliseconds: 100), @@ -87,9 +87,9 @@ void main() { testWidgets('transitions in a new child in reverse.', ( WidgetTester tester, ) async { - final UniqueKey containerOne = UniqueKey(); - final UniqueKey containerTwo = UniqueKey(); - final UniqueKey containerThree = UniqueKey(); + final containerOne = UniqueKey(); + final containerTwo = UniqueKey(); + final containerThree = UniqueKey(); await tester.pumpWidget( PageTransitionSwitcher( duration: const Duration(milliseconds: 100), @@ -167,9 +167,9 @@ void main() { }); testWidgets('switch from forward to reverse', (WidgetTester tester) async { - final UniqueKey containerOne = UniqueKey(); - final UniqueKey containerTwo = UniqueKey(); - final UniqueKey containerThree = UniqueKey(); + final containerOne = UniqueKey(); + final containerTwo = UniqueKey(); + final containerThree = UniqueKey(); await tester.pumpWidget( PageTransitionSwitcher( duration: const Duration(milliseconds: 100), @@ -239,9 +239,9 @@ void main() { }); testWidgets('switch from reverse to forward.', (WidgetTester tester) async { - final UniqueKey containerOne = UniqueKey(); - final UniqueKey containerTwo = UniqueKey(); - final UniqueKey containerThree = UniqueKey(); + final containerOne = UniqueKey(); + final containerTwo = UniqueKey(); + final containerThree = UniqueKey(); await tester.pumpWidget( PageTransitionSwitcher( duration: const Duration(milliseconds: 100), @@ -458,9 +458,9 @@ void main() { testWidgets("doesn't reset state of the children in transitions.", ( WidgetTester tester, ) async { - final UniqueKey statefulOne = UniqueKey(); - final UniqueKey statefulTwo = UniqueKey(); - final UniqueKey statefulThree = UniqueKey(); + final statefulOne = UniqueKey(); + final statefulTwo = UniqueKey(); + final statefulThree = UniqueKey(); StatefulTestWidgetState.generation = 0; @@ -555,9 +555,9 @@ void main() { testWidgets( 'updates previous child transitions if the transitionBuilder changes.', (WidgetTester tester) async { - final UniqueKey containerOne = UniqueKey(); - final UniqueKey containerTwo = UniqueKey(); - final UniqueKey containerThree = UniqueKey(); + final containerOne = UniqueKey(); + final containerTwo = UniqueKey(); + final containerThree = UniqueKey(); // Insert three unique children so that we have some previous children. await tester.pumpWidget( @@ -687,8 +687,8 @@ Widget _transitionBuilder( Map _getSecondaryAnimation(List keys, WidgetTester tester) { expect(find.byType(FadeTransition), findsNWidgets(keys.length)); - final Map result = {}; - for (final Key key in keys) { + final result = {}; + for (final key in keys) { final FadeTransition transition = tester.firstWidget( find.ancestor(of: find.byKey(key), matching: find.byType(FadeTransition)), ); @@ -699,8 +699,8 @@ Map _getSecondaryAnimation(List keys, WidgetTester tester) { Map _getPrimaryAnimation(List keys, WidgetTester tester) { expect(find.byType(ScaleTransition), findsNWidgets(keys.length)); - final Map result = {}; - for (final Key key in keys) { + final result = {}; + for (final key in keys) { final ScaleTransition transition = tester.firstWidget( find.ancestor( of: find.byKey(key), diff --git a/packages/animations/test/shared_axis_transition_test.dart b/packages/animations/test/shared_axis_transition_test.dart index db861390a6f..d730dc6c99b 100644 --- a/packages/animations/test/shared_axis_transition_test.dart +++ b/packages/animations/test/shared_axis_transition_test.dart @@ -12,10 +12,10 @@ void main() { testWidgets( 'SharedAxisPageTransitionsBuilder builds a SharedAxisTransition', (WidgetTester tester) async { - final AnimationController animation = AnimationController( + final animation = AnimationController( vsync: const TestVSync(), ); - final AnimationController secondaryAnimation = AnimationController( + final secondaryAnimation = AnimationController( vsync: const TestVSync(), ); @@ -38,9 +38,9 @@ void main() { testWidgets('SharedAxisTransition runs forward', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -160,9 +160,9 @@ void main() { testWidgets('SharedAxisTransition runs in reverse', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -285,9 +285,9 @@ void main() { testWidgets('SharedAxisTransition does not jump when interrupted', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -414,9 +414,9 @@ void main() { testWidgets('State is not lost when transitioning', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -502,9 +502,9 @@ void main() { }); testWidgets('default fill color', (WidgetTester tester) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; // The default fill color should be derived from ThemeData.canvasColor. final Color defaultFillColor = ThemeData().canvasColor; @@ -547,9 +547,9 @@ void main() { }); testWidgets('custom fill color', (WidgetTester tester) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -590,11 +590,11 @@ void main() { }); testWidgets('should keep state', (WidgetTester tester) async { - final AnimationController animation = AnimationController( + final animation = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); - final AnimationController secondaryAnimation = AnimationController( + final secondaryAnimation = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); @@ -662,10 +662,10 @@ void main() { testWidgets( 'SharedAxisPageTransitionsBuilder builds a SharedAxisTransition', (WidgetTester tester) async { - final AnimationController animation = AnimationController( + final animation = AnimationController( vsync: const TestVSync(), ); - final AnimationController secondaryAnimation = AnimationController( + final secondaryAnimation = AnimationController( vsync: const TestVSync(), ); @@ -688,9 +688,9 @@ void main() { testWidgets('SharedAxisTransition runs forward', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -810,9 +810,9 @@ void main() { testWidgets('SharedAxisTransition runs in reverse', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -935,9 +935,9 @@ void main() { testWidgets('SharedAxisTransition does not jump when interrupted', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -1064,9 +1064,9 @@ void main() { testWidgets('State is not lost when transitioning', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -1152,9 +1152,9 @@ void main() { }); testWidgets('default fill color', (WidgetTester tester) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; // The default fill color should be derived from ThemeData.canvasColor. final Color defaultFillColor = ThemeData().canvasColor; @@ -1197,9 +1197,9 @@ void main() { }); testWidgets('custom fill color', (WidgetTester tester) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -1240,11 +1240,11 @@ void main() { }); testWidgets('should keep state', (WidgetTester tester) async { - final AnimationController animation = AnimationController( + final animation = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); - final AnimationController secondaryAnimation = AnimationController( + final secondaryAnimation = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); @@ -1312,10 +1312,10 @@ void main() { testWidgets( 'SharedAxisPageTransitionsBuilder builds a SharedAxisTransition', (WidgetTester tester) async { - final AnimationController animation = AnimationController( + final animation = AnimationController( vsync: const TestVSync(), ); - final AnimationController secondaryAnimation = AnimationController( + final secondaryAnimation = AnimationController( vsync: const TestVSync(), ); @@ -1338,9 +1338,9 @@ void main() { testWidgets('SharedAxisTransition runs forward', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -1415,9 +1415,9 @@ void main() { testWidgets('SharedAxisTransition runs in reverse', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -1497,9 +1497,9 @@ void main() { testWidgets('SharedAxisTransition does not jump when interrupted', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -1569,9 +1569,9 @@ void main() { testWidgets('SharedAxisTransition properly disposes animation', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -1604,9 +1604,9 @@ void main() { testWidgets('State is not lost when transitioning', ( WidgetTester tester, ) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -1692,9 +1692,9 @@ void main() { }); testWidgets('default fill color', (WidgetTester tester) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; // The default fill color should be derived from ThemeData.canvasColor. final Color defaultFillColor = ThemeData().canvasColor; @@ -1737,9 +1737,9 @@ void main() { }); testWidgets('custom fill color', (WidgetTester tester) async { - final GlobalKey navigator = GlobalKey(); - const String bottomRoute = '/'; - const String topRoute = '/a'; + final navigator = GlobalKey(); + const bottomRoute = '/'; + const topRoute = '/a'; await tester.pumpWidget( _TestWidget( @@ -1780,11 +1780,11 @@ void main() { }); testWidgets('should keep state', (WidgetTester tester) async { - final AnimationController animation = AnimationController( + final animation = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); - final AnimationController secondaryAnimation = AnimationController( + final secondaryAnimation = AnimationController( vsync: const TestVSync(), duration: const Duration(milliseconds: 300), ); @@ -1855,7 +1855,7 @@ double _getOpacity(String key, WidgetTester tester) { matching: find.byType(FadeTransition), ); return tester.widgetList(finder).fold(1.0, (double a, Widget widget) { - final FadeTransition transition = widget as FadeTransition; + final transition = widget as FadeTransition; return a * transition.opacity.value; }); } @@ -1876,7 +1876,7 @@ double _getTranslationOffset( double a, Widget widget, ) { - final Transform transition = widget as Transform; + final transition = widget as Transform; final Vector3 translation = transition.transform.getTranslation(); return a + translation.x; }); @@ -1885,7 +1885,7 @@ double _getTranslationOffset( double a, Widget widget, ) { - final Transform transition = widget as Transform; + final transition = widget as Transform; final Vector3 translation = transition.transform.getTranslation(); return a + translation.y; }); @@ -1904,7 +1904,7 @@ double _getScale(String key, WidgetTester tester) { matching: find.byType(ScaleTransition), ); return tester.widgetList(finder).fold(1.0, (double a, Widget widget) { - final ScaleTransition transition = widget as ScaleTransition; + final transition = widget as ScaleTransition; return a * transition.scale.value; }); } diff --git a/packages/camera/camera/example/integration_test/camera_test.dart b/packages/camera/camera/example/integration_test/camera_test.dart index c12e5880bd5..0867d292a44 100644 --- a/packages/camera/camera/example/integration_test/camera_test.dart +++ b/packages/camera/camera/example/integration_test/camera_test.dart @@ -31,7 +31,7 @@ void main() { await testDir.delete(recursive: true); }); - final Map presetExpectedSizes = + final presetExpectedSizes = { ResolutionPreset.low: Platform.isAndroid ? const Size(240, 320) @@ -70,8 +70,8 @@ void main() { final XFile file = await controller.stopVideoRecording(); // Load video metadata - final File videoFile = File(file.path); - final VideoPlayerController videoController = VideoPlayerController.file( + final videoFile = File(file.path); + final videoController = VideoPlayerController.file( videoFile, ); await videoController.initialize(); @@ -92,11 +92,11 @@ void main() { if (cameras.isEmpty) { return; } - for (final CameraDescription cameraDescription in cameras) { - bool previousPresetExactlySupported = true; + for (final cameraDescription in cameras) { + var previousPresetExactlySupported = true; for (final MapEntry preset in presetExpectedSizes.entries) { - final CameraController controller = CameraController( + final controller = CameraController( cameraDescription, preset.key, ); @@ -125,7 +125,7 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], ResolutionPreset.low, enableAudio: false, @@ -142,8 +142,8 @@ void main() { final int recordingTime = DateTime.now().millisecondsSinceEpoch - recordingStart; - final File videoFile = File(file.path); - final VideoPlayerController videoController = VideoPlayerController.file( + final videoFile = File(file.path); + final videoController = VideoPlayerController.file( videoFile, ); await videoController.initialize(); @@ -159,7 +159,7 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], ResolutionPreset.low, enableAudio: false, @@ -169,14 +169,14 @@ void main() { await controller.prepareForVideoRecording(); int startPause; - int timePaused = 0; - const int pauseIterations = 2; + var timePaused = 0; + const pauseIterations = 2; await controller.startVideoRecording(); final int recordingStart = DateTime.now().millisecondsSinceEpoch; sleep(const Duration(milliseconds: 500)); - for (int i = 0; i < pauseIterations; i++) { + for (var i = 0; i < pauseIterations; i++) { await controller.pauseVideoRecording(); startPause = DateTime.now().millisecondsSinceEpoch; sleep(const Duration(milliseconds: 500)); @@ -190,8 +190,8 @@ void main() { final int recordingTime = DateTime.now().millisecondsSinceEpoch - recordingStart; - final File videoFile = File(file.path); - final VideoPlayerController videoController = VideoPlayerController.file( + final videoFile = File(file.path); + final videoController = VideoPlayerController.file( videoFile, ); await videoController.initialize(); @@ -207,14 +207,14 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], ResolutionPreset.low, enableAudio: false, ); await controller.initialize(); - bool isDetecting = false; + var isDetecting = false; await controller.startImageStream((CameraImage image) { if (isDetecting) { @@ -239,7 +239,7 @@ void main() { List cameras, ImageFormatGroup? imageFormatGroup, ) async { - final CameraController controller = CameraController( + final controller = CameraController( cameras.first, ResolutionPreset.low, enableAudio: false, @@ -247,7 +247,7 @@ void main() { ); await controller.initialize(); - final Completer completer = Completer(); + final completer = Completer(); await controller.startImageStream((CameraImage image) { if (!completer.isCompleted) { @@ -270,7 +270,7 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], ResolutionPreset.low, ); @@ -289,8 +289,8 @@ void main() { final XFile file = await controller.stopVideoRecording(); - final File videoFile = File(file.path); - final VideoPlayerController videoController = VideoPlayerController.file( + final videoFile = File(file.path); + final videoController = VideoPlayerController.file( videoFile, ); await videoController.initialize(); @@ -310,7 +310,7 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], ResolutionPreset.low, enableAudio: false, diff --git a/packages/camera/camera/example/lib/main.dart b/packages/camera/camera/example/lib/main.dart index f8d4c8c44dc..9185f3e34f1 100644 --- a/packages/camera/camera/example/lib/main.dart +++ b/packages/camera/camera/example/lib/main.dart @@ -558,7 +558,7 @@ class _CameraExampleHomeState extends State /// Display a row of toggle to select the camera (or a message if no camera is available). Widget _cameraTogglesRowWidget() { - final List toggles = []; + final toggles = []; void onChanged(CameraDescription? description) { if (description == null) { @@ -614,7 +614,7 @@ class _CameraExampleHomeState extends State final CameraController cameraController = controller!; - final Offset offset = Offset( + final offset = Offset( details.localPosition.dx / constraints.maxWidth, details.localPosition.dy / constraints.maxHeight, ); @@ -633,7 +633,7 @@ class _CameraExampleHomeState extends State Future _initializeCameraController( CameraDescription cameraDescription, ) async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( cameraDescription, kIsWeb ? ResolutionPreset.max : ResolutionPreset.medium, enableAudio: enableAudio, @@ -985,7 +985,7 @@ class _CameraExampleHomeState extends State return; } - final VideoPlayerController vController = kIsWeb + final vController = kIsWeb ? VideoPlayerController.networkUrl(Uri.parse(videoFile!.path)) : VideoPlayerController.file(File(videoFile!.path)); diff --git a/packages/camera/camera/example/test/main_test.dart b/packages/camera/camera/example/test/main_test.dart index fe969d9a3c6..9563df089fa 100644 --- a/packages/camera/camera/example/test/main_test.dart +++ b/packages/camera/camera/example/test/main_test.dart @@ -20,7 +20,7 @@ void main() { ) async { WidgetsFlutterBinding.ensureInitialized(); // Adds 10 fake camera descriptions. - for (int i = 0; i < 10; i++) { + for (var i = 0; i < 10; i++) { cameras.add( CameraDescription( name: 'camera_$i', diff --git a/packages/camera/camera/example/test_driver/integration_test.dart b/packages/camera/camera/example/test_driver/integration_test.dart index d512473309e..0fbcfe628bb 100644 --- a/packages/camera/camera/example/test_driver/integration_test.dart +++ b/packages/camera/camera/example/test_driver/integration_test.dart @@ -17,7 +17,7 @@ Future main() async { print('This test must be run on a POSIX host. Skipping...'); exit(0); } - final bool adbExists = + final adbExists = Process.runSync('which', ['adb']).exitCode == 0; if (!adbExists) { print(r'This test needs ADB to exist on the $PATH. Skipping...'); @@ -61,6 +61,6 @@ Future main() async { 'android.permission.RECORD_AUDIO', ]); - final Map result = jsonDecode(data) as Map; + final result = jsonDecode(data) as Map; exit(result['result'] == 'true' ? 0 : 1); } diff --git a/packages/camera/camera/lib/src/camera_controller.dart b/packages/camera/camera/lib/src/camera_controller.dart index 23494b4b27f..166e879507c 100644 --- a/packages/camera/camera/lib/src/camera_controller.dart +++ b/packages/camera/camera/lib/src/camera_controller.dart @@ -327,11 +327,11 @@ class CameraController extends ValueNotifier { ); } - final Completer initializeCompleter = Completer(); + final initializeCompleter = Completer(); _initializeFuture = initializeCompleter.future; try { - final Completer initializeCompleter = + final initializeCompleter = Completer(); _deviceOrientationSubscription ??= CameraPlatform.instance diff --git a/packages/camera/camera/lib/src/camera_preview.dart b/packages/camera/camera/lib/src/camera_preview.dart index ea0b601ac73..c4af103bb00 100644 --- a/packages/camera/camera/lib/src/camera_preview.dart +++ b/packages/camera/camera/lib/src/camera_preview.dart @@ -59,7 +59,7 @@ class CameraPreview extends StatelessWidget { } int _getQuarterTurns() { - final Map turns = { + final turns = { DeviceOrientation.portraitUp: 0, DeviceOrientation.landscapeRight: 1, DeviceOrientation.portraitDown: 2, diff --git a/packages/camera/camera/test/camera_image_stream_test.dart b/packages/camera/camera/test/camera_image_stream_test.dart index a78536b4b00..0a9644fcd8d 100644 --- a/packages/camera/camera/test/camera_image_stream_test.dart +++ b/packages/camera/camera/test/camera_image_stream_test.dart @@ -20,7 +20,7 @@ void main() { }); test('startImageStream() throws $CameraException when uninitialized', () { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -50,7 +50,7 @@ void main() { test( 'startImageStream() throws $CameraException when recording videos', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -80,7 +80,7 @@ void main() { test( 'startImageStream() throws $CameraException when already streaming images', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -107,7 +107,7 @@ void main() { ); test('startImageStream() calls CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -127,7 +127,7 @@ void main() { }); test('stopImageStream() throws $CameraException when uninitialized', () { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -157,7 +157,7 @@ void main() { test( 'stopImageStream() throws $CameraException when not streaming images', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -181,7 +181,7 @@ void main() { ); test('stopImageStream() intended behaviour', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -203,7 +203,7 @@ void main() { }); test('startVideoRecording() can stream images', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -225,7 +225,7 @@ void main() { }); test('startVideoRecording() by default does not stream', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, diff --git a/packages/camera/camera/test/camera_image_test.dart b/packages/camera/camera/test/camera_image_test.dart index a9ea9d9c663..54bc4941869 100644 --- a/packages/camera/camera/test/camera_image_test.dart +++ b/packages/camera/camera/test/camera_image_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { test('translates correctly from platform interface classes', () { - final CameraImageData originalImage = CameraImageData( + final originalImage = CameraImageData( format: const CameraImageFormat(ImageFormatGroup.jpeg, raw: 1234), planes: [ CameraImagePlane( @@ -34,7 +34,7 @@ void main() { sensorSensitivity: 1.3, ); - final CameraImage image = CameraImage.fromPlatformInterface(originalImage); + final image = CameraImage.fromPlatformInterface(originalImage); // Simple values. expect(image.width, 640); expect(image.height, 480); @@ -46,12 +46,12 @@ void main() { expect(image.format.raw, 1234); // Planes. expect(image.planes.length, originalImage.planes.length); - for (int i = 0; i < image.planes.length; i++) { + for (var i = 0; i < image.planes.length; i++) { expect( image.planes[i].bytes.length, originalImage.planes[i].bytes.length, ); - for (int j = 0; j < image.planes[i].bytes.length; j++) { + for (var j = 0; j < image.planes[i].bytes.length; j++) { expect(image.planes[i].bytes[j], originalImage.planes[i].bytes[j]); } expect( @@ -67,7 +67,7 @@ void main() { group('legacy constructors', () { test('$CameraImage can be created', () { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final CameraImage cameraImage = CameraImage.fromPlatformData( + final cameraImage = CameraImage.fromPlatformData( { 'format': 35, 'height': 1, @@ -95,7 +95,7 @@ void main() { test('$CameraImage has ImageFormatGroup.yuv420 for iOS', () { debugDefaultTargetPlatformOverride = TargetPlatform.iOS; - final CameraImage cameraImage = CameraImage.fromPlatformData( + final cameraImage = CameraImage.fromPlatformData( { 'format': 875704438, 'height': 1, @@ -120,7 +120,7 @@ void main() { test('$CameraImage has ImageFormatGroup.yuv420 for Android', () { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final CameraImage cameraImage = CameraImage.fromPlatformData( + final cameraImage = CameraImage.fromPlatformData( { 'format': 35, 'height': 1, @@ -145,7 +145,7 @@ void main() { test('$CameraImage has ImageFormatGroup.nv21 for android', () { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final CameraImage cameraImage = CameraImage.fromPlatformData( + final cameraImage = CameraImage.fromPlatformData( { 'format': 17, 'height': 1, @@ -170,7 +170,7 @@ void main() { test('$CameraImage has ImageFormatGroup.bgra8888 for iOS', () { debugDefaultTargetPlatformOverride = TargetPlatform.iOS; - final CameraImage cameraImage = CameraImage.fromPlatformData( + final cameraImage = CameraImage.fromPlatformData( { 'format': 1111970369, 'height': 1, @@ -193,7 +193,7 @@ void main() { }); test('$CameraImage has ImageFormatGroup.unknown', () { - final CameraImage cameraImage = CameraImage.fromPlatformData( + final cameraImage = CameraImage.fromPlatformData( { 'format': null, 'height': 1, diff --git a/packages/camera/camera/test/camera_preview_test.dart b/packages/camera/camera/test/camera_preview_test.dart index bafc77831dc..cec01181bb0 100644 --- a/packages/camera/camera/test/camera_preview_test.dart +++ b/packages/camera/camera/test/camera_preview_test.dart @@ -150,7 +150,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -189,7 +189,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -228,7 +228,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -267,7 +267,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -306,7 +306,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -344,7 +344,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -382,7 +382,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -420,7 +420,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -458,7 +458,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -492,7 +492,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -526,7 +526,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -560,7 +560,7 @@ void main() { (WidgetTester tester) async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( @@ -594,7 +594,7 @@ void main() { WidgetTester tester, ) async { debugDefaultTargetPlatformOverride = TargetPlatform.iOS; - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( isInitialized: true, diff --git a/packages/camera/camera/test/camera_test.dart b/packages/camera/camera/test/camera_test.dart index c3af92bb757..4b512aafa00 100644 --- a/packages/camera/camera/test/camera_test.dart +++ b/packages/camera/camera/test/camera_test.dart @@ -61,8 +61,8 @@ void main() { test( 'debugCheckIsDisposed should not throw assertion error when disposed', () { - const MockCameraDescription description = MockCameraDescription(); - final CameraController controller = CameraController( + const description = MockCameraDescription(); + final controller = CameraController( description, ResolutionPreset.low, ); @@ -76,8 +76,8 @@ void main() { test( 'debugCheckIsDisposed should throw assertion error when not disposed', () { - const MockCameraDescription description = MockCameraDescription(); - final CameraController controller = CameraController( + const description = MockCameraDescription(); + final controller = CameraController( description, ResolutionPreset.low, ); @@ -101,7 +101,7 @@ void main() { }); test('Can be initialized', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -117,7 +117,7 @@ void main() { }); test('can be initialized with media settings', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -142,7 +142,7 @@ void main() { }); test('default constructor initializes media settings', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -160,7 +160,7 @@ void main() { }); test('can be disposed', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -180,7 +180,7 @@ void main() { }); test('initialize() throws CameraException when disposed', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -213,7 +213,7 @@ void main() { test( 'initialize() throws $CameraException on $PlatformException ', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -240,7 +240,7 @@ void main() { test('initialize() sets imageFormat', () async { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -261,7 +261,7 @@ void main() { test( 'setDescription waits for initialize before calling dispose', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -271,7 +271,7 @@ void main() { imageFormatGroup: ImageFormatGroup.bgra8888, ); - final Completer initializeCompleter = Completer(); + final initializeCompleter = Completer(); when( CameraPlatform.instance.initializeCamera( mockInitializeCamera, @@ -299,7 +299,7 @@ void main() { ); test('prepareForVideoRecording() calls $CameraPlatform ', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -315,7 +315,7 @@ void main() { }); test('takePicture() throws $CameraException when uninitialized ', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -344,7 +344,7 @@ void main() { test( 'takePicture() throws $CameraException when takePicture is true', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -371,7 +371,7 @@ void main() { ); test('takePicture() returns $XFile', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -388,7 +388,7 @@ void main() { test( 'takePicture() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -416,7 +416,7 @@ void main() { test( 'startVideoRecording() throws $CameraException when uninitialized', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -446,7 +446,7 @@ void main() { test( 'startVideoRecording() throws $CameraException when recording videos', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -477,7 +477,7 @@ void main() { test( 'getMaxZoomLevel() throws $CameraException when uninitialized', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -506,7 +506,7 @@ void main() { ); test('getMaxZoomLevel() throws $CameraException when disposed', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -539,7 +539,7 @@ void main() { test( 'getMaxZoomLevel() throws $CameraException when a platform exception occured.', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -575,7 +575,7 @@ void main() { ); test('getMaxZoomLevel() returns max zoom level.', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -596,7 +596,7 @@ void main() { test( 'getMinZoomLevel() throws $CameraException when uninitialized', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -625,7 +625,7 @@ void main() { ); test('getMinZoomLevel() throws $CameraException when disposed', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -658,7 +658,7 @@ void main() { test( 'getMinZoomLevel() throws $CameraException when a platform exception occured.', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -694,7 +694,7 @@ void main() { ); test('getMinZoomLevel() returns max zoom level.', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -713,7 +713,7 @@ void main() { }); test('setZoomLevel() throws $CameraException when uninitialized', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -741,7 +741,7 @@ void main() { }); test('setZoomLevel() throws $CameraException when disposed', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -774,7 +774,7 @@ void main() { test( 'setZoomLevel() throws $CameraException when a platform exception occured.', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -814,7 +814,7 @@ void main() { test( 'setZoomLevel() completes and calls method channel with correct value.', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -833,7 +833,7 @@ void main() { ); test('setFlashMode() calls $CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -856,7 +856,7 @@ void main() { test( 'setFlashMode() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -892,7 +892,7 @@ void main() { ); test('setExposureMode() calls $CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -915,7 +915,7 @@ void main() { test( 'setExposureMode() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -951,7 +951,7 @@ void main() { ); test('setExposurePoint() calls $CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -974,7 +974,7 @@ void main() { test( 'setExposurePoint() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1010,7 +1010,7 @@ void main() { ); test('getMinExposureOffset() calls $CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1034,7 +1034,7 @@ void main() { test( 'getMinExposureOffset() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1066,7 +1066,7 @@ void main() { ); test('getMaxExposureOffset() calls $CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1090,7 +1090,7 @@ void main() { test( 'getMaxExposureOffset() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1122,7 +1122,7 @@ void main() { ); test('getExposureOffsetStepSize() calls $CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1150,7 +1150,7 @@ void main() { test( 'getExposureOffsetStepSize() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1182,7 +1182,7 @@ void main() { ); test('setExposureOffset() calls $CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1222,7 +1222,7 @@ void main() { test( 'setExposureOffset() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1271,7 +1271,7 @@ void main() { test( 'setExposureOffset() throws $CameraException when offset is out of bounds', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1361,7 +1361,7 @@ void main() { ); test('setExposureOffset() rounds offset to nearest step', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1475,7 +1475,7 @@ void main() { }); test('pausePreview() calls $CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1503,7 +1503,7 @@ void main() { test( 'pausePreview() does not call $CameraPlatform when already paused', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1528,7 +1528,7 @@ void main() { test( 'pausePreview() sets previewPauseOrientation according to locked orientation', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1561,7 +1561,7 @@ void main() { test( 'pausePreview() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1593,7 +1593,7 @@ void main() { ); test('resumePreview() calls $CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1617,7 +1617,7 @@ void main() { test( 'resumePreview() does not call $CameraPlatform when not paused', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1642,7 +1642,7 @@ void main() { test( 'resumePreview() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1677,7 +1677,7 @@ void main() { ); test('lockCaptureOrientation() calls $CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1717,7 +1717,7 @@ void main() { test( 'lockCaptureOrientation() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1752,7 +1752,7 @@ void main() { ); test('unlockCaptureOrientation() calls $CameraPlatform', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, @@ -1775,7 +1775,7 @@ void main() { test( 'unlockCaptureOrientation() throws $CameraException on $PlatformException', () async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( const CameraDescription( name: 'cam', lensDirection: CameraLensDirection.back, diff --git a/packages/camera/camera/test/camera_value_test.dart b/packages/camera/camera/test/camera_value_test.dart index 205ed6ce884..aada8064ac3 100644 --- a/packages/camera/camera/test/camera_value_test.dart +++ b/packages/camera/camera/test/camera_value_test.dart @@ -11,7 +11,7 @@ import 'camera_preview_test.dart'; void main() { group('camera_value', () { test('Can be created', () { - const CameraValue cameraValue = CameraValue( + const cameraValue = CameraValue( isInitialized: false, previewSize: Size(10, 10), isRecordingPaused: false, @@ -52,7 +52,7 @@ void main() { }); test('Can be created as uninitialized', () { - const CameraValue cameraValue = CameraValue.uninitialized( + const cameraValue = CameraValue.uninitialized( FakeController.fakeDescription, ); @@ -76,7 +76,7 @@ void main() { }); test('Can be copied with isInitialized', () { - const CameraValue cv = CameraValue.uninitialized( + const cv = CameraValue.uninitialized( FakeController.fakeDescription, ); final CameraValue cameraValue = cv.copyWith(isInitialized: true); @@ -101,7 +101,7 @@ void main() { }); test('Has aspectRatio after setting size', () { - const CameraValue cv = CameraValue.uninitialized( + const cv = CameraValue.uninitialized( FakeController.fakeDescription, ); final CameraValue cameraValue = cv.copyWith( @@ -113,7 +113,7 @@ void main() { }); test('hasError is true after setting errorDescription', () { - const CameraValue cv = CameraValue.uninitialized( + const cv = CameraValue.uninitialized( FakeController.fakeDescription, ); final CameraValue cameraValue = cv.copyWith(errorDescription: 'error'); @@ -123,7 +123,7 @@ void main() { }); test('Recording paused is false when not recording', () { - const CameraValue cv = CameraValue.uninitialized( + const cv = CameraValue.uninitialized( FakeController.fakeDescription, ); final CameraValue cameraValue = cv.copyWith( @@ -136,7 +136,7 @@ void main() { }); test('toString() works as expected', () { - const CameraValue cameraValue = CameraValue( + const cameraValue = CameraValue( isInitialized: false, previewSize: Size(10, 10), isRecordingPaused: false, diff --git a/packages/camera/camera_android/example/integration_test/camera_test.dart b/packages/camera/camera_android/example/integration_test/camera_test.dart index 53fad65a878..6d857464aba 100644 --- a/packages/camera/camera_android/example/integration_test/camera_test.dart +++ b/packages/camera/camera_android/example/integration_test/camera_test.dart @@ -28,7 +28,7 @@ void main() { await testDir.delete(recursive: true); }); - final Map presetExpectedSizes = + final presetExpectedSizes = { ResolutionPreset.low: const Size(240, 320), ResolutionPreset.medium: const Size(480, 720), @@ -63,8 +63,8 @@ void main() { final XFile file = await controller.stopVideoRecording(); // Load video metadata - final File videoFile = File(file.path); - final VideoPlayerController videoController = VideoPlayerController.file( + final videoFile = File(file.path); + final videoController = VideoPlayerController.file( videoFile, ); await videoController.initialize(); @@ -86,11 +86,11 @@ void main() { if (cameras.isEmpty) { return; } - for (final CameraDescription cameraDescription in cameras) { - bool previousPresetExactlySupported = true; + for (final cameraDescription in cameras) { + var previousPresetExactlySupported = true; for (final MapEntry preset in presetExpectedSizes.entries) { - final CameraController controller = CameraController( + final controller = CameraController( cameraDescription, mediaSettings: MediaSettings(resolutionPreset: preset.key), ); @@ -120,13 +120,13 @@ void main() { return; } - final CameraController controller = CameraController(cameras[0]); + final controller = CameraController(cameras[0]); await controller.initialize(); await controller.prepareForVideoRecording(); int startPause; - int timePaused = 0; + var timePaused = 0; await controller.startVideoRecording(); final int recordingStart = DateTime.now().millisecondsSinceEpoch; @@ -152,8 +152,8 @@ void main() { final int recordingTime = DateTime.now().millisecondsSinceEpoch - recordingStart; - final File videoFile = File(file.path); - final VideoPlayerController videoController = VideoPlayerController.file( + final videoFile = File(file.path); + final videoController = VideoPlayerController.file( videoFile, ); await videoController.initialize(); @@ -170,7 +170,7 @@ void main() { return; } - final CameraController controller = CameraController(cameras[0]); + final controller = CameraController(cameras[0]); await controller.initialize(); await controller.prepareForVideoRecording(); @@ -179,7 +179,7 @@ void main() { // SDK < 26 will throw a platform error when trying to switch and keep the same camera // we accept either outcome here, while the native unit tests check the outcome based on the current Android SDK - bool failed = false; + var failed = false; try { await controller.setDescription(cameras[1]); } catch (err) { @@ -207,7 +207,7 @@ void main() { return; } - final CameraController controller = CameraController(cameras[0]); + final controller = CameraController(cameras[0]); await controller.initialize(); await controller.setDescription(cameras[1]); @@ -222,10 +222,10 @@ void main() { return; } - final CameraController controller = CameraController(cameras[0]); + final controller = CameraController(cameras[0]); await controller.initialize(); - bool isDetecting = false; + var isDetecting = false; await controller.startImageStream((CameraImageData image) { if (isDetecting) { @@ -252,10 +252,10 @@ void main() { return; } - final CameraController controller = CameraController(cameras[0]); + final controller = CameraController(cameras[0]); await controller.initialize(); - bool isDetecting = false; + var isDetecting = false; await controller.startVideoRecording( streamCallback: (CameraImageData image) { @@ -315,10 +315,10 @@ void main() { testWidgets('Control FPS', (WidgetTester tester) async { final CameraDescription cameraDescription = await getCamera(); - final List lengths = []; + final lengths = []; - for (final int fps in [10, 30]) { - final CameraController controller = CameraController( + for (final fps in [10, 30]) { + final controller = CameraController( cameraDescription, mediaSettings: MediaSettings( resolutionPreset: ResolutionPreset.medium, @@ -333,14 +333,14 @@ void main() { final XFile file = await controller.stopVideoRecording(); // Load video size - final File videoFile = File(file.path); + final videoFile = File(file.path); lengths.add(await videoFile.length()); await controller.dispose(); } - for (int n = 0; n < lengths.length - 1; n++) { + for (var n = 0; n < lengths.length - 1; n++) { expect(lengths[n], greaterThan(0)); } }); @@ -348,10 +348,10 @@ void main() { testWidgets('Control video bitrate', (WidgetTester tester) async { final CameraDescription cameraDescription = await getCamera(); - const int kiloBits = 1000; - final List lengths = []; - for (final int videoBitrate in [200 * kiloBits, 2000 * kiloBits]) { - final CameraController controller = CameraController( + const kiloBits = 1000; + final lengths = []; + for (final videoBitrate in [200 * kiloBits, 2000 * kiloBits]) { + final controller = CameraController( cameraDescription, mediaSettings: MediaSettings( resolutionPreset: ResolutionPreset.medium, @@ -366,27 +366,27 @@ void main() { final XFile file = await controller.stopVideoRecording(); // Load video size - final File videoFile = File(file.path); + final videoFile = File(file.path); lengths.add(await videoFile.length()); await controller.dispose(); } - for (int n = 0; n < lengths.length - 1; n++) { + for (var n = 0; n < lengths.length - 1; n++) { expect(lengths[n], greaterThan(0)); } }); testWidgets('Control audio bitrate', (WidgetTester tester) async { - final List lengths = []; + final lengths = []; final CameraDescription cameraDescription = await getCamera(); - const int kiloBits = 1000; + const kiloBits = 1000; - for (final int audioBitrate in [32 * kiloBits, 256 * kiloBits]) { - final CameraController controller = CameraController( + for (final audioBitrate in [32 * kiloBits, 256 * kiloBits]) { + final controller = CameraController( cameraDescription, mediaSettings: MediaSettings( //region Use lowest video settings for minimize video impact on bitrate @@ -406,7 +406,7 @@ void main() { final XFile file = await controller.stopVideoRecording(); // Load video metadata - final File videoFile = File(file.path); + final videoFile = File(file.path); final int length = await videoFile.length(); @@ -415,7 +415,7 @@ void main() { await controller.dispose(); } - for (int n = 0; n < lengths.length - 1; n++) { + for (var n = 0; n < lengths.length - 1; n++) { expect(lengths[n], greaterThan(0)); } }); diff --git a/packages/camera/camera_android/example/lib/camera_controller.dart b/packages/camera/camera_android/example/lib/camera_controller.dart index 2ca1a1f00a8..cbd46158634 100644 --- a/packages/camera/camera_android/example/lib/camera_controller.dart +++ b/packages/camera/camera_android/example/lib/camera_controller.dart @@ -206,7 +206,7 @@ class CameraController extends ValueNotifier { Future initialize() => _initializeWithDescription(description); Future _initializeWithDescription(CameraDescription description) async { - final Completer initializeCompleter = + final initializeCompleter = Completer(); _deviceOrientationSubscription = CameraPlatform.instance diff --git a/packages/camera/camera_android/example/lib/camera_preview.dart b/packages/camera/camera_android/example/lib/camera_preview.dart index 22fb2cc4d77..0a768b34063 100644 --- a/packages/camera/camera_android/example/lib/camera_preview.dart +++ b/packages/camera/camera_android/example/lib/camera_preview.dart @@ -62,7 +62,7 @@ class CameraPreview extends StatelessWidget { } int _getQuarterTurns() { - final Map turns = { + final turns = { DeviceOrientation.portraitUp: 0, DeviceOrientation.landscapeRight: 1, DeviceOrientation.portraitDown: 2, diff --git a/packages/camera/camera_android/example/lib/main.dart b/packages/camera/camera_android/example/lib/main.dart index 10b0b9c4e92..999b281f229 100644 --- a/packages/camera/camera_android/example/lib/main.dart +++ b/packages/camera/camera_android/example/lib/main.dart @@ -577,7 +577,7 @@ class _CameraExampleHomeState extends State /// Display a row of toggle to select the camera (or a message if no camera is available). Widget _cameraTogglesRowWidget() { - final List toggles = []; + final toggles = []; void onChanged(CameraDescription? description) { if (description == null) { @@ -628,7 +628,7 @@ class _CameraExampleHomeState extends State final CameraController cameraController = controller!; - final Point point = Point( + final point = Point( details.localPosition.dx / constraints.maxWidth, details.localPosition.dy / constraints.maxHeight, ); @@ -647,7 +647,7 @@ class _CameraExampleHomeState extends State Future _initializeCameraController( CameraDescription cameraDescription, ) async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( cameraDescription, mediaSettings: MediaSettings( resolutionPreset: kIsWeb @@ -1005,7 +1005,7 @@ class _CameraExampleHomeState extends State return; } - final VideoPlayerController vController = kIsWeb + final vController = kIsWeb ? VideoPlayerController.networkUrl(Uri.parse(videoFile!.path)) : VideoPlayerController.file(File(videoFile!.path)); diff --git a/packages/camera/camera_android/example/test_driver/integration_test.dart b/packages/camera/camera_android/example/test_driver/integration_test.dart index d512473309e..0fbcfe628bb 100644 --- a/packages/camera/camera_android/example/test_driver/integration_test.dart +++ b/packages/camera/camera_android/example/test_driver/integration_test.dart @@ -17,7 +17,7 @@ Future main() async { print('This test must be run on a POSIX host. Skipping...'); exit(0); } - final bool adbExists = + final adbExists = Process.runSync('which', ['adb']).exitCode == 0; if (!adbExists) { print(r'This test needs ADB to exist on the $PATH. Skipping...'); @@ -61,6 +61,6 @@ Future main() async { 'android.permission.RECORD_AUDIO', ]); - final Map result = jsonDecode(data) as Map; + final result = jsonDecode(data) as Map; exit(result['result'] == 'true' ? 0 : 1); } diff --git a/packages/camera/camera_android/lib/src/android_camera.dart b/packages/camera/camera_android/lib/src/android_camera.dart index 8d6da994cac..9f7d580f236 100644 --- a/packages/camera/camera_android/lib/src/android_camera.dart +++ b/packages/camera/camera_android/lib/src/android_camera.dart @@ -120,7 +120,7 @@ class AndroidCamera extends CameraPlatform { () => HostCameraMessageHandler(cameraId, cameraEventStreamController), ); - final Completer completer = Completer(); + final completer = Completer(); unawaited( onCameraInitialized(cameraId).first.then((CameraInitializedEvent value) { @@ -270,7 +270,7 @@ class AndroidCamera extends CameraPlatform { } void _startStreamListener() { - const EventChannel cameraEventChannel = EventChannel( + const cameraEventChannel = EventChannel( 'plugins.flutter.io/camera_android/imageStream', ); _platformImageStreamSubscription = cameraEventChannel diff --git a/packages/camera/camera_android/test/android_camera_test.dart b/packages/camera/camera_android/test/android_camera_test.dart index 78b2744be34..f8bfc50e745 100644 --- a/packages/camera/camera_android/test/android_camera_test.dart +++ b/packages/camera/camera_android/test/android_camera_test.dart @@ -57,7 +57,7 @@ void main() { test('Should send creation data and receive back a camera id', () async { // Arrange - final AndroidCamera camera = AndroidCamera(hostApi: mockCameraApi); + final camera = AndroidCamera(hostApi: mockCameraApi); when( mockCameraApi.create( 'Test', @@ -89,7 +89,7 @@ void main() { 'Should send creation data and receive back a camera id using createCameraWithSettings', () async { // Arrange - final AndroidCamera camera = AndroidCamera(hostApi: mockCameraApi); + final camera = AndroidCamera(hostApi: mockCameraApi); when( mockCameraApi.create( 'Test', @@ -130,7 +130,7 @@ void main() { 'Should throw CameraException when create throws a PlatformException', () { // Arrange - final AndroidCamera camera = AndroidCamera(hostApi: mockCameraApi); + final camera = AndroidCamera(hostApi: mockCameraApi); when( mockCameraApi.create( 'Test', @@ -181,7 +181,7 @@ void main() { 'Should throw CameraException when initialize throws a PlatformException', () { // Arrange - final AndroidCamera camera = AndroidCamera(hostApi: mockCameraApi); + final camera = AndroidCamera(hostApi: mockCameraApi); when( mockCameraApi.initialize(PlatformImageFormatGroup.yuv420), ).thenThrow( @@ -213,7 +213,7 @@ void main() { test('Should send initialization data', () async { // Arrange - final AndroidCamera camera = AndroidCamera(hostApi: mockCameraApi); + final camera = AndroidCamera(hostApi: mockCameraApi); when( mockCameraApi.create( 'Test', @@ -260,7 +260,7 @@ void main() { test('Should send a disposal call on dispose', () async { // Arrange - final AndroidCamera camera = AndroidCamera(hostApi: mockCameraApi); + final camera = AndroidCamera(hostApi: mockCameraApi); when( mockCameraApi.create( 'Test', @@ -338,12 +338,12 @@ void main() { // Act final Stream eventStream = camera .onCameraInitialized(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); // Emit test events - final PlatformSize previewSize = PlatformSize(width: 3840, height: 2160); - final CameraInitializedEvent event = CameraInitializedEvent( + final previewSize = PlatformSize(width: 3840, height: 2160); + final event = CameraInitializedEvent( cameraId, previewSize.width, previewSize.height, @@ -374,12 +374,12 @@ void main() { final Stream eventStream = camera.onCameraClosing( cameraId, ); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); // Emit test events - final CameraClosingEvent event = CameraClosingEvent(cameraId); - for (int i = 0; i < 3; i++) { + final event = CameraClosingEvent(cameraId); + for (var i = 0; i < 3; i++) { camera.hostCameraHandlers[cameraId]!.closed(); } @@ -397,15 +397,15 @@ void main() { final Stream errorStream = camera.onCameraError( cameraId, ); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(errorStream); // Emit test events - final CameraErrorEvent event = CameraErrorEvent( + final event = CameraErrorEvent( cameraId, 'Error Description', ); - for (int i = 0; i < 3; i++) { + for (var i = 0; i < 3; i++) { camera.hostCameraHandlers[cameraId]!.error('Error Description'); } @@ -422,14 +422,14 @@ void main() { // Act final Stream eventStream = camera .onDeviceOrientationChanged(); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); // Emit test events - const DeviceOrientationChangedEvent event = DeviceOrientationChangedEvent( + const event = DeviceOrientationChangedEvent( DeviceOrientation.portraitUp, ); - for (int i = 0; i < 3; i++) { + for (var i = 0; i < 3; i++) { camera.hostHandler.deviceOrientationChanged( PlatformDeviceOrientation.portraitUp, ); @@ -480,7 +480,7 @@ void main() { 'Should fetch CameraDescription instances for available cameras', () async { // Arrange - final List returnData = + final returnData = [ PlatformCameraDescription( name: 'Test 1', @@ -502,10 +502,10 @@ void main() { // Assert expect(cameras.length, returnData.length); - for (int i = 0; i < returnData.length; i++) { + for (var i = 0; i < returnData.length; i++) { final PlatformCameraDescription platformCameraDescription = returnData[i]; - final CameraDescription cameraDescription = CameraDescription( + final cameraDescription = CameraDescription( name: platformCameraDescription.name, lensDirection: cameraLensDirectionFromPlatform( platformCameraDescription.lensDirection, @@ -620,7 +620,7 @@ void main() { test('Should set the description while recording', () async { // Arrange - const CameraDescription camera2Description = CameraDescription( + const camera2Description = CameraDescription( name: 'Test2', lensDirection: CameraLensDirection.front, sensorOrientation: 0, diff --git a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart index 93de4ea42f9..8e49dc5d133 100644 --- a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart +++ b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart @@ -25,7 +25,7 @@ void main() { CameraPlatform.instance = AndroidCameraCameraX(); }); - final Map presetExpectedSizes = + final presetExpectedSizes = { ResolutionPreset.low: const Size(240, 320), ResolutionPreset.medium: const Size(480, 720), @@ -52,7 +52,7 @@ void main() { .instance .availableCameras(); - for (final CameraDescription cameraDescription in availableCameras) { + for (final cameraDescription in availableCameras) { expect( cameraDescription.lensDirection, isNot(CameraLensDirection.external), @@ -69,11 +69,11 @@ void main() { if (cameras.isEmpty) { return; } - for (final CameraDescription cameraDescription in cameras) { - bool previousPresetExactlySupported = true; + for (final cameraDescription in cameras) { + var previousPresetExactlySupported = true; for (final MapEntry preset in presetExpectedSizes.entries) { - final CameraController controller = CameraController( + final controller = CameraController( cameraDescription, mediaSettings: MediaSettings(resolutionPreset: preset.key), ); @@ -110,15 +110,15 @@ void main() { if (cameras.isEmpty) { return; } - for (final CameraDescription cameraDescription in cameras) { - bool previousPresetExactlySupported = true; + for (final cameraDescription in cameras) { + var previousPresetExactlySupported = true; for (final MapEntry preset in presetExpectedSizes.entries) { - final CameraController controller = CameraController( + final controller = CameraController( cameraDescription, mediaSettings: MediaSettings(resolutionPreset: preset.key), ); - final Completer imageCompleter = Completer(); + final imageCompleter = Completer(); await controller.initialize(); await controller.startImageStream((CameraImage image) { imageCompleter.complete(image); @@ -151,7 +151,7 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], mediaSettings: const MediaSettings( resolutionPreset: ResolutionPreset.low, @@ -169,8 +169,8 @@ void main() { final int postStopTime = DateTime.now().millisecondsSinceEpoch - recordingStart; - final File videoFile = File(file.path); - final VideoPlayerController videoController = VideoPlayerController.file( + final videoFile = File(file.path); + final videoController = VideoPlayerController.file( videoFile, ); await videoController.initialize(); @@ -186,7 +186,7 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], mediaSettings: const MediaSettings( resolutionPreset: ResolutionPreset.low, @@ -196,14 +196,14 @@ void main() { await controller.prepareForVideoRecording(); int startPause; - int timePaused = 0; - const int pauseIterations = 2; + var timePaused = 0; + const pauseIterations = 2; await controller.startVideoRecording(); final int recordingStart = DateTime.now().millisecondsSinceEpoch; sleep(const Duration(milliseconds: 500)); - for (int i = 0; i < pauseIterations; i++) { + for (var i = 0; i < pauseIterations; i++) { await controller.pauseVideoRecording(); startPause = DateTime.now().millisecondsSinceEpoch; sleep(const Duration(milliseconds: 500)); @@ -217,8 +217,8 @@ void main() { final int recordingTime = DateTime.now().millisecondsSinceEpoch - recordingStart; - final File videoFile = File(file.path); - final VideoPlayerController videoController = VideoPlayerController.file( + final videoFile = File(file.path); + final videoController = VideoPlayerController.file( videoFile, ); await videoController.initialize(); @@ -236,7 +236,7 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], mediaSettings: const MediaSettings( resolutionPreset: ResolutionPreset.medium, @@ -258,8 +258,8 @@ void main() { final XFile file = await controller.stopVideoRecording(); - final File videoFile = File(file.path); - final VideoPlayerController videoController = VideoPlayerController.file( + final videoFile = File(file.path); + final videoController = VideoPlayerController.file( videoFile, ); await videoController.initialize(); diff --git a/packages/camera/camera_android_camerax/example/lib/camera_controller.dart b/packages/camera/camera_android_camerax/example/lib/camera_controller.dart index 2974dbe64ee..82bbbd0dc6c 100644 --- a/packages/camera/camera_android_camerax/example/lib/camera_controller.dart +++ b/packages/camera/camera_android_camerax/example/lib/camera_controller.dart @@ -291,7 +291,7 @@ class CameraController extends ValueNotifier { ); } try { - final Completer initializeCompleter = + final initializeCompleter = Completer(); _deviceOrientationSubscription = CameraPlatform.instance diff --git a/packages/camera/camera_android_camerax/example/lib/camera_preview.dart b/packages/camera/camera_android_camerax/example/lib/camera_preview.dart index 54d5b43a240..656bb8c4772 100644 --- a/packages/camera/camera_android_camerax/example/lib/camera_preview.dart +++ b/packages/camera/camera_android_camerax/example/lib/camera_preview.dart @@ -59,7 +59,7 @@ class CameraPreview extends StatelessWidget { } int _getQuarterTurns() { - final Map turns = { + final turns = { DeviceOrientation.portraitUp: 0, DeviceOrientation.landscapeRight: 1, DeviceOrientation.portraitDown: 2, diff --git a/packages/camera/camera_android_camerax/example/lib/main.dart b/packages/camera/camera_android_camerax/example/lib/main.dart index bbb860f7cea..956a86b2016 100644 --- a/packages/camera/camera_android_camerax/example/lib/main.dart +++ b/packages/camera/camera_android_camerax/example/lib/main.dart @@ -568,7 +568,7 @@ class _CameraExampleHomeState extends State /// Display a row of toggle to select the camera (or a message if no camera is available). Widget _cameraTogglesRowWidget() { - final List toggles = []; + final toggles = []; void onChanged(CameraDescription? description) { if (description == null) { @@ -619,7 +619,7 @@ class _CameraExampleHomeState extends State final CameraController cameraController = controller!; - final Offset offset = Offset( + final offset = Offset( details.localPosition.dx / constraints.maxWidth, details.localPosition.dy / constraints.maxHeight, ); @@ -638,7 +638,7 @@ class _CameraExampleHomeState extends State Future _initializeCameraController( CameraDescription cameraDescription, ) async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( cameraDescription, mediaSettings: MediaSettings( resolutionPreset: ResolutionPreset.low, @@ -995,7 +995,7 @@ class _CameraExampleHomeState extends State return; } - final VideoPlayerController vController = kIsWeb + final vController = kIsWeb ? VideoPlayerController.networkUrl(Uri.parse(videoFile!.path)) : VideoPlayerController.file(File(videoFile!.path)); diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index f88abd5eb7e..25219cef385 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -299,18 +299,18 @@ class AndroidCameraCameraX extends CameraPlatform { Future> availableCameras() async { proxy.setUpGenericsProxy(); - final List cameraDescriptions = []; + final cameraDescriptions = []; processCameraProvider ??= await proxy.getInstanceProcessCameraProvider(); final List cameraInfos = (await processCameraProvider!.getAvailableCameraInfos()).cast(); CameraLensDirection? cameraLensDirection; - int cameraCount = 0; + var cameraCount = 0; int? cameraSensorOrientation; String? cameraName; - for (final CameraInfo cameraInfo in cameraInfos) { + for (final cameraInfo in cameraInfos) { // Determine the lens direction by filtering the CameraInfo // TODO(gmackall): replace this with call to CameraInfo.getLensFacing when changes containing that method are available if ((await proxy @@ -507,8 +507,8 @@ class AndroidCameraCameraX extends CameraPlatform { // support these by default. const ExposureMode exposureMode = ExposureMode.auto; const FocusMode focusMode = FocusMode.auto; - const bool exposurePointSupported = true; - const bool focusPointSupported = true; + const exposurePointSupported = true; + const focusPointSupported = true; cameraEventStreamController.add( CameraInitializedEvent( @@ -842,7 +842,7 @@ class AndroidCameraCameraX extends CameraPlatform { final Camera2CameraControl camera2Control = proxy.fromCamera2CameraControl( cameraControl: cameraControl, ); - final bool lockExposureMode = mode == ExposureMode.locked; + final lockExposureMode = mode == ExposureMode.locked; final CaptureRequestOptions captureRequestOptions = proxy .newCaptureRequestOptions( @@ -955,7 +955,7 @@ class AndroidCameraCameraX extends CameraPlatform { ); // Unbind all use cases and rebind to new CameraSelector - final List useCases = [videoCapture!]; + final useCases = [videoCapture!]; if (!_previewIsPaused) { useCases.add(preview!); } @@ -1138,14 +1138,14 @@ class AndroidCameraCameraX extends CameraPlatform { final Camera2CameraInfo camera2CameraInfo = proxy.fromCamera2CameraInfo( cameraInfo: cameraInfo!, ); - final InfoSupportedHardwareLevel cameraInfoSupportedHardwareLevel = + final cameraInfoSupportedHardwareLevel = (await camera2CameraInfo.getCameraCharacteristic( proxy.infoSupportedHardwareLevelCameraCharacteristics(), ))! as InfoSupportedHardwareLevel; // Handle limited level device restrictions: - final bool cameraSupportsConcurrentImageCapture = + final cameraSupportsConcurrentImageCapture = cameraInfoSupportedHardwareLevel != InfoSupportedHardwareLevel.legacy; if (!cameraSupportsConcurrentImageCapture) { // Concurrent preview + video recording + image capture is not supported @@ -1155,7 +1155,7 @@ class AndroidCameraCameraX extends CameraPlatform { } // Handle level 3 device restrictions: - final bool cameraSupportsHardwareLevel3 = + final cameraSupportsHardwareLevel3 = cameraInfoSupportedHardwareLevel == InfoSupportedHardwareLevel.level3; if (!cameraSupportsHardwareLevel3 || streamCallback == null) { // Concurrent preview + video recording + image streaming is not supported @@ -1245,7 +1245,7 @@ class AndroidCameraCameraX extends CameraPlatform { } await _unbindUseCaseFromLifecycle(videoCapture!); - final XFile videoFile = XFile(videoOutputPath!); + final videoFile = XFile(videoOutputPath!); cameraEventStreamController.add( VideoRecordedEvent(cameraId, videoFile, /* duration */ null), ); @@ -1337,11 +1337,11 @@ class AndroidCameraCameraX extends CameraPlatform { } // Create and set Analyzer that can read image data for image streaming. - final WeakReference weakThis = + final weakThis = WeakReference(this); Future analyze(ImageProxy imageProxy) async { final List planes = await imageProxy.getPlanes(); - final List cameraImagePlanes = []; + final cameraImagePlanes = []; // Determine image planes. if (_imageAnalysisOutputImageFormat == @@ -1365,7 +1365,7 @@ class AndroidCameraCameraX extends CameraPlatform { ), ); } else { - for (final PlaneProxy plane in planes) { + for (final plane in planes) { cameraImagePlanes.add( CameraImagePlane( bytes: plane.buffer, @@ -1396,7 +1396,7 @@ class AndroidCameraCameraX extends CameraPlatform { } // Send out CameraImageData. - final CameraImageData cameraImageData = CameraImageData( + final cameraImageData = CameraImageData( format: cameraImageFormat, planes: cameraImagePlanes, height: imageProxy.height, @@ -1487,7 +1487,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// * Send a [CameraErrorEvent] if the [CameraState] indicates that the /// camera is in error state. Observer _createCameraClosingObserver(int cameraId) { - final WeakReference weakThis = + final weakThis = WeakReference(this); // Callback method used to implement the behavior described above: @@ -1780,7 +1780,7 @@ class AndroidCameraCameraX extends CameraPlatform { // Add new metering point with specified meteringMode, which may involve // replacing a metering point with the same specified meteringMode from // the current focus and metering action. - List<(MeteringPoint, MeteringMode)> newMeteringPointInfos = + var newMeteringPointInfos = <(MeteringPoint, MeteringMode)>[]; if (currentFocusMeteringAction != null) { diff --git a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart index 3df67d25f35..c4f8e190742 100644 --- a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart +++ b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart @@ -72,7 +72,7 @@ void main() { int cameraId, Observer observer, ) async { - final CameraStateStateError testCameraStateError = + final testCameraStateError = CameraStateStateError.pigeon_detached( code: CameraStateErrorCode.doNotDisturbModeEnabled, pigeon_instanceManager: PigeonInstanceManager( @@ -81,11 +81,11 @@ void main() { ); final Stream cameraClosingEventStream = camera .onCameraClosing(cameraId); - final StreamQueue cameraClosingStreamQueue = + final cameraClosingStreamQueue = StreamQueue(cameraClosingEventStream); final Stream cameraErrorEventStream = camera .onCameraError(cameraId); - final StreamQueue cameraErrorStreamQueue = + final cameraErrorStreamQueue = StreamQueue(cameraErrorEventStream); observer.onChanged( @@ -99,9 +99,9 @@ void main() { ), ); - final bool cameraClosingEventSent = + final cameraClosingEventSent = await cameraClosingStreamQueue.next == CameraClosingEvent(cameraId); - final bool cameraErrorSent = + final cameraErrorSent = await cameraErrorStreamQueue.next == CameraErrorEvent( cameraId, @@ -226,8 +226,8 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockPreview mockPreview = MockPreview(); - final ResolutionInfo testResolutionInfo = + final mockPreview = MockPreview(); + final testResolutionInfo = ResolutionInfo.pigeon_detached(resolution: MockCameraSize()); when( mockPreview.surfaceProducerHandlesCropAndRotation(), @@ -248,7 +248,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockImageCapture mockImageCapture = MockImageCapture(); + final mockImageCapture = MockImageCapture(); when( mockImageCapture.resolutionSelector, ).thenReturn(resolutionSelector); @@ -264,7 +264,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockRecorder mockRecorder = MockRecorder(); + final mockRecorder = MockRecorder(); when( mockRecorder.getQualitySelector(), ).thenAnswer((_) async => qualitySelector ?? MockQualitySelector()); @@ -291,7 +291,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); + final mockImageAnalysis = MockImageAnalysis(); when( mockImageAnalysis.resolutionSelector, ).thenReturn(resolutionSelector); @@ -306,7 +306,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockResolutionStrategy resolutionStrategy = + final resolutionStrategy = MockResolutionStrategy(); when( resolutionStrategy.getBoundSize(), @@ -326,7 +326,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockResolutionSelector mockResolutionSelector = + final mockResolutionSelector = MockResolutionSelector(); when(mockResolutionSelector.getAspectRatioStrategy()).thenAnswer( (_) async => @@ -387,7 +387,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager manager = + final manager = MockDeviceOrientationManager(); when(manager.getUiOrientation()).thenAnswer((_) async { return 'PORTRAIT_UP'; @@ -403,7 +403,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockAspectRatioStrategy mockAspectRatioStrategy = + final mockAspectRatioStrategy = MockAspectRatioStrategy(); when( mockAspectRatioStrategy.getFallbackRule(), @@ -432,7 +432,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockCamera2CameraInfo camera2cameraInfo = + final camera2cameraInfo = MockCamera2CameraInfo(); when( camera2cameraInfo.getCameraCharacteristic(any), @@ -550,7 +550,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDisplayOrientedMeteringPointFactory mockFactory = + final mockFactory = MockDisplayOrientedMeteringPointFactory(); when(mockFactory.createPoint(any, any)).thenAnswer( (Invocation invocation) async => TestMeteringPoint.detached( @@ -577,17 +577,17 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final PigeonInstanceManager testInstanceManager = + final testInstanceManager = PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); - final MockFocusMeteringActionBuilder mockBuilder = + final mockBuilder = MockFocusMeteringActionBuilder(); - bool disableAutoCancelCalled = false; + var disableAutoCancelCalled = false; when(mockBuilder.disableAutoCancel()).thenAnswer((_) async { disableAutoCancelCalled = true; }); - final List meteringPointsAe = []; - final List meteringPointsAf = []; - final List meteringPointsAwb = []; + final meteringPointsAe = []; + final meteringPointsAf = []; + final meteringPointsAwb = []; switch (mode) { case MeteringMode.ae: @@ -660,7 +660,7 @@ void main() { }) { final CameraXProxy proxy = getProxyForExposureAndFocus(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); if (withModeFocusMeteringActionBuilder != null) { @@ -691,7 +691,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockCaptureRequestOptions mockCaptureRequestOptions = + final mockCaptureRequestOptions = MockCaptureRequestOptions(); options.forEach((CaptureRequestKey key, Object? value) { when( @@ -700,7 +700,7 @@ void main() { }); return mockCaptureRequestOptions; }; - final CaptureRequestKey controlAeLock = CaptureRequestKey.pigeon_detached( + final controlAeLock = CaptureRequestKey.pigeon_detached( pigeon_instanceManager: testInstanceManager, ); proxy.controlAELockCaptureRequest = () => controlAeLock; @@ -712,8 +712,8 @@ void main() { 'Should fetch CameraDescription instances for available cameras', () async { // Arrange - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final List returnData = [ + final camera = AndroidCameraCameraX(); + final returnData = [ { 'name': 'Camera 0', 'lensFacing': 'back', @@ -727,12 +727,12 @@ void main() { ]; // Create mocks to use - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCameraSelector mockFrontCameraSelector = MockCameraSelector(); - final MockCameraSelector mockBackCameraSelector = MockCameraSelector(); - final MockCameraInfo mockFrontCameraInfo = MockCameraInfo(); - final MockCameraInfo mockBackCameraInfo = MockCameraInfo(); + final mockFrontCameraSelector = MockCameraSelector(); + final mockBackCameraSelector = MockCameraSelector(); + final mockFrontCameraInfo = MockCameraInfo(); + final mockBackCameraInfo = MockCameraInfo(); // Tell plugin to create mock CameraSelectors for testing. camera.proxy = CameraXProxy( @@ -805,10 +805,10 @@ void main() { .availableCameras(); expect(cameraDescriptions.length, returnData.length); - for (int i = 0; i < returnData.length; i++) { + for (var i = 0; i < returnData.length; i++) { final Map typedData = (returnData[i] as Map).cast(); - final CameraDescription cameraDescription = CameraDescription( + final cameraDescription = CameraDescription( name: typedData['name']! as String, lensDirection: (typedData['lensFacing']! as String) == 'front' ? CameraLensDirection.front @@ -823,37 +823,37 @@ void main() { test( 'createCamera requests permissions, starts listening for device orientation changes, updates camera state observers, and returns flutter surface texture ID', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); const CameraLensDirection testLensDirection = CameraLensDirection.back; - const int testSensorOrientation = 90; - const CameraDescription testCameraDescription = CameraDescription( + const testSensorOrientation = 90; + const testCameraDescription = CameraDescription( name: 'cameraName', lensDirection: testLensDirection, sensorOrientation: testSensorOrientation, ); - const int testSurfaceTextureId = 6; + const testSurfaceTextureId = 6; // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockPreview mockPreview = MockPreview(); - final MockCameraSelector mockBackCameraSelector = MockCameraSelector(); - final MockImageCapture mockImageCapture = MockImageCapture(); - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); - final MockRecorder mockRecorder = MockRecorder(); - final MockVideoCapture mockVideoCapture = MockVideoCapture(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockLiveCameraState mockLiveCameraState = MockLiveCameraState(); - final MockSystemServicesManager mockSystemServicesManager = + final mockPreview = MockPreview(); + final mockBackCameraSelector = MockCameraSelector(); + final mockImageCapture = MockImageCapture(); + final mockImageAnalysis = MockImageAnalysis(); + final mockRecorder = MockRecorder(); + final mockVideoCapture = MockVideoCapture(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockLiveCameraState = MockLiveCameraState(); + final mockSystemServicesManager = MockSystemServicesManager(); - final MockCameraCharacteristicsKey mockCameraCharacteristicsKey = + final mockCameraCharacteristicsKey = MockCameraCharacteristicsKey(); - bool cameraPermissionsRequested = false; - bool startedListeningForDeviceOrientationChanges = false; + var cameraPermissionsRequested = false; + var startedListeningForDeviceOrientationChanges = false; camera.proxy = CameraXProxy( getInstanceProcessCameraProvider: @@ -1017,7 +1017,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager manager = + final manager = MockDeviceOrientationManager(); when( manager.startListeningForDeviceOrientationChange(), @@ -1058,7 +1058,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockCamera2CameraInfo camera2cameraInfo = + final camera2cameraInfo = MockCamera2CameraInfo(); when( camera2cameraInfo.getCameraCharacteristic( @@ -1148,22 +1148,22 @@ void main() { test( 'createCamera and initializeCamera properly set preset resolution selection strategy for non-video capture use cases', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); const CameraLensDirection testLensDirection = CameraLensDirection.back; - const int testSensorOrientation = 90; - const CameraDescription testCameraDescription = CameraDescription( + const testSensorOrientation = 90; + const testCameraDescription = CameraDescription( name: 'cameraName', lensDirection: testLensDirection, sensorOrientation: testSensorOrientation, ); - const bool enableAudio = true; - final MockCamera mockCamera = MockCamera(); + const enableAudio = true; + final mockCamera = MockCamera(); // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final mockCameraInfo = MockCameraInfo(); when( mockProcessCameraProvider.bindToLifecycle(any, any), @@ -1190,7 +1190,7 @@ void main() { await camera.initializeCamera(flutterSurfaceTextureId); late final CameraSize? expectedBoundSize; - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); switch (resolutionPreset) { @@ -1304,22 +1304,22 @@ void main() { test( 'createCamera and initializeCamera properly set filter for resolution preset for non-video capture use cases', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); const CameraLensDirection testLensDirection = CameraLensDirection.front; - const int testSensorOrientation = 180; - const CameraDescription testCameraDescription = CameraDescription( + const testSensorOrientation = 180; + const testCameraDescription = CameraDescription( name: 'cameraName', lensDirection: testLensDirection, sensorOrientation: testSensorOrientation, ); - const bool enableAudio = true; - final MockCamera mockCamera = MockCamera(); + const enableAudio = true; + final mockCamera = MockCamera(); // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final mockCameraInfo = MockCameraInfo(); // Tell plugin to create mock/detached objects for testing createCamera // as needed. @@ -1358,7 +1358,7 @@ void main() { await camera.initializeCamera(flutterSurfaceTextureId); CameraSize? expectedPreferredResolution; - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); switch (resolutionPreset) { @@ -1463,23 +1463,23 @@ void main() { test( 'createCamera and initializeCamera properly set aspect ratio based on preset resolution for non-video capture use cases', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); const CameraLensDirection testLensDirection = CameraLensDirection.back; - const int testSensorOrientation = 90; - const CameraDescription testCameraDescription = CameraDescription( + const testSensorOrientation = 90; + const testCameraDescription = CameraDescription( name: 'cameraName', lensDirection: testLensDirection, sensorOrientation: testSensorOrientation, ); - const bool enableAudio = true; - const int testCameraId = 12; - final MockCamera mockCamera = MockCamera(); + const enableAudio = true; + const testCameraId = 12; + final mockCamera = MockCamera(); // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final mockCameraInfo = MockCameraInfo(); // Tell plugin to create mock/detached objects for testing createCamera // as needed. @@ -1600,33 +1600,33 @@ void main() { test( 'createCamera and initializeCamera binds Preview, ImageCapture, and ImageAnalysis use cases to ProcessCameraProvider instance', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); const CameraLensDirection testLensDirection = CameraLensDirection.back; - const int testSensorOrientation = 90; - const CameraDescription testCameraDescription = CameraDescription( + const testSensorOrientation = 90; + const testCameraDescription = CameraDescription( name: 'cameraName', lensDirection: testLensDirection, sensorOrientation: testSensorOrientation, ); const ResolutionPreset testResolutionPreset = ResolutionPreset.veryHigh; - const bool enableAudio = true; + const enableAudio = true; // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockPreview mockPreview = MockPreview(); - final MockCameraSelector mockBackCameraSelector = MockCameraSelector(); - final MockImageCapture mockImageCapture = MockImageCapture(); - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); - final MockRecorder mockRecorder = MockRecorder(); - final MockVideoCapture mockVideoCapture = MockVideoCapture(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final mockPreview = MockPreview(); + final mockBackCameraSelector = MockCameraSelector(); + final mockImageCapture = MockImageCapture(); + final mockImageAnalysis = MockImageAnalysis(); + final mockRecorder = MockRecorder(); + final mockVideoCapture = MockVideoCapture(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCameraControl = MockCameraControl(); + final mockCamera2CameraInfo = MockCamera2CameraInfo(); - final MockCameraCharacteristicsKey mockCameraCharacteristicsKey = + final mockCameraCharacteristicsKey = MockCameraCharacteristicsKey(); // Tell plugin to create mock/detached objects and stub method calls for the @@ -1670,7 +1670,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final ResolutionInfo testResolutionInfo = + final testResolutionInfo = ResolutionInfo.pigeon_detached(resolution: MockCameraSize()); when( mockPreview.getResolutionInfo(), @@ -1792,7 +1792,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager manager = + final manager = MockDeviceOrientationManager(); when(manager.getUiOrientation()).thenAnswer((_) async { return 'PORTRAIT_UP'; @@ -1910,30 +1910,30 @@ void main() { test( 'createCamera properly sets preset resolution for video capture use case', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); const CameraLensDirection testLensDirection = CameraLensDirection.back; - const int testSensorOrientation = 90; - const CameraDescription testCameraDescription = CameraDescription( + const testSensorOrientation = 90; + const testCameraDescription = CameraDescription( name: 'cameraName', lensDirection: testLensDirection, sensorOrientation: testSensorOrientation, ); - const bool enableAudio = true; - final MockCamera mockCamera = MockCamera(); + const enableAudio = true; + final mockCamera = MockCamera(); // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final mockCameraInfo = MockCameraInfo(); // Tell plugin to create mock/detached objects for testing createCamera // as needed. VideoQuality? fallbackStrategyVideoQuality; VideoQuality? qualitySelectorVideoQuality; FallbackStrategy? setFallbackStrategy; - final MockFallbackStrategy mockFallbackStrategy = MockFallbackStrategy(); - final MockQualitySelector mockQualitySelector = MockQualitySelector(); + final mockFallbackStrategy = MockFallbackStrategy(); + final mockQualitySelector = MockQualitySelector(); camera.proxy = getProxyForTestingUseCaseConfiguration( mockProcessCameraProvider, lowerQualityOrHigherThanFallbackStrategy: @@ -2018,24 +2018,24 @@ void main() { test( 'createCamera sets sensorOrientationDegrees and enableRecordingAudio as expected', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); const CameraLensDirection testLensDirection = CameraLensDirection.back; - const int testSensorOrientation = 90; - const CameraDescription testCameraDescription = CameraDescription( + const testSensorOrientation = 90; + const testCameraDescription = CameraDescription( name: 'cameraName', lensDirection: testLensDirection, sensorOrientation: testSensorOrientation, ); - const bool enableAudio = true; + const enableAudio = true; const ResolutionPreset testResolutionPreset = ResolutionPreset.veryHigh; - const bool testHandlesCropAndRotation = true; + const testHandlesCropAndRotation = true; // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockCamera mockCamera = MockCamera(); - final MockProcessCameraProvider mockProcessCameraProvider = + final mockCamera = MockCamera(); + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final mockCameraInfo = MockCameraInfo(); // The proxy needed for this test is the same as testing resolution // presets except for mocking the retrieval of the sensor and current @@ -2051,7 +2051,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockPreview mockPreview = MockPreview(); + final mockPreview = MockPreview(); when( mockPreview.surfaceProducerHandlesCropAndRotation(), ).thenAnswer((_) async => testHandlesCropAndRotation); @@ -2085,8 +2085,8 @@ void main() { 'createCamera properly selects specific back camera by specifying a CameraInfo', () async { // Arrange - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final List returnData = [ + final camera = AndroidCameraCameraX(); + final returnData = [ { 'name': 'Camera 0', 'lensFacing': 'back', @@ -2104,37 +2104,37 @@ void main() { }, ]; - List mockCameraInfosList = []; - final Map cameraNameToInfos = + var mockCameraInfosList = []; + final cameraNameToInfos = {}; - const int testSensorOrientation = 0; + const testSensorOrientation = 0; // Mocks for objects created by availableCameras. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCameraSelector mockFrontCameraSelector = MockCameraSelector(); - final MockCameraSelector mockBackCameraSelector = MockCameraSelector(); - final MockCameraSelector mockChosenCameraInfoCameraSelector = + final mockFrontCameraSelector = MockCameraSelector(); + final mockBackCameraSelector = MockCameraSelector(); + final mockChosenCameraInfoCameraSelector = MockCameraSelector(); - final MockCameraInfo mockFrontCameraInfo = MockCameraInfo(); - final MockCameraInfo mockBackCameraInfoOne = MockCameraInfo(); - final MockCameraInfo mockBackCameraInfoTwo = MockCameraInfo(); + final mockFrontCameraInfo = MockCameraInfo(); + final mockBackCameraInfoOne = MockCameraInfo(); + final mockBackCameraInfoTwo = MockCameraInfo(); // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockPreview mockPreview = MockPreview(); - final MockImageCapture mockImageCapture = MockImageCapture(); - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); - final MockRecorder mockRecorder = MockRecorder(); - final MockVideoCapture mockVideoCapture = MockVideoCapture(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final mockPreview = MockPreview(); + final mockImageCapture = MockImageCapture(); + final mockImageAnalysis = MockImageAnalysis(); + final mockRecorder = MockRecorder(); + final mockVideoCapture = MockVideoCapture(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCameraControl = MockCameraControl(); + final mockCamera2CameraInfo = MockCamera2CameraInfo(); - final MockCameraCharacteristicsKey mockCameraCharacteristicsKey = + final mockCameraCharacteristicsKey = MockCameraCharacteristicsKey(); // Tell plugin to create mock/detached objects and stub method calls for the @@ -2305,7 +2305,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager manager = + final manager = MockDeviceOrientationManager(); when(manager.getUiOrientation()).thenAnswer((_) async { return 'PORTRAIT_UP'; @@ -2412,13 +2412,13 @@ void main() { .availableCameras(); expect(cameraDescriptions.length, returnData.length); - for (int i = 0; i < returnData.length; i++) { + for (var i = 0; i < returnData.length; i++) { final Map savedData = (returnData[i] as Map).cast(); cameraNameToInfos[savedData['name']! as String] = mockCameraInfosList[i]; - final CameraDescription cameraDescription = CameraDescription( + final cameraDescription = CameraDescription( name: savedData['name']! as String, lensDirection: (savedData['lensFacing']! as String) == 'front' ? CameraLensDirection.front @@ -2470,7 +2470,7 @@ void main() { test( 'initializeCamera throws a CameraException when createCamera has not been called before initializedCamera', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); await expectLater(() async { await camera.initializeCamera(3); }, throwsA(isA())); @@ -2478,26 +2478,26 @@ void main() { ); test('initializeCamera sets camera state observer as expected', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); const CameraLensDirection testLensDirection = CameraLensDirection.back; - const int testSensorOrientation = 90; - const CameraDescription testCameraDescription = CameraDescription( + const testSensorOrientation = 90; + const testCameraDescription = CameraDescription( name: 'cameraName', lensDirection: testLensDirection, sensorOrientation: testSensorOrientation, ); - const bool enableAudio = true; - final MockCamera mockCamera = MockCamera(); - const int testSurfaceTextureId = 244; + const enableAudio = true; + final mockCamera = MockCamera(); + const testSurfaceTextureId = 244; // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockLiveCameraState mockLiveCameraState = MockLiveCameraState(); - final MockPreview mockPreview = MockPreview(); - final ResolutionInfo testResolutionInfo = ResolutionInfo.pigeon_detached( + final mockCameraInfo = MockCameraInfo(); + final mockLiveCameraState = MockLiveCameraState(); + final mockPreview = MockPreview(); + final testResolutionInfo = ResolutionInfo.pigeon_detached( resolution: MockCameraSize(), ); @@ -2553,29 +2553,29 @@ void main() { test( 'initializeCamera sets image format of ImageAnalysis use case as expected', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); const CameraLensDirection testLensDirection = CameraLensDirection.back; - const int testSensorOrientation = 90; - const CameraDescription testCameraDescription = CameraDescription( + const testSensorOrientation = 90; + const testCameraDescription = CameraDescription( name: 'cameraName', lensDirection: testLensDirection, sensorOrientation: testSensorOrientation, ); - const bool enableAudio = true; - final MockCamera mockCamera = MockCamera(); - const int testSurfaceTextureId = 244; + const enableAudio = true; + final mockCamera = MockCamera(); + const testSurfaceTextureId = 244; // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockLiveCameraState mockLiveCameraState = MockLiveCameraState(); - final MockPreview mockPreview = MockPreview(); - final ResolutionInfo testResolutionInfo = ResolutionInfo.pigeon_detached( + final mockCameraInfo = MockCameraInfo(); + final mockLiveCameraState = MockLiveCameraState(); + final mockPreview = MockPreview(); + final testResolutionInfo = ResolutionInfo.pigeon_detached( resolution: MockCameraSize(), ); - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); + final mockImageAnalysis = MockImageAnalysis(); // Configure mocks for camera initialization. when( @@ -2648,23 +2648,23 @@ void main() { ); test('initializeCamera sends expected CameraInitializedEvent', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); - const int cameraId = 10; + const cameraId = 10; const CameraLensDirection testLensDirection = CameraLensDirection.back; - const int testSensorOrientation = 90; - const CameraDescription testCameraDescription = CameraDescription( + const testSensorOrientation = 90; + const testCameraDescription = CameraDescription( name: 'cameraName', lensDirection: testLensDirection, sensorOrientation: testSensorOrientation, ); - const int resolutionWidth = 350; - const int resolutionHeight = 750; + const resolutionWidth = 350; + const resolutionHeight = 750; final Camera mockCamera = MockCamera(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final ResolutionInfo testResolutionInfo = ResolutionInfo.pigeon_detached( + final testResolutionInfo = ResolutionInfo.pigeon_detached( resolution: CameraSize.pigeon_detached( width: resolutionWidth, height: resolutionHeight, @@ -2674,14 +2674,14 @@ void main() { ); // Mocks for (typically attached) objects created by createCamera. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); final CameraInfo mockCameraInfo = MockCameraInfo(); - final MockCameraSelector mockBackCameraSelector = MockCameraSelector(); - final MockCameraSelector mockFrontCameraSelector = MockCameraSelector(); - final MockPreview mockPreview = MockPreview(); - final MockImageCapture mockImageCapture = MockImageCapture(); - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); + final mockBackCameraSelector = MockCameraSelector(); + final mockFrontCameraSelector = MockCameraSelector(); + final mockPreview = MockPreview(); + final mockImageCapture = MockImageCapture(); + final mockImageAnalysis = MockImageAnalysis(); // Tell plugin to create mock/detached objects for testing createCamera // as needed. @@ -2824,7 +2824,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager manager = + final manager = MockDeviceOrientationManager(); when(manager.getUiOrientation()).thenAnswer((_) async { return 'PORTRAIT_UP'; @@ -2856,7 +2856,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockCamera2CameraInfo mockCamera2CameraInfo = + final mockCamera2CameraInfo = MockCamera2CameraInfo(); when( mockCamera2CameraInfo.getCameraCharacteristic(any), @@ -2876,7 +2876,7 @@ void main() { MockCameraCharacteristicsKey(), ); - final CameraInitializedEvent testCameraInitializedEvent = + final testCameraInitializedEvent = CameraInitializedEvent( cameraId, resolutionWidth.toDouble(), @@ -2930,8 +2930,8 @@ void main() { test( 'dispose releases Flutter surface texture, removes camera state observers, and unbinds all use cases', () async { - bool stoppedListeningForDeviceOrientationChange = false; - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + var stoppedListeningForDeviceOrientationChange = false; + final camera = AndroidCameraCameraX(); camera.proxy = CameraXProxy( newDeviceOrientationManager: ({ @@ -2942,7 +2942,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager mockDeviceOrientationManager = + final mockDeviceOrientationManager = MockDeviceOrientationManager(); when( mockDeviceOrientationManager @@ -2970,13 +2970,13 @@ void main() { ); test('onCameraInitialized stream emits CameraInitializedEvents', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 16; + final camera = AndroidCameraCameraX(); + const cameraId = 16; final Stream eventStream = camera .onCameraInitialized(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); - const CameraInitializedEvent testEvent = CameraInitializedEvent( + const testEvent = CameraInitializedEvent( cameraId, 320, 80, @@ -2995,15 +2995,15 @@ void main() { test( 'onCameraClosing stream emits camera closing event when cameraEventStreamController emits a camera closing event', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 99; - const CameraClosingEvent cameraClosingEvent = CameraClosingEvent( + final camera = AndroidCameraCameraX(); + const cameraId = 99; + const cameraClosingEvent = CameraClosingEvent( cameraId, ); final Stream eventStream = camera.onCameraClosing( cameraId, ); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); camera.cameraEventStreamController.add(cameraClosingEvent); @@ -3016,18 +3016,18 @@ void main() { test( 'onCameraError stream emits errors caught by system services or added to stream within plugin', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 27; - const String firstTestErrorDescription = 'Test error description 1!'; - const String secondTestErrorDescription = 'Test error description 2!'; - const CameraErrorEvent secondCameraErrorEvent = CameraErrorEvent( + final camera = AndroidCameraCameraX(); + const cameraId = 27; + const firstTestErrorDescription = 'Test error description 1!'; + const secondTestErrorDescription = 'Test error description 2!'; + const secondCameraErrorEvent = CameraErrorEvent( cameraId, secondTestErrorDescription, ); final Stream eventStream = camera.onCameraError( cameraId, ); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); camera.proxy = CameraXProxy( @@ -3040,7 +3040,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.onCameraError, @@ -3068,12 +3068,12 @@ void main() { test( 'onDeviceOrientationChanged stream emits changes in device orientation detected by system services', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); final Stream eventStream = camera .onDeviceOrientationChanged(); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); - const DeviceOrientationChangedEvent testEvent = + const testEvent = DeviceOrientationChangedEvent(DeviceOrientation.portraitDown); camera.proxy = CameraXProxy( @@ -3086,7 +3086,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager mockDeviceOrientationManager = + final mockDeviceOrientationManager = MockDeviceOrientationManager(); when( mockDeviceOrientationManager.onDeviceOrientationChanged, @@ -3108,7 +3108,7 @@ void main() { test( 'pausePreview unbinds preview from lifecycle when preview is nonnull and has been bound to lifecycle', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); // Set directly for test versus calling createCamera. camera.processCameraProvider = MockProcessCameraProvider(); @@ -3127,7 +3127,7 @@ void main() { test( 'pausePreview does not unbind preview from lifecycle when preview has not been bound to lifecycle', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); // Set directly for test versus calling createCamera. camera.processCameraProvider = MockProcessCameraProvider(); @@ -3144,12 +3144,12 @@ void main() { test( 'resumePreview does not bind preview to lifecycle or update camera state observers if already bound', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockLiveCameraState mockLiveCameraState = MockLiveCameraState(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockLiveCameraState = MockLiveCameraState(); // Set directly for test versus calling createCamera. camera.processCameraProvider = mockProcessCameraProvider; @@ -3187,13 +3187,13 @@ void main() { test( 'resumePreview binds preview to lifecycle and updates camera state observers if not already bound', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockLiveCameraState mockLiveCameraState = MockLiveCameraState(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCameraControl = MockCameraControl(); + final mockLiveCameraState = MockLiveCameraState(); // Set directly for test versus calling createCamera. camera.processCameraProvider = mockProcessCameraProvider; @@ -3260,8 +3260,8 @@ void main() { test( 'buildPreview throws an exception if the preview is not bound to the lifecycle', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 73; + final camera = AndroidCameraCameraX(); + const cameraId = 73; // Tell camera that createCamera has not been called and thus, preview has // not been bound to the lifecycle of the camera. @@ -3279,22 +3279,22 @@ void main() { 'startVideoCapturing binds video capture use case, updates saved camera instance and its properties, and starts the recording with audio enabled as desired', () async { // Set up mocks and constants. - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockPendingRecording mockPendingRecording = + final camera = AndroidCameraCameraX(); + final mockPendingRecording = MockPendingRecording(); - final MockPendingRecording mockPendingRecordingWithAudio = + final mockPendingRecordingWithAudio = MockPendingRecording(); - final MockRecording mockRecording = MockRecording(); - final MockCamera mockCamera = MockCamera(); - final MockCamera newMockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockLiveCameraState mockLiveCameraState = MockLiveCameraState(); - final MockLiveCameraState newMockLiveCameraState = + final mockRecording = MockRecording(); + final mockCamera = MockCamera(); + final newMockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCameraControl = MockCameraControl(); + final mockLiveCameraState = MockLiveCameraState(); + final newMockLiveCameraState = MockLiveCameraState(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final mockCamera2CameraInfo = MockCamera2CameraInfo(); - const bool enableAudio = true; + const enableAudio = true; // Set directly for test versus calling createCamera. camera.processCameraProvider = MockProcessCameraProvider(); @@ -3311,7 +3311,7 @@ void main() { camera.captureOrientationLocked = true; // Tell plugin to create detached Observer when camera info updated. - const String outputPath = '/temp/REC123.mp4'; + const outputPath = '/temp/REC123.mp4'; camera.proxy = CameraXProxy( newObserver: ({ @@ -3345,7 +3345,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -3379,7 +3379,7 @@ void main() { }, ); - const int cameraId = 17; + const cameraId = 17; // Mock method calls. when( @@ -3458,13 +3458,13 @@ void main() { ' on first call, and does nothing on second call', () async { // Set up mocks and constants. - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockPendingRecording mockPendingRecording = + final camera = AndroidCameraCameraX(); + final mockPendingRecording = MockPendingRecording(); - final MockRecording mockRecording = MockRecording(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final mockRecording = MockRecording(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCamera2CameraInfo = MockCamera2CameraInfo(); // Set directly for test versus calling createCamera. @@ -3480,7 +3480,7 @@ void main() { camera.captureOrientationLocked = true; // Tell plugin to create detached Observer when camera info updated. - const String outputPath = '/temp/REC123.mp4'; + const outputPath = '/temp/REC123.mp4'; camera.proxy = CameraXProxy( newObserver: ({ @@ -3514,7 +3514,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -3548,7 +3548,7 @@ void main() { }, ); - const int cameraId = 17; + const cameraId = 17; // Mock method calls. when( @@ -3624,14 +3624,14 @@ void main() { 'startVideoCapturing called with stream options starts image streaming', () async { // Set up mocks and constants. - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + final mockProcessCameraProvider = MockProcessCameraProvider(); final Recorder mockRecorder = MockRecorder(); - final MockPendingRecording mockPendingRecording = + final mockPendingRecording = MockPendingRecording(); - final MockCameraInfo initialCameraInfo = MockCameraInfo(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final initialCameraInfo = MockCameraInfo(); + final mockCamera2CameraInfo = MockCamera2CameraInfo(); // Set directly for test versus calling createCamera. @@ -3650,7 +3650,7 @@ void main() { camera.captureOrientationLocked = true; // Tell plugin to create detached Analyzer for testing. - const String outputPath = '/temp/REC123.mp4'; + const outputPath = '/temp/REC123.mp4'; camera.proxy = CameraXProxy( newObserver: ({ @@ -3684,7 +3684,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -3728,10 +3728,10 @@ void main() { }, ); - const int cameraId = 17; - final Completer imageDataCompleter = + const cameraId = 17; + final imageDataCompleter = Completer(); - final VideoCaptureOptions videoCaptureOptions = VideoCaptureOptions( + final videoCaptureOptions = VideoCaptureOptions( cameraId, streamCallback: (CameraImageData imageData) => imageDataCompleter.complete(imageData), @@ -3786,13 +3786,13 @@ void main() { 'startVideoCapturing sets VideoCapture target rotation to current video orientation if orientation unlocked', () async { // Set up mocks and constants. - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockPendingRecording mockPendingRecording = + final camera = AndroidCameraCameraX(); + final mockPendingRecording = MockPendingRecording(); - final MockRecording mockRecording = MockRecording(); - final MockVideoCapture mockVideoCapture = MockVideoCapture(); - final MockCameraInfo initialCameraInfo = MockCameraInfo(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final mockRecording = MockRecording(); + final mockVideoCapture = MockVideoCapture(); + final initialCameraInfo = MockCameraInfo(); + final mockCamera2CameraInfo = MockCamera2CameraInfo(); const int defaultTargetRotation = Surface.rotation270; @@ -3807,7 +3807,7 @@ void main() { camera.enableRecordingAudio = false; // Tell plugin to mock call to get current video orientation and mock Camera2CameraInfo retrieval. - const String outputPath = '/temp/REC123.mp4'; + const outputPath = '/temp/REC123.mp4'; camera.proxy = CameraXProxy( newObserver: ({ @@ -3843,7 +3843,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -3862,8 +3862,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager - mockDeviceOrientationManager = MockDeviceOrientationManager(); + final mockDeviceOrientationManager = MockDeviceOrientationManager(); when( mockDeviceOrientationManager.getDefaultDisplayRotation(), ).thenAnswer((_) async => defaultTargetRotation); @@ -3893,7 +3892,7 @@ void main() { }, ); - const int cameraId = 87; + const cameraId = 87; // Mock method calls. when( @@ -3986,8 +3985,8 @@ void main() { ); test('pauseVideoRecording pauses the recording', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockRecording recording = MockRecording(); + final camera = AndroidCameraCameraX(); + final recording = MockRecording(); // Set directly for test versus calling startVideoCapturing. camera.recording = recording; @@ -3998,8 +3997,8 @@ void main() { }); test('resumeVideoRecording resumes the recording', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockRecording recording = MockRecording(); + final camera = AndroidCameraCameraX(); + final recording = MockRecording(); // Set directly for test versus calling startVideoCapturing. camera.recording = recording; @@ -4010,12 +4009,12 @@ void main() { }); test('stopVideoRecording stops the recording', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockRecording recording = MockRecording(); - final MockProcessCameraProvider processCameraProvider = + final camera = AndroidCameraCameraX(); + final recording = MockRecording(); + final processCameraProvider = MockProcessCameraProvider(); - final MockVideoCapture videoCapture = MockVideoCapture(); - const String videoOutputPath = '/test/output/path'; + final videoCapture = MockVideoCapture(); + const videoOutputPath = '/test/output/path'; // Set directly for test versus calling createCamera and startVideoCapturing. camera.processCameraProvider = processCameraProvider; @@ -4047,8 +4046,8 @@ void main() { test('stopVideoRecording throws a camera exception if ' 'no recording is in progress', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const String videoOutputPath = '/test/output/path'; + final camera = AndroidCameraCameraX(); + const videoOutputPath = '/test/output/path'; // Set directly for test versus calling startVideoCapturing. camera.recording = null; @@ -4061,9 +4060,9 @@ void main() { test('stopVideoRecording throws a camera exception if ' 'videoOutputPath is null, and sets recording to null', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockRecording mockRecording = MockRecording(); - final MockVideoCapture mockVideoCapture = MockVideoCapture(); + final camera = AndroidCameraCameraX(); + final mockRecording = MockRecording(); + final mockVideoCapture = MockVideoCapture(); // Set directly for test versus calling startVideoCapturing. camera.processCameraProvider = MockProcessCameraProvider(); @@ -4092,12 +4091,12 @@ void main() { test('calling stopVideoRecording twice stops the recording ' 'and then throws a CameraException', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockRecording recording = MockRecording(); - final MockProcessCameraProvider processCameraProvider = + final camera = AndroidCameraCameraX(); + final recording = MockRecording(); + final processCameraProvider = MockProcessCameraProvider(); - final MockVideoCapture videoCapture = MockVideoCapture(); - const String videoOutputPath = '/test/output/path'; + final videoCapture = MockVideoCapture(); + const videoOutputPath = '/test/output/path'; // Set directly for test versus calling createCamera and startVideoCapturing. camera.processCameraProvider = processCameraProvider; @@ -4125,12 +4124,12 @@ void main() { test( 'VideoCapture use case is unbound from lifecycle when video recording stops', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockRecording recording = MockRecording(); - final MockProcessCameraProvider processCameraProvider = + final camera = AndroidCameraCameraX(); + final recording = MockRecording(); + final processCameraProvider = MockProcessCameraProvider(); - final MockVideoCapture videoCapture = MockVideoCapture(); - const String videoOutputPath = '/test/output/path'; + final videoCapture = MockVideoCapture(); + const videoOutputPath = '/test/output/path'; // Set directly for test versus calling createCamera and startVideoCapturing. camera.processCameraProvider = processCameraProvider; @@ -4162,18 +4161,18 @@ void main() { ); test('setDescriptionWhileRecording changes the camera description', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockRecording mockRecording = MockRecording(); - final MockPendingRecording mockPendingRecording = MockPendingRecording(); - final MockRecorder mockRecorder = MockRecorder(); + final camera = AndroidCameraCameraX(); + final mockRecording = MockRecording(); + final mockPendingRecording = MockPendingRecording(); + final mockRecorder = MockRecorder(); - const int testSensorOrientation = 90; - const CameraDescription testBackCameraDescription = CameraDescription( + const testSensorOrientation = 90; + const testBackCameraDescription = CameraDescription( name: 'Camera 0', lensDirection: CameraLensDirection.back, sensorOrientation: testSensorOrientation, ); - const CameraDescription testFrontCameraDescription = CameraDescription( + const testFrontCameraDescription = CameraDescription( name: 'Camera 1', lensDirection: CameraLensDirection.front, sensorOrientation: testSensorOrientation, @@ -4181,26 +4180,26 @@ void main() { // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockPreview mockPreview = MockPreview(); - final MockCamera mockCamera = MockCamera(); - final MockCamera newMockCamera = MockCamera(); - final MockLiveCameraState mockLiveCameraState = MockLiveCameraState(); - final MockLiveCameraState newMockLiveCameraState = MockLiveCameraState(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockImageCapture mockImageCapture = MockImageCapture(); - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); - final MockVideoCapture mockVideoCapture = MockVideoCapture(); - final MockCameraSelector mockBackCameraSelector = MockCameraSelector(); - final MockCameraSelector mockFrontCameraSelector = MockCameraSelector(); - final MockCameraInfo mockFrontCameraInfo = MockCameraInfo(); - final MockCameraInfo mockBackCameraInfo = MockCameraInfo(); - final MockCameraCharacteristicsKey mockCameraCharacteristicsKey = + final mockPreview = MockPreview(); + final mockCamera = MockCamera(); + final newMockCamera = MockCamera(); + final mockLiveCameraState = MockLiveCameraState(); + final newMockLiveCameraState = MockLiveCameraState(); + final mockCameraInfo = MockCameraInfo(); + final mockCameraControl = MockCameraControl(); + final mockImageCapture = MockImageCapture(); + final mockImageAnalysis = MockImageAnalysis(); + final mockVideoCapture = MockVideoCapture(); + final mockBackCameraSelector = MockCameraSelector(); + final mockFrontCameraSelector = MockCameraSelector(); + final mockFrontCameraInfo = MockCameraInfo(); + final mockBackCameraInfo = MockCameraInfo(); + final mockCameraCharacteristicsKey = MockCameraCharacteristicsKey(); - const String outputPath = 'file/output.mp4'; + const outputPath = 'file/output.mp4'; camera.proxy = CameraXProxy( newPreview: @@ -4215,7 +4214,7 @@ void main() { when( mockPreview.setSurfaceProvider(any), ).thenAnswer((_) async => 19); - final ResolutionInfo testResolutionInfo = + final testResolutionInfo = ResolutionInfo.pigeon_detached(resolution: MockCameraSize()); when( mockPreview.surfaceProducerHandlesCropAndRotation(), @@ -4300,7 +4299,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager manager = + final manager = MockDeviceOrientationManager(); when(manager.getUiOrientation()).thenAnswer((_) async { return 'PORTRAIT_UP'; @@ -4315,7 +4314,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockCamera2CameraInfo camera2cameraInfo = + final camera2cameraInfo = MockCamera2CameraInfo(); when( camera2cameraInfo.getCameraCharacteristic(any), @@ -4349,7 +4348,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -4507,18 +4506,18 @@ void main() { }); test('setDescriptionWhileRecording does not resume paused preview', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockRecording mockRecording = MockRecording(); - final MockPendingRecording mockPendingRecording = MockPendingRecording(); - final MockRecorder mockRecorder = MockRecorder(); + final camera = AndroidCameraCameraX(); + final mockRecording = MockRecording(); + final mockPendingRecording = MockPendingRecording(); + final mockRecorder = MockRecorder(); - const int testSensorOrientation = 90; - const CameraDescription testBackCameraDescription = CameraDescription( + const testSensorOrientation = 90; + const testBackCameraDescription = CameraDescription( name: 'Camera 0', lensDirection: CameraLensDirection.back, sensorOrientation: testSensorOrientation, ); - const CameraDescription testFrontCameraDescription = CameraDescription( + const testFrontCameraDescription = CameraDescription( name: 'Camera 1', lensDirection: CameraLensDirection.front, sensorOrientation: testSensorOrientation, @@ -4526,23 +4525,23 @@ void main() { // Mock/Detached objects for (typically attached) objects created by // createCamera. - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockPreview mockPreview = MockPreview(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockImageCapture mockImageCapture = MockImageCapture(); - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); - final MockVideoCapture mockVideoCapture = MockVideoCapture(); - final MockCameraSelector mockBackCameraSelector = MockCameraSelector(); - final MockCameraSelector mockFrontCameraSelector = MockCameraSelector(); - final MockCameraInfo mockFrontCameraInfo = MockCameraInfo(); - final MockCameraInfo mockBackCameraInfo = MockCameraInfo(); - final MockCameraCharacteristicsKey mockCameraCharacteristicsKey = + final mockPreview = MockPreview(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCameraControl = MockCameraControl(); + final mockImageCapture = MockImageCapture(); + final mockImageAnalysis = MockImageAnalysis(); + final mockVideoCapture = MockVideoCapture(); + final mockBackCameraSelector = MockCameraSelector(); + final mockFrontCameraSelector = MockCameraSelector(); + final mockFrontCameraInfo = MockCameraInfo(); + final mockBackCameraInfo = MockCameraInfo(); + final mockCameraCharacteristicsKey = MockCameraCharacteristicsKey(); - const String outputPath = 'file/output.mp4'; + const outputPath = 'file/output.mp4'; camera.proxy = CameraXProxy( newPreview: @@ -4557,7 +4556,7 @@ void main() { when( mockPreview.setSurfaceProvider(any), ).thenAnswer((_) async => 19); - final ResolutionInfo testResolutionInfo = + final testResolutionInfo = ResolutionInfo.pigeon_detached(resolution: MockCameraSize()); when( mockPreview.surfaceProducerHandlesCropAndRotation(), @@ -4642,7 +4641,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager manager = + final manager = MockDeviceOrientationManager(); when(manager.getUiOrientation()).thenAnswer((_) async { return 'PORTRAIT_UP'; @@ -4657,7 +4656,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockCamera2CameraInfo camera2cameraInfo = + final camera2cameraInfo = MockCamera2CameraInfo(); when( camera2cameraInfo.getCameraCharacteristic(any), @@ -4691,7 +4690,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -4808,12 +4807,12 @@ void main() { test( 'takePicture binds ImageCapture to lifecycle and makes call to take a picture', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - const String testPicturePath = 'test/absolute/path/to/picture'; + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + const testPicturePath = 'test/absolute/path/to/picture'; // Set directly for test versus calling createCamera. camera.imageCapture = MockImageCapture(); @@ -4868,12 +4867,12 @@ void main() { test( 'takePicture sets ImageCapture target rotation as expected when orientation locked or unlocked', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockImageCapture mockImageCapture = MockImageCapture(); - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + final mockImageCapture = MockImageCapture(); + final mockProcessCameraProvider = MockProcessCameraProvider(); - const int cameraId = 3; + const cameraId = 3; const int defaultTargetRotation = Surface.rotation180; // Set directly for test versus calling createCamera. @@ -4891,7 +4890,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager mockDeviceOrientationManager = + final mockDeviceOrientationManager = MockDeviceOrientationManager(); when( mockDeviceOrientationManager.getDefaultDisplayRotation(), @@ -4937,10 +4936,10 @@ void main() { test( 'takePicture turns non-torch flash mode off when torch mode enabled', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + final mockProcessCameraProvider = MockProcessCameraProvider(); - const int cameraId = 77; + const cameraId = 77; // Set directly for test versus calling createCamera. camera.imageCapture = MockImageCapture(); @@ -4963,10 +4962,10 @@ void main() { test( 'setFlashMode configures ImageCapture with expected non-torch flash mode', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 22; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + const cameraId = 22; + final mockCameraControl = MockCameraControl(); + final mockProcessCameraProvider = MockProcessCameraProvider(); // Set directly for test versus calling createCamera. @@ -5010,9 +5009,9 @@ void main() { ); test('setFlashMode turns on torch mode as expected', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 44; - final MockCameraControl mockCameraControl = MockCameraControl(); + final camera = AndroidCameraCameraX(); + const cameraId = 44; + final mockCameraControl = MockCameraControl(); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; @@ -5026,9 +5025,9 @@ void main() { test( 'setFlashMode turns off torch mode when non-torch flash modes set', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 33; - final MockCameraControl mockCameraControl = MockCameraControl(); + final camera = AndroidCameraCameraX(); + const cameraId = 33; + final mockCameraControl = MockCameraControl(); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; @@ -5052,12 +5051,12 @@ void main() { ); test('getMinExposureOffset returns expected exposure offset', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final camera = AndroidCameraCameraX(); + final mockCameraInfo = MockCameraInfo(); + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final ExposureState exposureState = ExposureState.pigeon_detached( + final exposureState = ExposureState.pigeon_detached( exposureCompensationRange: CameraIntegerRange.pigeon_detached( lower: 3, upper: 4, @@ -5078,12 +5077,12 @@ void main() { }); test('getMaxExposureOffset returns expected exposure offset', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final camera = AndroidCameraCameraX(); + final mockCameraInfo = MockCameraInfo(); + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final ExposureState exposureState = ExposureState.pigeon_detached( + final exposureState = ExposureState.pigeon_detached( exposureCompensationRange: CameraIntegerRange.pigeon_detached( lower: 3, upper: 4, @@ -5103,12 +5102,12 @@ void main() { }); test('getExposureOffsetStepSize returns expected exposure offset', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final camera = AndroidCameraCameraX(); + final mockCameraInfo = MockCameraInfo(); + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final ExposureState exposureState = ExposureState.pigeon_detached( + final exposureState = ExposureState.pigeon_detached( exposureCompensationRange: CameraIntegerRange.pigeon_detached( lower: 3, upper: 4, @@ -5129,12 +5128,12 @@ void main() { test( 'getExposureOffsetStepSize returns -1 when exposure compensation not supported on device', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final camera = AndroidCameraCameraX(); + final mockCameraInfo = MockCameraInfo(); + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final ExposureState exposureState = ExposureState.pigeon_detached( + final exposureState = ExposureState.pigeon_detached( exposureCompensationRange: CameraIntegerRange.pigeon_detached( lower: 0, upper: 0, @@ -5154,11 +5153,11 @@ void main() { ); test('getMaxZoomLevel returns expected exposure offset', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final camera = AndroidCameraCameraX(); + final mockCameraInfo = MockCameraInfo(); const double maxZoomRatio = 1; final LiveData mockLiveZoomState = MockLiveZoomState(); - final ZoomState zoomState = ZoomState.pigeon_detached( + final zoomState = ZoomState.pigeon_detached( maxZoomRatio: maxZoomRatio, minZoomRatio: 0, pigeon_instanceManager: PigeonInstanceManager( @@ -5178,11 +5177,11 @@ void main() { }); test('getMinZoomLevel returns expected exposure offset', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final camera = AndroidCameraCameraX(); + final mockCameraInfo = MockCameraInfo(); const double minZoomRatio = 0; final LiveData mockLiveZoomState = MockLiveZoomState(); - final ZoomState zoomState = ZoomState.pigeon_detached( + final zoomState = ZoomState.pigeon_detached( maxZoomRatio: 1, minZoomRatio: minZoomRatio, pigeon_instanceManager: PigeonInstanceManager( @@ -5202,10 +5201,10 @@ void main() { }); test('setZoomLevel sets zoom ratio as expected', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 44; - const double zoomRatio = 0.3; - final MockCameraControl mockCameraControl = MockCameraControl(); + final camera = AndroidCameraCameraX(); + const cameraId = 44; + const zoomRatio = 0.3; + final mockCameraControl = MockCameraControl(); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; @@ -5216,19 +5215,19 @@ void main() { }); test('Should report support for image streaming', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); expect(camera.supportsImageStreaming(), true); }); test( 'onStreamedFrameAvailable emits CameraImageData when picked up from CameraImageData stream controller', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - const int cameraId = 22; + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + const cameraId = 22; // Tell plugin to create detached Analyzer for testing. camera.proxy = CameraXProxy( @@ -5273,7 +5272,7 @@ void main() { final CameraImageData mockCameraImageData = MockCameraImageData(); final Stream imageStream = camera .onStreamedFrameAvailable(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(imageStream); camera.cameraImageDataStreamController!.add(mockCameraImageData); @@ -5286,10 +5285,10 @@ void main() { test( 'onStreamedFrameAvailable emits CameraImageData when listened to after cancelation', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + final mockProcessCameraProvider = MockProcessCameraProvider(); - const int cameraId = 22; + const cameraId = 22; // Tell plugin to create detached Analyzer for testing. camera.proxy = CameraXProxy( @@ -5336,7 +5335,7 @@ void main() { .onStreamedFrameAvailable(cameraId); // Listen to image stream again. - final StreamQueue streamQueue = + final streamQueue = StreamQueue(imageStream2); camera.cameraImageDataStreamController!.add(mockCameraImageData); @@ -5348,23 +5347,23 @@ void main() { test( 'onStreamedFrameAvailable returns stream that responds expectedly to being listened to', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 33; + final camera = AndroidCameraCameraX(); + const cameraId = 33; final ProcessCameraProvider mockProcessCameraProvider = MockProcessCameraProvider(); final CameraSelector mockCameraSelector = MockCameraSelector(); - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); + final mockImageAnalysis = MockImageAnalysis(); final Camera mockCamera = MockCamera(); final CameraInfo mockCameraInfo = MockCameraInfo(); - final MockImageProxy mockImageProxy = MockImageProxy(); - final MockPlaneProxy mockPlane = MockPlaneProxy(); - final List mockPlanes = [mockPlane]; - final Uint8List buffer = Uint8List(0); - const int pixelStride = 27; - const int rowStride = 58; - const int imageFormat = 582; - const int imageHeight = 100; - const int imageWidth = 200; + final mockImageProxy = MockImageProxy(); + final mockPlane = MockPlaneProxy(); + final mockPlanes = [mockPlane]; + final buffer = Uint8List(0); + const pixelStride = 27; + const rowStride = 58; + const imageFormat = 582; + const imageHeight = 100; + const imageWidth = 200; // Tell plugin to create detached Analyzer for testing. camera.proxy = CameraXProxy( @@ -5430,7 +5429,7 @@ void main() { when(mockImageProxy.height).thenReturn(imageHeight); when(mockImageProxy.width).thenReturn(imageWidth); - final Completer imageDataCompleter = + final imageDataCompleter = Completer(); final StreamSubscription onStreamedFrameAvailableSubscription = camera @@ -5441,7 +5440,7 @@ void main() { // Test ImageAnalysis use case is bound to ProcessCameraProvider. await untilCalled(mockImageAnalysis.setAnalyzer(any)); - final Analyzer capturedAnalyzer = + final capturedAnalyzer = verify(mockImageAnalysis.setAnalyzer(captureAny)).captured.single as Analyzer; @@ -5464,21 +5463,21 @@ void main() { test( 'onStreamedFrameAvailable emits NV21 CameraImageData with correct format and single plane when initialized with NV21', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 42; - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + const cameraId = 42; + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockImageProxy mockImageProxy = MockImageProxy(); - final MockPlaneProxy mockPlane = MockPlaneProxy(); - final List mockPlanes = [ + final mockImageAnalysis = MockImageAnalysis(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockImageProxy = MockImageProxy(); + final mockPlane = MockPlaneProxy(); + final mockPlanes = [ mockPlane, mockPlane, mockPlane, ]; - final Uint8List testNv21Buffer = Uint8List(10); + final testNv21Buffer = Uint8List(10); // Mock use case bindings and related Camera objects. when( @@ -5548,7 +5547,7 @@ void main() { when(mockImageProxy.getPlanes()).thenAnswer((_) async => mockPlanes); // Set up listener to receive mock ImageProxy. - final Completer imageDataCompleter = + final imageDataCompleter = Completer(); final StreamSubscription subscription = camera .onStreamedFrameAvailable(cameraId) @@ -5557,7 +5556,7 @@ void main() { }); await untilCalled(mockImageAnalysis.setAnalyzer(any)); - final Analyzer capturedAnalyzer = + final capturedAnalyzer = verify(mockImageAnalysis.setAnalyzer(captureAny)).captured.single as Analyzer; capturedAnalyzer.analyze(MockAnalyzer(), mockImageProxy); @@ -5576,10 +5575,10 @@ void main() { test( 'onStreamedFrameAvailable returns stream that responds expectedly to being canceled', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 32; - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + const cameraId = 32; + final mockImageAnalysis = MockImageAnalysis(); + final mockProcessCameraProvider = MockProcessCameraProvider(); // Set directly for test versus calling createCamera. @@ -5618,11 +5617,11 @@ void main() { test( 'onStreamedFrameAvailable sets ImageAnalysis target rotation to current photo orientation when orientation unlocked', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 35; + final camera = AndroidCameraCameraX(); + const cameraId = 35; const int defaultTargetRotation = Surface.rotation90; - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); - final MockProcessCameraProvider mockProcessCameraProvider = + final mockImageAnalysis = MockImageAnalysis(); + final mockProcessCameraProvider = MockProcessCameraProvider(); // Set directly for test versus calling createCamera. @@ -5649,7 +5648,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDeviceOrientationManager manager = + final manager = MockDeviceOrientationManager(); when(manager.getDefaultDisplayRotation()).thenAnswer((_) async { return defaultTargetRotation; @@ -5709,12 +5708,12 @@ void main() { test( 'lockCaptureOrientation sets capture-related use case target rotations to correct orientation', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 44; + final camera = AndroidCameraCameraX(); + const cameraId = 44; - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); - final MockImageCapture mockImageCapture = MockImageCapture(); - final MockVideoCapture mockVideoCapture = MockVideoCapture(); + final mockImageAnalysis = MockImageAnalysis(); + final mockImageCapture = MockImageCapture(); + final mockVideoCapture = MockVideoCapture(); // Set directly for test versus calling createCamera. camera.imageAnalysis = mockImageAnalysis; @@ -5752,8 +5751,8 @@ void main() { test( 'unlockCaptureOrientation sets capture-related use case target rotations to current photo/video orientation', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 57; + final camera = AndroidCameraCameraX(); + const cameraId = 57; camera.captureOrientationLocked = true; await camera.unlockCaptureOrientation(cameraId); @@ -5764,10 +5763,10 @@ void main() { test( 'setExposureMode sets expected controlAeLock value via Camera2 interop', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 78; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockCamera2CameraControl mockCamera2CameraControl = + final camera = AndroidCameraCameraX(); + const cameraId = 78; + final mockCameraControl = MockCameraControl(); + final mockCamera2CameraControl = MockCamera2CameraControl(); // Set directly for test versus calling createCamera. @@ -5776,10 +5775,10 @@ void main() { // Tell plugin to create detached Camera2CameraControl and // CaptureRequestOptions instances for testing. - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final CaptureRequestKey controlAELockKey = + final controlAELockKey = CaptureRequestKey.pigeon_detached( pigeon_instanceManager: testInstanceManager, ); @@ -5804,7 +5803,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockCaptureRequestOptions mockCaptureRequestOptions = + final mockCaptureRequestOptions = MockCaptureRequestOptions(); options.forEach((CaptureRequestKey key, Object? value) { when( @@ -5822,7 +5821,7 @@ void main() { VerificationResult verificationResult = verify( mockCamera2CameraControl.addCaptureRequestOptions(captureAny), ); - CaptureRequestOptions capturedCaptureRequestOptions = + var capturedCaptureRequestOptions = verificationResult.captured.single as CaptureRequestOptions; expect( await capturedCaptureRequestOptions.getCaptureRequestOption( @@ -5852,18 +5851,18 @@ void main() { test( 'setExposurePoint clears current auto-exposure metering point as expected', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 93; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final camera = AndroidCameraCameraX(); + const cameraId = 93; + final mockCameraControl = MockCameraControl(); + final mockCameraInfo = MockCameraInfo(); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; camera.cameraInfo = mockCameraInfo; - final MockFocusMeteringActionBuilder mockActionBuilder = + final mockActionBuilder = MockFocusMeteringActionBuilder(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); when(mockActionBuilder.build()).thenAnswer( @@ -5900,7 +5899,7 @@ void main() { verifyNever(mockCameraControl.cancelFocusAndMetering()); // Verify current auto-exposure metering point is removed if previously set. - final FocusMeteringAction originalMeteringAction = + final originalMeteringAction = FocusMeteringAction.pigeon_detached( meteringPointsAe: [ MeteringPoint.pigeon_detached( @@ -5951,10 +5950,10 @@ void main() { test( 'setExposurePoint throws CameraException if invalid point specified', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 23; - final MockCameraControl mockCameraControl = MockCameraControl(); - const Point invalidExposurePoint = Point(3, -1); + final camera = AndroidCameraCameraX(); + const cameraId = 23; + final mockCameraControl = MockCameraControl(); + const invalidExposurePoint = Point(3, -1); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; @@ -5972,26 +5971,26 @@ void main() { test( 'setExposurePoint adds new exposure point to focus metering action to start as expected when previous metering points have been set', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 9; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final camera = AndroidCameraCameraX(); + const cameraId = 9; + final mockCameraControl = MockCameraControl(); + final mockCameraInfo = MockCameraInfo(); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; camera.cameraInfo = mockCameraInfo; - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - double exposurePointX = 0.8; - double exposurePointY = 0.1; - final MeteringPoint createdMeteringPoint = MeteringPoint.pigeon_detached( + var exposurePointX = 0.8; + var exposurePointY = 0.1; + final createdMeteringPoint = MeteringPoint.pigeon_detached( pigeon_instanceManager: testInstanceManager, ); MeteringMode? actionBuilderMeteringMode; MeteringPoint? actionBuilderMeteringPoint; - final MockFocusMeteringActionBuilder mockActionBuilder = + final mockActionBuilder = MockFocusMeteringActionBuilder(); when(mockActionBuilder.build()).thenAnswer( (_) async => FocusMeteringAction.pigeon_detached( @@ -6013,7 +6012,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDisplayOrientedMeteringPointFactory mockFactory = + final mockFactory = MockDisplayOrientedMeteringPointFactory(); when( mockFactory.createPoint(exposurePointX, exposurePointY), @@ -6036,11 +6035,11 @@ void main() { ); // Verify current auto-exposure metering point is removed if previously set. - Point exposurePoint = Point( + var exposurePoint = Point( exposurePointX, exposurePointY, ); - FocusMeteringAction originalMeteringAction = + var originalMeteringAction = FocusMeteringAction.pigeon_detached( meteringPointsAe: [ MeteringPoint.pigeon_detached( @@ -6109,12 +6108,12 @@ void main() { test( 'setExposurePoint adds new exposure point to focus metering action to start as expected when no previous metering points have been set', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 19; - final MockCameraControl mockCameraControl = MockCameraControl(); - const double exposurePointX = 0.8; - const double exposurePointY = 0.1; - const Point exposurePoint = Point( + final camera = AndroidCameraCameraX(); + const cameraId = 19; + final mockCameraControl = MockCameraControl(); + const exposurePointX = 0.8; + const exposurePointY = 0.1; + const exposurePoint = Point( exposurePointX, exposurePointY, ); @@ -6124,15 +6123,15 @@ void main() { camera.cameraInfo = MockCameraInfo(); camera.currentFocusMeteringAction = null; - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final MeteringPoint createdMeteringPoint = MeteringPoint.pigeon_detached( + final createdMeteringPoint = MeteringPoint.pigeon_detached( pigeon_instanceManager: testInstanceManager, ); MeteringMode? actionBuilderMeteringMode; MeteringPoint? actionBuilderMeteringPoint; - final MockFocusMeteringActionBuilder mockActionBuilder = + final mockActionBuilder = MockFocusMeteringActionBuilder(); when(mockActionBuilder.build()).thenAnswer( (_) async => FocusMeteringAction.pigeon_detached( @@ -6154,7 +6153,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDisplayOrientedMeteringPointFactory mockFactory = + final mockFactory = MockDisplayOrientedMeteringPointFactory(); when( mockFactory.createPoint(exposurePointX, exposurePointY), @@ -6186,12 +6185,12 @@ void main() { test( 'setExposurePoint disables auto-cancel for focus and metering as expected', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 2; - final MockCameraControl mockCameraControl = MockCameraControl(); + final camera = AndroidCameraCameraX(); + const cameraId = 2; + final mockCameraControl = MockCameraControl(); final FocusMeteringResult mockFocusMeteringResult = MockFocusMeteringResult(); - const Point exposurePoint = Point(0.1, 0.2); + const exposurePoint = Point(0.1, 0.2); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; @@ -6215,7 +6214,7 @@ void main() { VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - FocusMeteringAction capturedAction = + var capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isTrue); @@ -6237,14 +6236,14 @@ void main() { test( 'setExposureOffset throws exception if exposure compensation not supported', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 6; + final camera = AndroidCameraCameraX(); + const cameraId = 6; const double offset = 2; - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final mockCameraInfo = MockCameraInfo(); + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final ExposureState exposureState = ExposureState.pigeon_detached( + final exposureState = ExposureState.pigeon_detached( exposureCompensationRange: CameraIntegerRange.pigeon_detached( lower: 3, upper: 4, @@ -6269,15 +6268,15 @@ void main() { test( 'setExposureOffset throws exception if exposure compensation could not be set for unknown reason', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 11; + final camera = AndroidCameraCameraX(); + const cameraId = 11; const double offset = 3; - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final mockCameraInfo = MockCameraInfo(); final CameraControl mockCameraControl = MockCameraControl(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final ExposureState exposureState = ExposureState.pigeon_detached( + final exposureState = ExposureState.pigeon_detached( exposureCompensationRange: CameraIntegerRange.pigeon_detached( lower: 3, upper: 4, @@ -6310,15 +6309,15 @@ void main() { test( 'setExposureOffset throws exception if exposure compensation could not be set due to camera being closed or newer value being set', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 21; + final camera = AndroidCameraCameraX(); + const cameraId = 21; const double offset = 5; - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final mockCameraInfo = MockCameraInfo(); final CameraControl mockCameraControl = MockCameraControl(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final ExposureState exposureState = ExposureState.pigeon_detached( + final exposureState = ExposureState.pigeon_detached( exposureCompensationRange: CameraIntegerRange.pigeon_detached( lower: 3, upper: 4, @@ -6351,15 +6350,15 @@ void main() { test( 'setExposureOffset behaves as expected to successful attempt to set exposure compensation index', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 11; + final camera = AndroidCameraCameraX(); + const cameraId = 11; const double offset = 3; - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final mockCameraInfo = MockCameraInfo(); final CameraControl mockCameraControl = MockCameraControl(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final ExposureState exposureState = ExposureState.pigeon_detached( + final exposureState = ExposureState.pigeon_detached( exposureCompensationRange: CameraIntegerRange.pigeon_detached( lower: 3, upper: 4, @@ -6397,18 +6396,18 @@ void main() { test( 'setFocusPoint clears current auto-exposure metering point as expected', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 93; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final camera = AndroidCameraCameraX(); + const cameraId = 93; + final mockCameraControl = MockCameraControl(); + final mockCameraInfo = MockCameraInfo(); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; camera.cameraInfo = mockCameraInfo; - final MockFocusMeteringActionBuilder mockActionBuilder = + final mockActionBuilder = MockFocusMeteringActionBuilder(); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); when(mockActionBuilder.build()).thenAnswer( @@ -6444,7 +6443,7 @@ void main() { verifyNever(mockCameraControl.startFocusAndMetering(any)); verifyNever(mockCameraControl.cancelFocusAndMetering()); - final FocusMeteringAction originalMeteringAction = + final originalMeteringAction = FocusMeteringAction.pigeon_detached( meteringPointsAe: [ MeteringPoint.pigeon_detached( @@ -6495,10 +6494,10 @@ void main() { test( 'setFocusPoint throws CameraException if invalid point specified', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 23; - final MockCameraControl mockCameraControl = MockCameraControl(); - const Point invalidFocusPoint = Point(-3, 1); + final camera = AndroidCameraCameraX(); + const cameraId = 23; + final mockCameraControl = MockCameraControl(); + const invalidFocusPoint = Point(-3, 1); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; @@ -6516,27 +6515,27 @@ void main() { test( 'setFocusPoint adds new focus point to focus metering action to start as expected when previous metering points have been set', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 9; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final camera = AndroidCameraCameraX(); + const cameraId = 9; + final mockCameraControl = MockCameraControl(); + final mockCameraInfo = MockCameraInfo(); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; camera.cameraInfo = mockCameraInfo; - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - double focusPointX = 0.8; - double focusPointY = 0.1; - Point focusPoint = Point(focusPointX, focusPointY); - final MeteringPoint createdMeteringPoint = MeteringPoint.pigeon_detached( + var focusPointX = 0.8; + var focusPointY = 0.1; + var focusPoint = Point(focusPointX, focusPointY); + final createdMeteringPoint = MeteringPoint.pigeon_detached( pigeon_instanceManager: testInstanceManager, ); MeteringMode? actionBuilderMeteringMode; MeteringPoint? actionBuilderMeteringPoint; - final MockFocusMeteringActionBuilder mockActionBuilder = + final mockActionBuilder = MockFocusMeteringActionBuilder(); when(mockActionBuilder.build()).thenAnswer( (_) async => FocusMeteringAction.pigeon_detached( @@ -6558,7 +6557,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDisplayOrientedMeteringPointFactory mockFactory = + final mockFactory = MockDisplayOrientedMeteringPointFactory(); when( mockFactory.createPoint(focusPointX, focusPointY), @@ -6581,7 +6580,7 @@ void main() { ); // Verify current auto-exposure metering point is removed if previously set. - FocusMeteringAction originalMeteringAction = + var originalMeteringAction = FocusMeteringAction.pigeon_detached( meteringPointsAe: [ MeteringPoint.pigeon_detached( @@ -6650,27 +6649,27 @@ void main() { test( 'setFocusPoint adds new focus point to focus metering action to start as expected when no previous metering points have been set', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 19; - final MockCameraControl mockCameraControl = MockCameraControl(); - const double focusPointX = 0.8; - const double focusPointY = 0.1; - const Point focusPoint = Point(focusPointX, focusPointY); + final camera = AndroidCameraCameraX(); + const cameraId = 19; + final mockCameraControl = MockCameraControl(); + const focusPointX = 0.8; + const focusPointY = 0.1; + const focusPoint = Point(focusPointX, focusPointY); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; camera.cameraInfo = MockCameraInfo(); camera.currentFocusMeteringAction = null; - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final MeteringPoint createdMeteringPoint = MeteringPoint.pigeon_detached( + final createdMeteringPoint = MeteringPoint.pigeon_detached( pigeon_instanceManager: testInstanceManager, ); MeteringMode? actionBuilderMeteringMode; MeteringPoint? actionBuilderMeteringPoint; - final MockFocusMeteringActionBuilder mockActionBuilder = + final mockActionBuilder = MockFocusMeteringActionBuilder(); when(mockActionBuilder.build()).thenAnswer( (_) async => FocusMeteringAction.pigeon_detached( @@ -6692,7 +6691,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDisplayOrientedMeteringPointFactory mockFactory = + final mockFactory = MockDisplayOrientedMeteringPointFactory(); when( mockFactory.createPoint(focusPointX, focusPointY), @@ -6724,12 +6723,12 @@ void main() { test( 'setFocusPoint disables auto-cancel for focus and metering as expected', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 2; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockFocusMeteringResult mockFocusMeteringResult = + final camera = AndroidCameraCameraX(); + const cameraId = 2; + final mockCameraControl = MockCameraControl(); + final mockFocusMeteringResult = MockFocusMeteringResult(); - const Point exposurePoint = Point(0.1, 0.2); + const exposurePoint = Point(0.1, 0.2); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; @@ -6754,7 +6753,7 @@ void main() { VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - FocusMeteringAction capturedAction = + var capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isTrue); @@ -6777,10 +6776,10 @@ void main() { test( 'setFocusMode does nothing if setting auto-focus mode and is already using auto-focus mode', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 4; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockFocusMeteringResult mockFocusMeteringResult = + final camera = AndroidCameraCameraX(); + const cameraId = 4; + final mockCameraControl = MockCameraControl(); + final mockFocusMeteringResult = MockFocusMeteringResult(); // Set directly for test versus calling createCamera. @@ -6810,9 +6809,9 @@ void main() { test( 'setFocusMode does nothing if setting locked focus mode and is already using locked focus mode', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 4; - final MockCameraControl mockCameraControl = MockCameraControl(); + final camera = AndroidCameraCameraX(); + const cameraId = 4; + final mockCameraControl = MockCameraControl(); // Camera uses auto-focus by default, so try setting auto mode again. await camera.setFocusMode(cameraId, FocusMode.auto); @@ -6824,15 +6823,15 @@ void main() { test( 'setFocusMode removes default auto-focus point if previously set and setting auto-focus mode', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 5; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockFocusMeteringResult mockFocusMeteringResult = + final camera = AndroidCameraCameraX(); + const cameraId = 5; + final mockCameraControl = MockCameraControl(); + final mockFocusMeteringResult = MockFocusMeteringResult(); - final MockCamera2CameraControl mockCamera2CameraControl = + final mockCamera2CameraControl = MockCamera2CameraControl(); - const double exposurePointX = 0.2; - const double exposurePointY = 0.7; + const exposurePointX = 0.2; + const exposurePointY = 0.7; // Set directly for test versus calling createCamera. camera.cameraInfo = MockCameraInfo(); @@ -6842,10 +6841,10 @@ void main() { mockCamera2CameraControl.addCaptureRequestOptions(any), ).thenAnswer((_) async => Future.value()); - final PigeonInstanceManager testInstanceManager = PigeonInstanceManager( + final testInstanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final List createdMeteringPoints = []; + final createdMeteringPoints = []; camera.proxy = getProxyForSettingFocusandExposurePoints( mockCameraControl, mockCamera2CameraControl, @@ -6859,12 +6858,12 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockDisplayOrientedMeteringPointFactory mockFactory = + final mockFactory = MockDisplayOrientedMeteringPointFactory(); when( mockFactory.createPoint(exposurePointX, exposurePointY), ).thenAnswer((_) async { - final MeteringPoint createdMeteringPoint = + final createdMeteringPoint = MeteringPoint.pigeon_detached( pigeon_instanceManager: testInstanceManager, ); @@ -6874,7 +6873,7 @@ void main() { when(mockFactory.createPointWithSize(0.5, 0.5, 1)).thenAnswer(( _, ) async { - final MeteringPoint createdMeteringPoint = + final createdMeteringPoint = MeteringPoint.pigeon_detached( pigeon_instanceManager: testInstanceManager, ); @@ -6908,7 +6907,7 @@ void main() { final VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - final FocusMeteringAction capturedAction = + final capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isTrue); @@ -6922,12 +6921,12 @@ void main() { test( 'setFocusMode cancels focus and metering if only focus point previously set is a focus point', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 5; - final MockCameraControl mockCameraControl = MockCameraControl(); + final camera = AndroidCameraCameraX(); + const cameraId = 5; + final mockCameraControl = MockCameraControl(); final FocusMeteringResult mockFocusMeteringResult = MockFocusMeteringResult(); - final MockCamera2CameraControl mockCamera2CameraControl = + final mockCamera2CameraControl = MockCamera2CameraControl(); // Set directly for test versus calling createCamera. @@ -6962,15 +6961,15 @@ void main() { test( 'setFocusMode re-focuses on previously set auto-focus point with auto-canceled enabled if setting auto-focus mode', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 6; - final MockCameraControl mockCameraControl = MockCameraControl(); + final camera = AndroidCameraCameraX(); + const cameraId = 6; + final mockCameraControl = MockCameraControl(); final FocusMeteringResult mockFocusMeteringResult = MockFocusMeteringResult(); - final MockCamera2CameraControl mockCamera2CameraControl = + final mockCamera2CameraControl = MockCamera2CameraControl(); - const double focusPointX = 0.1; - const double focusPointY = 0.2; + const focusPointX = 0.1; + const focusPointY = 0.2; // Set directly for test versus calling createCamera. camera.cameraInfo = MockCameraInfo(); @@ -7006,13 +7005,13 @@ void main() { final VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - final FocusMeteringAction capturedAction = + final capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isTrue); expect(capturedAction.meteringPointsAe.length, equals(0)); expect(capturedAction.meteringPointsAf.length, equals(1)); expect(capturedAction.meteringPointsAwb.length, equals(0)); - final TestMeteringPoint focusPoint = + final focusPoint = capturedAction.meteringPointsAf.single as TestMeteringPoint; expect(focusPoint.x, equals(focusPointX)); expect(focusPoint.y, equals(focusPointY)); @@ -7023,13 +7022,13 @@ void main() { test( 'setFocusMode starts expected focus and metering action with previously set auto-focus point if setting locked focus mode and current focus and metering action has auto-focus point', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 7; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockCamera2CameraControl mockCamera2CameraControl = + final camera = AndroidCameraCameraX(); + const cameraId = 7; + final mockCameraControl = MockCameraControl(); + final mockCamera2CameraControl = MockCamera2CameraControl(); - const double focusPointX = 0.88; - const double focusPointY = 0.33; + const focusPointX = 0.88; + const focusPointY = 0.33; // Set directly for test versus calling createCamera. camera.cameraInfo = MockCameraInfo(); @@ -7057,7 +7056,7 @@ void main() { final VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - final FocusMeteringAction capturedAction = + final capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isFalse); @@ -7066,7 +7065,7 @@ void main() { expect(capturedAction.meteringPointsAf.length, equals(1)); expect(capturedAction.meteringPointsAwb.length, equals(0)); - final TestMeteringPoint focusPoint = + final focusPoint = capturedAction.meteringPointsAf.single as TestMeteringPoint; expect(focusPoint.x, equals(focusPointX)); expect(focusPoint.y, equals(focusPointY)); @@ -7077,15 +7076,15 @@ void main() { test( 'setFocusMode starts expected focus and metering action with previously set auto-focus point if setting locked focus mode and current focus and metering action has auto-focus point amongst others', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 8; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockCamera2CameraControl mockCamera2CameraControl = + final camera = AndroidCameraCameraX(); + const cameraId = 8; + final mockCameraControl = MockCameraControl(); + final mockCamera2CameraControl = MockCamera2CameraControl(); - const double focusPointX = 0.38; - const double focusPointY = 0.38; - const double exposurePointX = 0.54; - const double exposurePointY = 0.45; + const focusPointX = 0.38; + const focusPointY = 0.38; + const exposurePointX = 0.54; + const exposurePointY = 0.45; // Set directly for test versus calling createCamera. camera.cameraInfo = MockCameraInfo(); @@ -7117,7 +7116,7 @@ void main() { final VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - final FocusMeteringAction capturedAction = + final capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isFalse); @@ -7127,13 +7126,13 @@ void main() { expect(capturedAction.meteringPointsAf.length, equals(1)); expect(capturedAction.meteringPointsAwb.length, equals(0)); - final TestMeteringPoint focusPoint = + final focusPoint = capturedAction.meteringPointsAf.single as TestMeteringPoint; expect(focusPoint.x, equals(focusPointX)); expect(focusPoint.y, equals(focusPointY)); expect(focusPoint.size, isNull); - final TestMeteringPoint exposurePoint = + final exposurePoint = capturedAction.meteringPointsAe.single as TestMeteringPoint; expect(exposurePoint.x, equals(exposurePointX)); expect(exposurePoint.y, equals(exposurePointY)); @@ -7144,15 +7143,15 @@ void main() { test( 'setFocusMode starts expected focus and metering action if setting locked focus mode and current focus and metering action does not contain an auto-focus point', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 9; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockCamera2CameraControl mockCamera2CameraControl = + final camera = AndroidCameraCameraX(); + const cameraId = 9; + final mockCameraControl = MockCameraControl(); + final mockCamera2CameraControl = MockCamera2CameraControl(); - const double exposurePointX = 0.8; - const double exposurePointY = 0.3; - const double defaultFocusPointX = 0.5; - const double defaultFocusPointY = 0.5; + const exposurePointX = 0.8; + const exposurePointY = 0.3; + const defaultFocusPointX = 0.5; + const defaultFocusPointY = 0.5; const double defaultFocusPointSize = 1; // Set directly for test versus calling createCamera. @@ -7182,7 +7181,7 @@ void main() { final VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - final FocusMeteringAction capturedAction = + final capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isFalse); @@ -7192,13 +7191,13 @@ void main() { expect(capturedAction.meteringPointsAf.length, equals(1)); expect(capturedAction.meteringPointsAwb.length, equals(0)); - final TestMeteringPoint focusPoint = + final focusPoint = capturedAction.meteringPointsAf.single as TestMeteringPoint; expect(focusPoint.x, equals(defaultFocusPointX)); expect(focusPoint.y, equals(defaultFocusPointY)); expect(focusPoint.size, equals(defaultFocusPointSize)); - final TestMeteringPoint exposurePoint = + final exposurePoint = capturedAction.meteringPointsAe.single as TestMeteringPoint; expect(exposurePoint.x, equals(exposurePointX)); expect(exposurePoint.y, equals(exposurePointY)); @@ -7209,13 +7208,13 @@ void main() { test( 'setFocusMode starts expected focus and metering action if there is no current focus and metering action', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 10; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockCamera2CameraControl mockCamera2CameraControl = + final camera = AndroidCameraCameraX(); + const cameraId = 10; + final mockCameraControl = MockCameraControl(); + final mockCamera2CameraControl = MockCamera2CameraControl(); - const double defaultFocusPointX = 0.5; - const double defaultFocusPointY = 0.5; + const defaultFocusPointX = 0.5; + const defaultFocusPointY = 0.5; const double defaultFocusPointSize = 1; // Set directly for test versus calling createCamera. @@ -7237,7 +7236,7 @@ void main() { final VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - final FocusMeteringAction capturedAction = + final capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isFalse); @@ -7246,7 +7245,7 @@ void main() { expect(capturedAction.meteringPointsAf.length, equals(1)); expect(capturedAction.meteringPointsAwb.length, equals(0)); - final TestMeteringPoint focusPoint = + final focusPoint = capturedAction.meteringPointsAf.single as TestMeteringPoint; expect(focusPoint.x, equals(defaultFocusPointX)); expect(focusPoint.y, equals(defaultFocusPointY)); @@ -7257,12 +7256,12 @@ void main() { test( 'setFocusMode re-sets exposure mode if setting locked focus mode while using auto exposure mode', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 11; - final MockCameraControl mockCameraControl = MockCameraControl(); + final camera = AndroidCameraCameraX(); + const cameraId = 11; + final mockCameraControl = MockCameraControl(); final FocusMeteringResult mockFocusMeteringResult = MockFocusMeteringResult(); - final MockCamera2CameraControl mockCamera2CameraControl = + final mockCamera2CameraControl = MockCamera2CameraControl(); // Set directly for test versus calling createCamera. @@ -7294,7 +7293,7 @@ void main() { final VerificationResult verificationResult = verify( mockCamera2CameraControl.addCaptureRequestOptions(captureAny), ); - final CaptureRequestOptions capturedCaptureRequestOptions = + final capturedCaptureRequestOptions = verificationResult.captured.single as CaptureRequestOptions; expect( await capturedCaptureRequestOptions.getCaptureRequestOption( @@ -7308,12 +7307,12 @@ void main() { test( 'setFocusPoint disables auto-cancel if auto focus mode fails to be set after locked focus mode is set', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 22; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockFocusMeteringResult mockFocusMeteringResult = + final camera = AndroidCameraCameraX(); + const cameraId = 22; + final mockCameraControl = MockCameraControl(); + final mockFocusMeteringResult = MockFocusMeteringResult(); - const Point focusPoint = Point(0.21, 0.21); + const focusPoint = Point(0.21, 0.21); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; @@ -7354,7 +7353,7 @@ void main() { final VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - final FocusMeteringAction capturedAction = + final capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isFalse); }, @@ -7363,12 +7362,12 @@ void main() { test( 'setExposurePoint disables auto-cancel if auto focus mode fails to be set after locked focus mode is set', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 342; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockFocusMeteringResult mockFocusMeteringResult = + final camera = AndroidCameraCameraX(); + const cameraId = 342; + final mockCameraControl = MockCameraControl(); + final mockFocusMeteringResult = MockFocusMeteringResult(); - const Point exposurePoint = Point(0.23, 0.32); + const exposurePoint = Point(0.23, 0.32); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; @@ -7408,7 +7407,7 @@ void main() { final VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - final FocusMeteringAction capturedAction = + final capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isFalse); }, @@ -7417,12 +7416,12 @@ void main() { test( 'setFocusPoint enables auto-cancel if locked focus mode fails to be set after auto focus mode is set', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 232; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockFocusMeteringResult mockFocusMeteringResult = + final camera = AndroidCameraCameraX(); + const cameraId = 232; + final mockCameraControl = MockCameraControl(); + final mockFocusMeteringResult = MockFocusMeteringResult(); - const Point focusPoint = Point(0.221, 0.211); + const focusPoint = Point(0.221, 0.211); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; @@ -7451,7 +7450,7 @@ void main() { final VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - final FocusMeteringAction capturedAction = + final capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isTrue); }, @@ -7460,12 +7459,12 @@ void main() { test( 'setExposurePoint enables auto-cancel if locked focus mode fails to be set after auto focus mode is set', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 323; - final MockCameraControl mockCameraControl = MockCameraControl(); - final MockFocusMeteringResult mockFocusMeteringResult = + final camera = AndroidCameraCameraX(); + const cameraId = 323; + final mockCameraControl = MockCameraControl(); + final mockFocusMeteringResult = MockFocusMeteringResult(); - const Point exposurePoint = Point(0.223, 0.332); + const exposurePoint = Point(0.223, 0.332); // Set directly for test versus calling createCamera. camera.cameraControl = mockCameraControl; @@ -7494,7 +7493,7 @@ void main() { final VerificationResult verificationResult = verify( mockCameraControl.startFocusAndMetering(captureAny), ); - final FocusMeteringAction capturedAction = + final capturedAction = verificationResult.captured.single as FocusMeteringAction; expect(capturedAction.isAutoCancelEnabled, isTrue); }, @@ -7503,13 +7502,13 @@ void main() { test( 'onStreamedFrameAvailable binds ImageAnalysis use case when not already bound', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 22; - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); - final MockProcessCameraProvider mockProcessCameraProvider = + final camera = AndroidCameraCameraX(); + const cameraId = 22; + final mockImageAnalysis = MockImageAnalysis(); + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); // Set directly for test versus calling createCamera. camera.imageAnalysis = mockImageAnalysis; @@ -7579,12 +7578,12 @@ void main() { 'startVideoCapturing unbinds ImageAnalysis use case when camera device is not at least level 3, no image streaming callback is specified, and preview is not paused', () async { // Set up mocks and constants. - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockPendingRecording mockPendingRecording = MockPendingRecording(); - final MockRecording mockRecording = MockRecording(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final camera = AndroidCameraCameraX(); + final mockPendingRecording = MockPendingRecording(); + final mockRecording = MockRecording(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCamera2CameraInfo = MockCamera2CameraInfo(); // Set directly for test versus calling createCamera. @@ -7600,7 +7599,7 @@ void main() { camera.captureOrientationLocked = true; // Tell plugin to create detached Observer when camera info updated. - const String outputPath = '/temp/REC123.mp4'; + const outputPath = '/temp/REC123.mp4'; camera.proxy = CameraXProxy( newObserver: ({ @@ -7634,7 +7633,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -7665,7 +7664,7 @@ void main() { }, ); - const int cameraId = 7; + const cameraId = 7; // Mock method calls. when( @@ -7723,12 +7722,12 @@ void main() { 'startVideoCapturing unbinds ImageAnalysis use case when image streaming callback not specified, camera device is level 3, and preview is not paused', () async { // Set up mocks and constants. - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockPendingRecording mockPendingRecording = MockPendingRecording(); - final MockRecording mockRecording = MockRecording(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final camera = AndroidCameraCameraX(); + final mockPendingRecording = MockPendingRecording(); + final mockRecording = MockRecording(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCamera2CameraInfo = MockCamera2CameraInfo(); // Set directly for test versus calling createCamera. @@ -7744,7 +7743,7 @@ void main() { camera.captureOrientationLocked = true; // Tell plugin to create detached Observer when camera info updated. - const String outputPath = '/temp/REC123.mp4'; + const outputPath = '/temp/REC123.mp4'; camera.proxy = CameraXProxy( newObserver: ({ @@ -7778,7 +7777,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -7809,7 +7808,7 @@ void main() { }, ); - const int cameraId = 77; + const cameraId = 77; // Mock method calls. when( @@ -7867,12 +7866,12 @@ void main() { 'startVideoCapturing unbinds ImageAnalysis use case when image streaming callback is specified, camera device is not at least level 3, and preview is not paused', () async { // Set up mocks and constants. - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockPendingRecording mockPendingRecording = MockPendingRecording(); - final MockRecording mockRecording = MockRecording(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final camera = AndroidCameraCameraX(); + final mockPendingRecording = MockPendingRecording(); + final mockRecording = MockRecording(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCamera2CameraInfo = MockCamera2CameraInfo(); // Set directly for test versus calling createCamera. @@ -7888,7 +7887,7 @@ void main() { camera.captureOrientationLocked = true; // Tell plugin to create detached Observer when camera info updated. - const String outputPath = '/temp/REC123.mp4'; + const outputPath = '/temp/REC123.mp4'; camera.proxy = CameraXProxy( newObserver: ({ @@ -7922,7 +7921,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -7953,7 +7952,7 @@ void main() { }, ); - const int cameraId = 87; + const cameraId = 87; // Mock method calls. when( @@ -8015,12 +8014,12 @@ void main() { 'startVideoCapturing unbinds ImageCapture use case when image streaming callback is specified, camera device is at least level 3, and preview is not paused', () async { // Set up mocks and constants. - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockPendingRecording mockPendingRecording = MockPendingRecording(); - final MockRecording mockRecording = MockRecording(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final camera = AndroidCameraCameraX(); + final mockPendingRecording = MockPendingRecording(); + final mockRecording = MockRecording(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCamera2CameraInfo = MockCamera2CameraInfo(); // Set directly for test versus calling createCamera. @@ -8037,7 +8036,7 @@ void main() { camera.captureOrientationLocked = true; // Tell plugin to create detached Observer when camera info updated. - const String outputPath = '/temp/REC123.mp4'; + const outputPath = '/temp/REC123.mp4'; camera.proxy = CameraXProxy( newAnalyzer: ({ @@ -8086,7 +8085,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -8117,7 +8116,7 @@ void main() { }, ); - const int cameraId = 107; + const cameraId = 107; // Mock method calls. when( @@ -8182,12 +8181,12 @@ void main() { 'startVideoCapturing does not unbind ImageCapture or ImageAnalysis use cases when preview is paused', () async { // Set up mocks and constants. - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockPendingRecording mockPendingRecording = MockPendingRecording(); - final MockRecording mockRecording = MockRecording(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final camera = AndroidCameraCameraX(); + final mockPendingRecording = MockPendingRecording(); + final mockRecording = MockRecording(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCamera2CameraInfo = MockCamera2CameraInfo(); // Set directly for test versus calling createCamera. @@ -8205,7 +8204,7 @@ void main() { camera.captureOrientationLocked = true; // Tell plugin to create detached Observer when camera info updated. - const String outputPath = '/temp/REC123.mp4'; + const outputPath = '/temp/REC123.mp4'; camera.proxy = CameraXProxy( newAnalyzer: ({ @@ -8254,7 +8253,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -8285,7 +8284,7 @@ void main() { }, ); - const int cameraId = 97; + const cameraId = 97; // Mock method calls. when( @@ -8342,12 +8341,12 @@ void main() { 'startVideoCapturing unbinds ImageCapture and ImageAnalysis use cases when running on a legacy hardware device', () async { // Set up mocks and constants. - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - final MockPendingRecording mockPendingRecording = MockPendingRecording(); - final MockRecording mockRecording = MockRecording(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCamera2CameraInfo mockCamera2CameraInfo = + final camera = AndroidCameraCameraX(); + final mockPendingRecording = MockPendingRecording(); + final mockRecording = MockRecording(); + final mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCamera2CameraInfo = MockCamera2CameraInfo(); // Set directly for test versus calling createCamera. @@ -8365,7 +8364,7 @@ void main() { camera.captureOrientationLocked = true; // Tell plugin to create detached Observer when camera info updated. - const String outputPath = '/temp/REC123.mp4'; + const outputPath = '/temp/REC123.mp4'; camera.proxy = CameraXProxy( newAnalyzer: ({ @@ -8414,7 +8413,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockSystemServicesManager mockSystemServicesManager = + final mockSystemServicesManager = MockSystemServicesManager(); when( mockSystemServicesManager.getTempFilePath( @@ -8445,7 +8444,7 @@ void main() { }, ); - const int cameraId = 44; + const cameraId = 44; // Mock method calls. when( @@ -8508,7 +8507,7 @@ void main() { test( 'prepareForVideoRecording does not make any calls involving starting video recording', () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final camera = AndroidCameraCameraX(); // Set directly for test versus calling createCamera. camera.processCameraProvider = MockProcessCameraProvider(); diff --git a/packages/camera/camera_android_camerax/test/preview_rotation_test.dart b/packages/camera/camera_android_camerax/test/preview_rotation_test.dart index 28177122de5..0783e23e835 100644 --- a/packages/camera/camera_android_camerax/test/preview_rotation_test.dart +++ b/packages/camera/camera_android_camerax/test/preview_rotation_test.dart @@ -51,10 +51,10 @@ void main() { required MockCameraSelector mockCameraSelector, required int sensorRotationDegrees, }) { - final MockProcessCameraProvider mockProcessCameraProvider = + final mockProcessCameraProvider = MockProcessCameraProvider(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCamera mockCamera = MockCamera(); + final mockCameraInfo = MockCameraInfo(); + final mockCamera = MockCamera(); // Mock retrieving available test camera. when( @@ -116,7 +116,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockPreview preview = MockPreview(); + final preview = MockPreview(); when( preview.surfaceProducerHandlesCropAndRotation(), ).thenAnswer((_) async => handlesCropAndRotation); @@ -219,7 +219,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockCamera2CameraInfo camera2cameraInfo = + final camera2cameraInfo = MockCamera2CameraInfo(); when( camera2cameraInfo.getCameraCharacteristic(any), @@ -280,7 +280,7 @@ void main() { // ignore: non_constant_identifier_names PigeonInstanceManager? pigeon_instanceManager, }) { - final MockAspectRatioStrategy mockAspectRatioStrategy = + final mockAspectRatioStrategy = MockAspectRatioStrategy(); when( mockAspectRatioStrategy.getFallbackRule(), @@ -323,7 +323,7 @@ void main() { required Future Function() getUiOrientation, required Future Function() getDefaultDisplayRotation, }) { - final MockDeviceOrientationManager deviceOrientationManager = + final deviceOrientationManager = MockDeviceOrientationManager(); when( deviceOrientationManager.getUiOrientation(), @@ -413,7 +413,7 @@ void main() { /// [ 0.0, 0.0, 1.0, 0.0], /// [ 0.0, 0.0, 0.0, 1.0]] void checkXAxisIsMirrored(Matrix4 transformationMatrix) { - final Matrix4 mirrorAcrossXMatrix = Matrix4( + final mirrorAcrossXMatrix = Matrix4( -1.0, 0.0, 0.0, @@ -445,7 +445,7 @@ void main() { /// [ 0.0, 0.0, 1.0, 0.0], /// [ 0.0, 0.0, 0.0, 1.0]] void checkYAxisIsMirrored(Matrix4 transformationMatrix) { - final Matrix4 mirrorAcrossYMatrix = Matrix4( + final mirrorAcrossYMatrix = Matrix4( 1.0, 0.0, 0.0, @@ -473,7 +473,7 @@ void main() { group('when handlesCropAndRotation is true', () { // Test that preview rotation responds to initial default display rotation: group('initial device orientation is landscapeRight,', () { - final MockCameraSelector mockCameraSelector = MockCameraSelector(); + final mockCameraSelector = MockCameraSelector(); late AndroidCameraCameraX camera; late int cameraId; late DeviceOrientation testInitialDeviceOrientation; @@ -728,7 +728,7 @@ void main() { // Test that preview rotation responds to initial device orientation: group('initial default display rotation is 90,', () { - final MockCameraSelector mockCameraSelector = MockCameraSelector(); + final mockCameraSelector = MockCameraSelector(); late AndroidCameraCameraX camera; late int cameraId; late int testInitialDefaultDisplayRotation; @@ -983,14 +983,14 @@ void main() { testWidgets( 'device orientation is portraitDown, then the preview Texture rotates correctly as the default display rotation changes', (WidgetTester tester) async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 11; + final camera = AndroidCameraCameraX(); + const cameraId = 11; const DeviceOrientation testDeviceOrientation = DeviceOrientation.portraitDown; // Create and set up mock CameraSelector, mock ProcessCameraProvider, and media settings for test front camera. // These settings do not matter for this test. - final MockCameraSelector mockFrontCameraSelector = MockCameraSelector(); + final mockFrontCameraSelector = MockCameraSelector(); final MockCameraSelector Function({ // ignore: non_constant_identifier_names BinaryMessenger? pigeon_binaryMessenger, @@ -1007,11 +1007,11 @@ void main() { mockCameraSelector: mockFrontCameraSelector, sensorRotationDegrees: 270, ); - const MediaSettings testMediaSettings = MediaSettings(); + const testMediaSettings = MediaSettings(); // Tell camera that handlesCropAndRotation is true, set camera initial device orientation // to portrait down, set initial default display rotation to 0 degrees clockwise. - final MockDeviceOrientationManager mockDeviceOrientationManager = + final mockDeviceOrientationManager = MockDeviceOrientationManager(); when(mockDeviceOrientationManager.getUiOrientation()).thenAnswer( (_) => Future.value( @@ -1044,7 +1044,7 @@ void main() { // Calculated according to: counterClockwiseCurrentDefaultDisplayRotation - cameraPreviewPreAppliedRotation, // where the cameraPreviewPreAppliedRotation is the clockwise rotation applied by the CameraPreview widget // according to the current device orientation (fixed to portraitDown for this test, so it is 180). - final Map expectedRotationPerDefaultDisplayRotation = + final expectedRotationPerDefaultDisplayRotation = { Surface.rotation0: _180DegreesClockwise, Surface.rotation90: _90DegreesClockwise, @@ -1062,7 +1062,7 @@ void main() { mockDeviceOrientationManager.getDefaultDisplayRotation(), ).thenAnswer((_) => Future.value(currentDefaultDisplayRotation)); - const DeviceOrientationChangedEvent testEvent = + const testEvent = DeviceOrientationChangedEvent(testDeviceOrientation); AndroidCameraCameraX.deviceOrientationChangedStreamController.add( testEvent, @@ -1095,13 +1095,13 @@ void main() { testWidgets( 'initial default display rotation is 270 degrees clockwise, then the preview Texture rotates correctly as the device orientation changes', (WidgetTester tester) async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 11; + final camera = AndroidCameraCameraX(); + const cameraId = 11; const int testInitialDefaultDisplayRotation = Surface.rotation270; // Create and set up mock CameraSelector, mock ProcessCameraProvider, and media settings for test front camera. // These settings do not matter for this test. - final MockCameraSelector mockFrontCameraSelector = MockCameraSelector(); + final mockFrontCameraSelector = MockCameraSelector(); final MockCameraSelector Function({ // ignore: non_constant_identifier_names BinaryMessenger? pigeon_binaryMessenger, @@ -1118,7 +1118,7 @@ void main() { mockCameraSelector: mockFrontCameraSelector, sensorRotationDegrees: 270, ); - const MediaSettings testMediaSettings = MediaSettings(); + const testMediaSettings = MediaSettings(); // Tell camera that handlesCropAndRotation is true, set camera initial device orientation // to portrait up, set initial default display rotation to 270 degrees clockwise. @@ -1148,7 +1148,7 @@ void main() { // where the cameraPreviewPreAppliedRotation is the clockwise rotation applied by the CameraPreview widget // according to the current device orientation. counterClockwiseCurrentDefaultDisplayRotation is fixed to 90 for // this test (the counter-clockwise rotation of the clockwise 270 degree default display rotation). - final Map expectedRotationPerDeviceOrientation = + final expectedRotationPerDeviceOrientation = { DeviceOrientation.portraitUp: _90DegreesClockwise, DeviceOrientation.landscapeRight: _0DegreesClockwise, @@ -1161,7 +1161,7 @@ void main() { for (final DeviceOrientation currentDeviceOrientation in expectedRotationPerDeviceOrientation.keys) { - final DeviceOrientationChangedEvent testEvent = + final testEvent = DeviceOrientationChangedEvent(currentDeviceOrientation); AndroidCameraCameraX.deviceOrientationChangedStreamController.add( testEvent, @@ -1276,7 +1276,7 @@ void main() { // used. expect(rotatedBox.child, isA()); - final Transform transformedPreview = rotatedBox.child! as Transform; + final transformedPreview = rotatedBox.child! as Transform; final Matrix4 transformedPreviewMatrix = transformedPreview.transform; @@ -1337,7 +1337,7 @@ void main() { // used. expect(rotatedBox.child, isA()); - final Transform transformedPreview = rotatedBox.child! as Transform; + final transformedPreview = rotatedBox.child! as Transform; final Matrix4 transformedPreviewMatrix = transformedPreview.transform; @@ -1398,7 +1398,7 @@ void main() { // used. expect(rotatedBox.child, isA()); - final Transform transformedPreview = rotatedBox.child! as Transform; + final transformedPreview = rotatedBox.child! as Transform; final Matrix4 transformedPreviewMatrix = transformedPreview.transform; @@ -1459,7 +1459,7 @@ void main() { // used. expect(rotatedBox.child, isA()); - final Transform transformedPreview = rotatedBox.child! as Transform; + final transformedPreview = rotatedBox.child! as Transform; final Matrix4 transformedPreviewMatrix = transformedPreview.transform; @@ -1564,7 +1564,7 @@ void main() { // used. expect(rotatedBox.child, isA()); - final Transform transformedPreview = rotatedBox.child! as Transform; + final transformedPreview = rotatedBox.child! as Transform; final Matrix4 transformedPreviewMatrix = transformedPreview.transform; @@ -1627,7 +1627,7 @@ void main() { // used. expect(rotatedBox.child, isA()); - final Transform transformedPreview = rotatedBox.child! as Transform; + final transformedPreview = rotatedBox.child! as Transform; final Matrix4 transformedPreviewMatrix = transformedPreview.transform; @@ -1690,7 +1690,7 @@ void main() { // used. expect(rotatedBox.child, isA()); - final Transform transformedPreview = rotatedBox.child! as Transform; + final transformedPreview = rotatedBox.child! as Transform; final Matrix4 transformedPreviewMatrix = transformedPreview.transform; @@ -1755,7 +1755,7 @@ void main() { // used. expect(rotatedBox.child, isA()); - final Transform transformedPreview = rotatedBox.child! as Transform; + final transformedPreview = rotatedBox.child! as Transform; final Matrix4 transformedPreviewMatrix = transformedPreview.transform; @@ -1782,14 +1782,14 @@ void main() { testWidgets( 'device orientation is landscapeRight, sensor orientation degrees is 270, camera is front facing, then the preview Texture rotates correctly as the default display rotation changes', (WidgetTester tester) async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 11; + final camera = AndroidCameraCameraX(); + const cameraId = 11; const DeviceOrientation testDeviceOrientation = DeviceOrientation.landscapeRight; // Create and set up mock front camera CameraSelector, mock ProcessCameraProvider, 270 degree sensor orientation, // media settings for test front camera. - final MockCameraSelector mockFrontCameraSelector = MockCameraSelector(); + final mockFrontCameraSelector = MockCameraSelector(); final MockCameraSelector Function({ // ignore: non_constant_identifier_names BinaryMessenger? pigeon_binaryMessenger, @@ -1806,11 +1806,11 @@ void main() { mockCameraSelector: mockFrontCameraSelector, sensorRotationDegrees: 270, ); - const MediaSettings testMediaSettings = MediaSettings(); + const testMediaSettings = MediaSettings(); // Tell camera that handlesCropAndRotation is true, set camera initial device orientation // to portrait down, set initial default display rotation to 0 degrees clockwise. - final MockDeviceOrientationManager mockDeviceOrientationManager = + final mockDeviceOrientationManager = MockDeviceOrientationManager(); when(mockDeviceOrientationManager.getUiOrientation()).thenAnswer( (_) => Future.value( @@ -1842,7 +1842,7 @@ void main() { // Calculated according to: ((270 - counterClockwiseDefaultDisplayRotation * 1 + 360) % 360) - 90. // 90 is used in this calculation for the CameraPreview pre-applied rotation because it is the // rotation that the CameraPreview widget aapplies based on the landscape right device orientation. - final Map expectedRotationPerDefaultDisplayRotation = + final expectedRotationPerDefaultDisplayRotation = { Surface.rotation0: _180DegreesClockwise, Surface.rotation90: _270DegreesClockwise, @@ -1860,7 +1860,7 @@ void main() { mockDeviceOrientationManager.getDefaultDisplayRotation(), ).thenAnswer((_) async => currentDefaultDisplayRotation); - const DeviceOrientationChangedEvent testEvent = + const testEvent = DeviceOrientationChangedEvent(testDeviceOrientation); AndroidCameraCameraX.deviceOrientationChangedStreamController.add( testEvent, @@ -1880,7 +1880,7 @@ void main() { // used. expect(rotatedBox.child, isA()); - final Transform transformedPreview = rotatedBox.child! as Transform; + final transformedPreview = rotatedBox.child! as Transform; final Matrix4 transformedPreviewMatrix = transformedPreview.transform; // Since the front camera is in landscape mode, we expect the camera @@ -1905,12 +1905,12 @@ void main() { testWidgets( 'default display rotation is 90, sensor orientation degrees is 90, camera is front facing, then the preview Texture rotates correctly as the device orientation rotates', (WidgetTester tester) async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const int cameraId = 3372; + final camera = AndroidCameraCameraX(); + const cameraId = 3372; // Create and set up mock CameraSelector and mock ProcessCameraProvider for test front camera // with sensor orientation degrees 90. - final MockCameraSelector mockFrontCameraSelector = MockCameraSelector(); + final mockFrontCameraSelector = MockCameraSelector(); final MockCameraSelector Function({ LensFacing? requireLensFacing, CameraInfo? cameraInfoForFilter, @@ -1929,7 +1929,7 @@ void main() { ); // Media settings to create camera; irrelevant for test. - const MediaSettings testMediaSettings = MediaSettings(); + const testMediaSettings = MediaSettings(); // Set up test to use front camera and tell camera that handlesCropAndRotation is false, // set camera initial device orientation to landscape left, set initial default display @@ -1959,7 +1959,7 @@ void main() { // Calculated according to: ((90 - 270 * 1 + 360) % 360) - cameraPreviewPreAppliedRotation. // 270 is used in this calculation for the device orientation because it is the // counter-clockwise degrees of the default display rotation. - final Map expectedRotationPerDeviceOrientation = + final expectedRotationPerDeviceOrientation = { DeviceOrientation.portraitUp: _180DegreesClockwise, DeviceOrientation.landscapeRight: _90DegreesClockwise, @@ -1972,7 +1972,7 @@ void main() { for (final DeviceOrientation currentDeviceOrientation in expectedRotationPerDeviceOrientation.keys) { - final DeviceOrientationChangedEvent testEvent = + final testEvent = DeviceOrientationChangedEvent(currentDeviceOrientation); AndroidCameraCameraX.deviceOrientationChangedStreamController.add( testEvent, @@ -1992,7 +1992,7 @@ void main() { // used. expect(rotatedBox.child, isA()); - final Transform transformedPreview = rotatedBox.child! as Transform; + final transformedPreview = rotatedBox.child! as Transform; final Matrix4 transformedPreviewMatrix = transformedPreview.transform; // When the front camera is in landscape mode, we expect the camera @@ -2211,7 +2211,7 @@ void main() { 'camera is front facing, then the preview Texture is rotated 90 degrees clockwise', (WidgetTester tester) async { // Set up test front camera with sensor orientation degrees 90. - final MockCameraSelector mockFrontCameraSelector = + final mockFrontCameraSelector = MockCameraSelector(); final MockProcessCameraProvider mockProcessCameraProvider = setUpMockCameraSelectorAndMockProcessCameraProviderForSelectingTestCamera( @@ -2267,7 +2267,7 @@ void main() { // used. expect(rotatedBox.child, isA()); - final Transform transformedPreview = rotatedBox.child! as Transform; + final transformedPreview = rotatedBox.child! as Transform; final Matrix4 transformedPreviewMatrix = transformedPreview.transform; @@ -2290,7 +2290,7 @@ void main() { 'camera is back facing, then the preview Texture is rotated 270 degrees clockwise', (WidgetTester tester) async { // Set up test front camera with sensor orientation degrees 90. - final MockCameraSelector mockBackCameraSelector = + final mockBackCameraSelector = MockCameraSelector(); final MockProcessCameraProvider mockProcessCameraProvider = setUpMockCameraSelectorAndMockProcessCameraProviderForSelectingTestCamera( diff --git a/packages/camera/camera_avfoundation/example/integration_test/camera_test.dart b/packages/camera/camera_avfoundation/example/integration_test/camera_test.dart index 40d47fe293e..16539a6ed75 100644 --- a/packages/camera/camera_avfoundation/example/integration_test/camera_test.dart +++ b/packages/camera/camera_avfoundation/example/integration_test/camera_test.dart @@ -30,7 +30,7 @@ void main() { await testDir.delete(recursive: true); }); - final Map presetExpectedSizes = + final presetExpectedSizes = { ResolutionPreset.low: const Size(288, 352), ResolutionPreset.medium: const Size(480, 640), @@ -63,7 +63,7 @@ void main() { final XFile file = await controller.takePicture(); // Load picture - final File fileImage = File(file.path); + final fileImage = File(file.path); final Image image = await decodeImageFromList(fileImage.readAsBytesSync()); // Verify image dimensions are as expected @@ -82,11 +82,11 @@ void main() { if (cameras.isEmpty) { return; } - for (final CameraDescription cameraDescription in cameras) { - bool previousPresetExactlySupported = true; + for (final cameraDescription in cameras) { + var previousPresetExactlySupported = true; for (final MapEntry preset in presetExpectedSizes.entries) { - final CameraController controller = CameraController( + final controller = CameraController( cameraDescription, preset.key, ); @@ -120,8 +120,8 @@ void main() { final XFile file = await controller.stopVideoRecording(); // Load video metadata - final File videoFile = File(file.path); - final VideoPlayerController videoController = VideoPlayerController.file( + final videoFile = File(file.path); + final videoController = VideoPlayerController.file( videoFile, ); await videoController.initialize(); @@ -143,11 +143,11 @@ void main() { if (cameras.isEmpty) { return; } - for (final CameraDescription cameraDescription in cameras) { - bool previousPresetExactlySupported = true; + for (final cameraDescription in cameras) { + var previousPresetExactlySupported = true; for (final MapEntry preset in presetExpectedSizes.entries) { - final CameraController controller = CameraController( + final controller = CameraController( cameraDescription, preset.key, ); @@ -174,7 +174,7 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], ResolutionPreset.low, enableAudio: false, @@ -184,7 +184,7 @@ void main() { await controller.prepareForVideoRecording(); int startPause; - int timePaused = 0; + var timePaused = 0; await controller.startVideoRecording(); final int recordingStart = DateTime.now().millisecondsSinceEpoch; @@ -210,8 +210,8 @@ void main() { final int recordingTime = DateTime.now().millisecondsSinceEpoch - recordingStart; - final File videoFile = File(file.path); - final VideoPlayerController videoController = VideoPlayerController.file( + final videoFile = File(file.path); + final videoController = VideoPlayerController.file( videoFile, ); await videoController.initialize(); @@ -228,7 +228,7 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], ResolutionPreset.low, enableAudio: false, @@ -250,7 +250,7 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], ResolutionPreset.low, enableAudio: false, @@ -267,7 +267,7 @@ void main() { List cameras, ImageFormatGroup? imageFormatGroup, ) async { - final CameraController controller = CameraController( + final controller = CameraController( cameras.first, ResolutionPreset.low, enableAudio: false, @@ -275,7 +275,7 @@ void main() { ); await controller.initialize(); - final Completer completer = Completer(); + final completer = Completer(); await controller.startImageStream((CameraImageData image) { if (!completer.isCompleted) { @@ -322,7 +322,7 @@ void main() { return; } - final CameraController controller = CameraController( + final controller = CameraController( cameras[0], ResolutionPreset.low, enableAudio: false, @@ -330,7 +330,7 @@ void main() { await controller.initialize(); await controller.prepareForVideoRecording(); - final Completer completer = Completer(); + final completer = Completer(); await controller.startVideoRecording( streamCallback: (CameraImageData image) { if (!completer.isCompleted) { @@ -354,9 +354,9 @@ void main() { if (cameras.isEmpty) { return; } - for (final CameraDescription cameraDescription in cameras) { + for (final cameraDescription in cameras) { for (final ImageFileFormat fileFormat in ImageFileFormat.values) { - final CameraController controller = CameraController( + final controller = CameraController( cameraDescription, ResolutionPreset.low, ); @@ -377,9 +377,9 @@ void main() { return; } - final List lengths = []; - for (final int fps in [10, 30]) { - final CameraController controller = CameraController.withSettings( + final lengths = []; + for (final fps in [10, 30]) { + final controller = CameraController.withSettings( cameras.first, mediaSettings: MediaSettings( resolutionPreset: ResolutionPreset.medium, @@ -395,14 +395,14 @@ void main() { final XFile file = await controller.stopVideoRecording(); // Load video size - final File videoFile = File(file.path); + final videoFile = File(file.path); lengths.add(await videoFile.length()); await controller.dispose(); } - for (int n = 0; n < lengths.length - 1; n++) { + for (var n = 0; n < lengths.length - 1; n++) { expect( lengths[n], lessThan(lengths[n + 1]), @@ -418,10 +418,10 @@ void main() { return; } - const int kiloBits = 1024; - final List lengths = []; - for (final int videoBitrate in [100 * kiloBits, 1000 * kiloBits]) { - final CameraController controller = CameraController.withSettings( + const kiloBits = 1024; + final lengths = []; + for (final videoBitrate in [100 * kiloBits, 1000 * kiloBits]) { + final controller = CameraController.withSettings( cameras.first, mediaSettings: MediaSettings( resolutionPreset: ResolutionPreset.medium, @@ -437,14 +437,14 @@ void main() { final XFile file = await controller.stopVideoRecording(); // Load video size - final File videoFile = File(file.path); + final videoFile = File(file.path); lengths.add(await videoFile.length()); await controller.dispose(); } - for (int n = 0; n < lengths.length - 1; n++) { + for (var n = 0; n < lengths.length - 1; n++) { expect( lengths[n], lessThan(lengths[n + 1]), @@ -460,11 +460,11 @@ void main() { return; } - final List lengths = []; + final lengths = []; - const int kiloBits = 1024; - for (final int audioBitrate in [32 * kiloBits, 64 * kiloBits]) { - final CameraController controller = CameraController.withSettings( + const kiloBits = 1024; + for (final audioBitrate in [32 * kiloBits, 64 * kiloBits]) { + final controller = CameraController.withSettings( cameras.first, mediaSettings: MediaSettings( resolutionPreset: ResolutionPreset.low, @@ -483,7 +483,7 @@ void main() { final XFile file = await controller.stopVideoRecording(); // Load video metadata - final File videoFile = File(file.path); + final videoFile = File(file.path); final int length = await videoFile.length(); @@ -492,7 +492,7 @@ void main() { await controller.dispose(); } - for (int n = 0; n < lengths.length - 1; n++) { + for (var n = 0; n < lengths.length - 1; n++) { expect( lengths[n], lessThan(lengths[n + 1]), diff --git a/packages/camera/camera_avfoundation/example/lib/camera_controller.dart b/packages/camera/camera_avfoundation/example/lib/camera_controller.dart index 4fff05829bb..53076894667 100644 --- a/packages/camera/camera_avfoundation/example/lib/camera_controller.dart +++ b/packages/camera/camera_avfoundation/example/lib/camera_controller.dart @@ -222,7 +222,7 @@ class CameraController extends ValueNotifier { Future initialize() => _initializeWithDescription(description); Future _initializeWithDescription(CameraDescription description) async { - final Completer initializeCompleter = + final initializeCompleter = Completer(); _deviceOrientationSubscription = CameraPlatform.instance diff --git a/packages/camera/camera_avfoundation/example/lib/camera_preview.dart b/packages/camera/camera_avfoundation/example/lib/camera_preview.dart index 22fb2cc4d77..0a768b34063 100644 --- a/packages/camera/camera_avfoundation/example/lib/camera_preview.dart +++ b/packages/camera/camera_avfoundation/example/lib/camera_preview.dart @@ -62,7 +62,7 @@ class CameraPreview extends StatelessWidget { } int _getQuarterTurns() { - final Map turns = { + final turns = { DeviceOrientation.portraitUp: 0, DeviceOrientation.landscapeRight: 1, DeviceOrientation.portraitDown: 2, diff --git a/packages/camera/camera_avfoundation/example/lib/main.dart b/packages/camera/camera_avfoundation/example/lib/main.dart index 4d12a6f367d..0df8ebe185f 100644 --- a/packages/camera/camera_avfoundation/example/lib/main.dart +++ b/packages/camera/camera_avfoundation/example/lib/main.dart @@ -577,7 +577,7 @@ class _CameraExampleHomeState extends State /// Display a row of toggle to select the camera (or a message if no camera is available). Widget _cameraTogglesRowWidget() { - final List toggles = []; + final toggles = []; if (_cameras.isEmpty) { SchedulerBinding.instance.addPostFrameCallback((_) async { @@ -627,7 +627,7 @@ class _CameraExampleHomeState extends State final CameraController cameraController = controller!; - final Point point = Point( + final point = Point( details.localPosition.dx / constraints.maxWidth, details.localPosition.dy / constraints.maxHeight, ); @@ -646,7 +646,7 @@ class _CameraExampleHomeState extends State Future _initializeCameraController( CameraDescription cameraDescription, ) async { - final CameraController cameraController = CameraController( + final cameraController = CameraController( cameraDescription, kIsWeb ? ResolutionPreset.max : ResolutionPreset.medium, enableAudio: enableAudio, @@ -1000,7 +1000,7 @@ class _CameraExampleHomeState extends State return; } - final VideoPlayerController vController = kIsWeb + final vController = kIsWeb ? VideoPlayerController.networkUrl(Uri.parse(videoFile!.path)) : VideoPlayerController.file(File(videoFile!.path)); diff --git a/packages/camera/camera_avfoundation/lib/src/avfoundation_camera.dart b/packages/camera/camera_avfoundation/lib/src/avfoundation_camera.dart index 188062f9970..58afb3f18cc 100644 --- a/packages/camera/camera_avfoundation/lib/src/avfoundation_camera.dart +++ b/packages/camera/camera_avfoundation/lib/src/avfoundation_camera.dart @@ -118,7 +118,7 @@ class AVFoundationCamera extends CameraPlatform { () => HostCameraMessageHandler(cameraId, cameraEventStreamController), ); - final Completer completer = Completer(); + final completer = Completer(); unawaited( onCameraInitialized(cameraId).first.then((CameraInitializedEvent value) { @@ -274,7 +274,7 @@ class AVFoundationCamera extends CameraPlatform { } void _startStreamListener() { - const EventChannel cameraEventChannel = EventChannel( + const cameraEventChannel = EventChannel( 'plugins.flutter.io/camera_avfoundation/imageStream', ); _platformImageStreamSubscription = cameraEventChannel diff --git a/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart b/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart index ec31faf9c27..5fe71461105 100644 --- a/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart +++ b/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart @@ -30,10 +30,10 @@ void main() { group('Creation, Initialization & Disposal Tests', () { test('Should send creation data and receive back a camera id', () async { // Arrange - final MockCameraApi mockApi = MockCameraApi(); + final mockApi = MockCameraApi(); when(mockApi.create(any, any)).thenAnswer((_) async => 1); - final AVFoundationCamera camera = AVFoundationCamera(api: mockApi); - const String cameraName = 'Test'; + final camera = AVFoundationCamera(api: mockApi); + const cameraName = 'Test'; // Act final int cameraId = await camera.createCamera( @@ -50,7 +50,7 @@ void main() { mockApi.create(captureAny, captureAny), ); expect(verification.captured[0], cameraName); - final PlatformMediaSettings? settings = + final settings = verification.captured[1] as PlatformMediaSettings?; expect(settings, isNotNull); expect(settings?.resolutionPreset, PlatformResolutionPreset.high); @@ -61,13 +61,13 @@ void main() { 'Should send creation data and receive back a camera id using createCameraWithSettings', () async { // Arrange - final MockCameraApi mockApi = MockCameraApi(); + final mockApi = MockCameraApi(); when(mockApi.create(any, any)).thenAnswer((_) async => 1); - final AVFoundationCamera camera = AVFoundationCamera(api: mockApi); - const String cameraName = 'Test'; - const int fps = 15; - const int videoBitrate = 200000; - const int audioBitrate = 32000; + final camera = AVFoundationCamera(api: mockApi); + const cameraName = 'Test'; + const fps = 15; + const videoBitrate = 200000; + const audioBitrate = 32000; // Act final int cameraId = await camera.createCameraWithSettings( @@ -90,7 +90,7 @@ void main() { mockApi.create(captureAny, captureAny), ); expect(verification.captured[0], cameraName); - final PlatformMediaSettings? settings = + final settings = verification.captured[1] as PlatformMediaSettings?; expect(settings, isNotNull); expect(settings?.resolutionPreset, PlatformResolutionPreset.low); @@ -106,17 +106,17 @@ void main() { 'Should throw CameraException when create throws a PlatformException', () { // Arrange - const String exceptionCode = 'TESTING_ERROR_CODE'; - const String exceptionMessage = + const exceptionCode = 'TESTING_ERROR_CODE'; + const exceptionMessage = 'Mock error message used during testing.'; - final MockCameraApi mockApi = MockCameraApi(); + final mockApi = MockCameraApi(); when(mockApi.create(any, any)).thenAnswer((_) async { throw PlatformException( code: exceptionCode, message: exceptionMessage, ); }); - final AVFoundationCamera camera = AVFoundationCamera(api: mockApi); + final camera = AVFoundationCamera(api: mockApi); // Act expect( @@ -145,17 +145,17 @@ void main() { 'Should throw CameraException when initialize throws a PlatformException', () { // Arrange - const String exceptionCode = 'TESTING_ERROR_CODE'; - const String exceptionMessage = + const exceptionCode = 'TESTING_ERROR_CODE'; + const exceptionMessage = 'Mock error message used during testing.'; - final MockCameraApi mockApi = MockCameraApi(); + final mockApi = MockCameraApi(); when(mockApi.initialize(any, any)).thenAnswer((_) async { throw PlatformException( code: exceptionCode, message: exceptionMessage, ); }); - final AVFoundationCamera camera = AVFoundationCamera(api: mockApi); + final camera = AVFoundationCamera(api: mockApi); // Act expect( @@ -179,8 +179,8 @@ void main() { test('Should send initialization data', () async { // Arrange - final MockCameraApi mockApi = MockCameraApi(); - final AVFoundationCamera camera = AVFoundationCamera(api: mockApi); + final mockApi = MockCameraApi(); + final camera = AVFoundationCamera(api: mockApi); final int cameraId = await camera.createCamera( const CameraDescription( name: 'Test', @@ -216,8 +216,8 @@ void main() { test('Should send a disposal call on dispose', () async { // Arrange - final MockCameraApi mockApi = MockCameraApi(); - final AVFoundationCamera camera = AVFoundationCamera(api: mockApi); + final mockApi = MockCameraApi(); + final camera = AVFoundationCamera(api: mockApi); final int cameraId = await camera.createCamera( const CameraDescription( name: 'Test', @@ -255,7 +255,7 @@ void main() { late AVFoundationCamera camera; late int cameraId; setUp(() async { - final MockCameraApi mockApi = MockCameraApi(); + final mockApi = MockCameraApi(); when(mockApi.create(any, any)).thenAnswer((_) async => 1); camera = AVFoundationCamera(api: mockApi); cameraId = await camera.createCamera( @@ -285,12 +285,12 @@ void main() { // Act final Stream eventStream = camera .onCameraInitialized(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); - final PlatformSize previewSize = PlatformSize(width: 3840, height: 2160); + final previewSize = PlatformSize(width: 3840, height: 2160); // Emit test events - final CameraInitializedEvent event = CameraInitializedEvent( + final event = CameraInitializedEvent( cameraId, previewSize.width, previewSize.height, @@ -321,12 +321,12 @@ void main() { final Stream errorStream = camera.onCameraError( cameraId, ); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(errorStream); // Emit test events - const String errorMessage = 'Error Description'; - final CameraErrorEvent event = CameraErrorEvent(cameraId, errorMessage); + const errorMessage = 'Error Description'; + final event = CameraErrorEvent(cameraId, errorMessage); camera.hostCameraHandlers[cameraId]!.error(errorMessage); camera.hostCameraHandlers[cameraId]!.error(errorMessage); camera.hostCameraHandlers[cameraId]!.error(errorMessage); @@ -344,14 +344,14 @@ void main() { // Act final Stream eventStream = camera .onDeviceOrientationChanged(); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); // Emit test events - const DeviceOrientationChangedEvent event = DeviceOrientationChangedEvent( + const event = DeviceOrientationChangedEvent( DeviceOrientation.portraitUp, ); - for (int i = 0; i < 3; i++) { + for (var i = 0; i < 3; i++) { camera.hostHandler.deviceOrientationChanged( PlatformDeviceOrientation.portraitUp, ); @@ -402,7 +402,7 @@ void main() { test( 'Should fetch CameraDescription instances for available cameras', () async { - final List returnData = + final returnData = [ PlatformCameraDescription( name: 'Test 1', @@ -420,7 +420,7 @@ void main() { final List cameras = await camera.availableCameras(); expect(cameras.length, returnData.length); - for (int i = 0; i < returnData.length; i++) { + for (var i = 0; i < returnData.length; i++) { expect(cameras[i].name, returnData[i].name); expect( cameras[i].lensDirection, @@ -439,8 +439,8 @@ void main() { test( 'Should throw CameraException when availableCameras throws a PlatformException', () { - const String code = 'TESTING_ERROR_CODE'; - const String message = 'Mock error message used during testing.'; + const code = 'TESTING_ERROR_CODE'; + const message = 'Mock error message used during testing.'; when(mockApi.getAvailableCameras()).thenAnswer( (_) async => throw PlatformException(code: code, message: message), ); @@ -461,7 +461,7 @@ void main() { ); test('Should take a picture and return an XFile instance', () async { - const String stubPath = '/test/path.jpg'; + const stubPath = '/test/path.jpg'; when(mockApi.takePicture()).thenAnswer((_) async => stubPath); final XFile file = await camera.takePicture(cameraId); @@ -496,7 +496,7 @@ void main() { ); test('Should stop a video recording and return the file', () async { - const String stubPath = '/test/path.mp4'; + const stubPath = '/test/path.mp4'; when(mockApi.stopVideoRecording()).thenAnswer((_) async => stubPath); final XFile file = await camera.stopVideoRecording(cameraId); @@ -517,7 +517,7 @@ void main() { }); test('Should set the description while recording', () async { - const CameraDescription camera2Description = CameraDescription( + const camera2Description = CameraDescription( name: 'Test2', lensDirection: CameraLensDirection.front, sensorOrientation: 0, @@ -565,13 +565,13 @@ void main() { }); test('Should set the exposure point to a value', () async { - const Point point = Point(0.4, 0.6); + const point = Point(0.4, 0.6); await camera.setExposurePoint(cameraId, point); final VerificationResult verification = verify( mockApi.setExposurePoint(captureAny), ); - final PlatformPoint? passedPoint = + final passedPoint = verification.captured[0] as PlatformPoint?; expect(passedPoint?.x, point.x); expect(passedPoint?.y, point.y); @@ -583,13 +583,13 @@ void main() { final VerificationResult verification = verify( mockApi.setExposurePoint(captureAny), ); - final PlatformPoint? passedPoint = + final passedPoint = verification.captured[0] as PlatformPoint?; expect(passedPoint, null); }); test('Should get the min exposure offset', () async { - const double stubMinOffset = 2.0; + const stubMinOffset = 2.0; when( mockApi.getMinExposureOffset(), ).thenAnswer((_) async => stubMinOffset); @@ -602,7 +602,7 @@ void main() { }); test('Should get the max exposure offset', () async { - const double stubMaxOffset = 2.0; + const stubMaxOffset = 2.0; when( mockApi.getMaxExposureOffset(), ).thenAnswer((_) async => stubMaxOffset); @@ -621,7 +621,7 @@ void main() { }); test('Should set the exposure offset', () async { - const double stubOffset = 0.5; + const stubOffset = 0.5; final double actualOffset = await camera.setExposureOffset(cameraId, 0.5); verify(mockApi.setExposureOffset(stubOffset)); @@ -642,13 +642,13 @@ void main() { }); test('Should set the focus point to a value', () async { - const Point point = Point(0.4, 0.6); + const point = Point(0.4, 0.6); await camera.setFocusPoint(cameraId, point); final VerificationResult verification = verify( mockApi.setFocusPoint(captureAny), ); - final PlatformPoint? passedPoint = + final passedPoint = verification.captured[0] as PlatformPoint?; expect(passedPoint?.x, point.x); expect(passedPoint?.y, point.y); @@ -660,7 +660,7 @@ void main() { final VerificationResult verification = verify( mockApi.setFocusPoint(captureAny), ); - final PlatformPoint? passedPoint = + final passedPoint = verification.captured[0] as PlatformPoint?; expect(passedPoint, null); }); @@ -673,7 +673,7 @@ void main() { }); test('Should get the max zoom level', () async { - const double stubZoomLevel = 10.0; + const stubZoomLevel = 10.0; when(mockApi.getMaxZoomLevel()).thenAnswer((_) async => stubZoomLevel); final double maxZoomLevel = await camera.getMaxZoomLevel(cameraId); @@ -682,7 +682,7 @@ void main() { }); test('Should get the min zoom level', () async { - const double stubZoomLevel = 10.0; + const stubZoomLevel = 10.0; when(mockApi.getMinZoomLevel()).thenAnswer((_) async => stubZoomLevel); final double minZoomLevel = await camera.getMinZoomLevel(cameraId); @@ -691,7 +691,7 @@ void main() { }); test('Should set the zoom level', () async { - const double zoom = 2.0; + const zoom = 2.0; await camera.setZoomLevel(cameraId, zoom); @@ -701,8 +701,8 @@ void main() { test( 'Should throw CameraException when illegal zoom level is supplied', () async { - const String code = 'ZOOM_ERROR'; - const String message = 'Illegal zoom error'; + const code = 'ZOOM_ERROR'; + const message = 'Illegal zoom error'; when(mockApi.setZoomLevel(any)).thenAnswer( (_) async => throw PlatformException(code: code, message: message), ); diff --git a/packages/camera/camera_platform_interface/lib/src/method_channel/method_channel_camera.dart b/packages/camera/camera_platform_interface/lib/src/method_channel/method_channel_camera.dart index d48b06023f1..72d41ed6c2a 100644 --- a/packages/camera/camera_platform_interface/lib/src/method_channel/method_channel_camera.dart +++ b/packages/camera/camera_platform_interface/lib/src/method_channel/method_channel_camera.dart @@ -20,7 +20,7 @@ const MethodChannel _channel = MethodChannel('plugins.flutter.io/camera'); class MethodChannelCamera extends CameraPlatform { /// Construct a new method channel camera instance. MethodChannelCamera() { - const MethodChannel channel = MethodChannel( + const channel = MethodChannel( 'flutter.io/cameraPlugin/device', ); channel.setMethodCallHandler( @@ -127,7 +127,7 @@ class MethodChannelCamera extends CameraPlatform { ImageFormatGroup imageFormatGroup = ImageFormatGroup.unknown, }) { _channels.putIfAbsent(cameraId, () { - final MethodChannel channel = MethodChannel( + final channel = MethodChannel( 'flutter.io/cameraPlugin/camera$cameraId', ); channel.setMethodCallHandler( @@ -136,7 +136,7 @@ class MethodChannelCamera extends CameraPlatform { return channel; }); - final Completer completer = Completer(); + final completer = Completer(); onCameraInitialized(cameraId).first.then((CameraInitializedEvent value) { completer.complete(); @@ -338,7 +338,7 @@ class MethodChannelCamera extends CameraPlatform { } void _startStreamListener() { - const EventChannel cameraEventChannel = EventChannel( + const cameraEventChannel = EventChannel( 'plugins.flutter.io/camera/imageStream', ); _platformImageStreamSubscription = cameraEventChannel diff --git a/packages/camera/camera_platform_interface/test/camera_platform_interface_test.dart b/packages/camera/camera_platform_interface/test/camera_platform_interface_test.dart index e252ba9e613..5bd37f410e3 100644 --- a/packages/camera/camera_platform_interface/test/camera_platform_interface_test.dart +++ b/packages/camera/camera_platform_interface/test/camera_platform_interface_test.dart @@ -36,7 +36,7 @@ void main() { 'Default implementation of availableCameras() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -50,7 +50,7 @@ void main() { 'Default implementation of onCameraInitialized() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -64,7 +64,7 @@ void main() { 'Default implementation of onResolutionChanged() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -78,7 +78,7 @@ void main() { 'Default implementation of onCameraClosing() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -92,7 +92,7 @@ void main() { 'Default implementation of onCameraError() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect(() => cameraPlatform.onCameraError(1), throwsUnimplementedError); @@ -103,7 +103,7 @@ void main() { 'Default implementation of onDeviceOrientationChanged() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -117,7 +117,7 @@ void main() { 'Default implementation of lockCaptureOrientation() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -134,7 +134,7 @@ void main() { 'Default implementation of unlockCaptureOrientation() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -148,7 +148,7 @@ void main() { 'Default implementation of dispose() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect(() => cameraPlatform.dispose(1), throwsUnimplementedError); @@ -159,7 +159,7 @@ void main() { 'Default implementation of createCamera() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -180,13 +180,13 @@ void main() { 'Default implementation of createCameraWithSettings() should call createCamera() passing parameters', () { // Arrange - const CameraDescription cameraDescription = CameraDescription( + const cameraDescription = CameraDescription( name: 'back', lensDirection: CameraLensDirection.back, sensorOrientation: 0, ); - const MediaSettings mediaSettings = MediaSettings( + const mediaSettings = MediaSettings( resolutionPreset: ResolutionPreset.low, fps: 15, videoBitrate: 200000, @@ -194,9 +194,9 @@ void main() { enableAudio: true, ); - bool createCameraCalled = false; + var createCameraCalled = false; - final OverriddenCameraPlatform cameraPlatform = + final cameraPlatform = OverriddenCameraPlatform(( CameraDescription cameraDescriptionArg, ResolutionPreset? resolutionPresetArg, @@ -240,7 +240,7 @@ void main() { 'Default implementation of initializeCamera() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -254,7 +254,7 @@ void main() { 'Default implementation of pauseVideoRecording() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -268,7 +268,7 @@ void main() { 'Default implementation of prepareForVideoRecording() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -282,7 +282,7 @@ void main() { 'Default implementation of resumeVideoRecording() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -296,7 +296,7 @@ void main() { 'Default implementation of setFlashMode() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -310,7 +310,7 @@ void main() { 'Default implementation of setExposureMode() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -324,7 +324,7 @@ void main() { 'Default implementation of setExposurePoint() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -338,7 +338,7 @@ void main() { 'Default implementation of getMinExposureOffset() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -352,7 +352,7 @@ void main() { 'Default implementation of getMaxExposureOffset() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -366,7 +366,7 @@ void main() { 'Default implementation of getExposureOffsetStepSize() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -380,7 +380,7 @@ void main() { 'Default implementation of setExposureOffset() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -394,7 +394,7 @@ void main() { 'Default implementation of setFocusMode() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -408,7 +408,7 @@ void main() { 'Default implementation of setFocusPoint() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -422,7 +422,7 @@ void main() { 'Default implementation of startVideoRecording() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -436,7 +436,7 @@ void main() { 'Default implementation of stopVideoRecording() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -450,7 +450,7 @@ void main() { 'Default implementation of takePicture() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect(() => cameraPlatform.takePicture(1), throwsUnimplementedError); @@ -461,7 +461,7 @@ void main() { 'Default implementation of getMaxZoomLevel() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -475,7 +475,7 @@ void main() { 'Default implementation of getMinZoomLevel() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -489,7 +489,7 @@ void main() { 'Default implementation of setZoomLevel() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect( @@ -503,7 +503,7 @@ void main() { 'Default implementation of pausePreview() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect(() => cameraPlatform.pausePreview(1), throwsUnimplementedError); @@ -514,7 +514,7 @@ void main() { 'Default implementation of resumePreview() should throw unimplemented error', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect(() => cameraPlatform.resumePreview(1), throwsUnimplementedError); @@ -525,7 +525,7 @@ void main() { 'Default implementation of supportsImageStreaming() should return false', () { // Arrange - final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform(); + final cameraPlatform = ExtendsCameraPlatform(); // Act & Assert expect(cameraPlatform.supportsImageStreaming(), false); diff --git a/packages/camera/camera_platform_interface/test/events/camera_event_test.dart b/packages/camera/camera_platform_interface/test/events/camera_event_test.dart index a5e45d95f00..fbf1dfa279c 100644 --- a/packages/camera/camera_platform_interface/test/events/camera_event_test.dart +++ b/packages/camera/camera_platform_interface/test/events/camera_event_test.dart @@ -10,7 +10,7 @@ void main() { group('CameraInitializedEvent tests', () { test('Constructor should initialize all properties', () { - const CameraInitializedEvent event = CameraInitializedEvent( + const event = CameraInitializedEvent( 1, 1024, 640, @@ -30,7 +30,7 @@ void main() { }); test('fromJson should initialize all properties', () { - final CameraInitializedEvent event = + final event = CameraInitializedEvent.fromJson(const { 'cameraId': 1, 'previewWidth': 1024.0, @@ -51,7 +51,7 @@ void main() { }); test('toJson should return a map with all fields', () { - const CameraInitializedEvent event = CameraInitializedEvent( + const event = CameraInitializedEvent( 1, 1024, 640, @@ -74,7 +74,7 @@ void main() { }); test('equals should return true if objects are the same', () { - const CameraInitializedEvent firstEvent = CameraInitializedEvent( + const firstEvent = CameraInitializedEvent( 1, 1024, 640, @@ -83,7 +83,7 @@ void main() { FocusMode.auto, true, ); - const CameraInitializedEvent secondEvent = CameraInitializedEvent( + const secondEvent = CameraInitializedEvent( 1, 1024, 640, @@ -97,7 +97,7 @@ void main() { }); test('equals should return false if cameraId is different', () { - const CameraInitializedEvent firstEvent = CameraInitializedEvent( + const firstEvent = CameraInitializedEvent( 1, 1024, 640, @@ -106,7 +106,7 @@ void main() { FocusMode.auto, true, ); - const CameraInitializedEvent secondEvent = CameraInitializedEvent( + const secondEvent = CameraInitializedEvent( 2, 1024, 640, @@ -120,7 +120,7 @@ void main() { }); test('equals should return false if previewWidth is different', () { - const CameraInitializedEvent firstEvent = CameraInitializedEvent( + const firstEvent = CameraInitializedEvent( 1, 1024, 640, @@ -129,7 +129,7 @@ void main() { FocusMode.auto, true, ); - const CameraInitializedEvent secondEvent = CameraInitializedEvent( + const secondEvent = CameraInitializedEvent( 1, 2048, 640, @@ -143,7 +143,7 @@ void main() { }); test('equals should return false if previewHeight is different', () { - const CameraInitializedEvent firstEvent = CameraInitializedEvent( + const firstEvent = CameraInitializedEvent( 1, 1024, 640, @@ -152,7 +152,7 @@ void main() { FocusMode.auto, true, ); - const CameraInitializedEvent secondEvent = CameraInitializedEvent( + const secondEvent = CameraInitializedEvent( 1, 1024, 980, @@ -166,7 +166,7 @@ void main() { }); test('equals should return false if exposureMode is different', () { - const CameraInitializedEvent firstEvent = CameraInitializedEvent( + const firstEvent = CameraInitializedEvent( 1, 1024, 640, @@ -175,7 +175,7 @@ void main() { FocusMode.auto, true, ); - const CameraInitializedEvent secondEvent = CameraInitializedEvent( + const secondEvent = CameraInitializedEvent( 1, 1024, 640, @@ -191,7 +191,7 @@ void main() { test( 'equals should return false if exposurePointSupported is different', () { - const CameraInitializedEvent firstEvent = CameraInitializedEvent( + const firstEvent = CameraInitializedEvent( 1, 1024, 640, @@ -200,7 +200,7 @@ void main() { FocusMode.auto, true, ); - const CameraInitializedEvent secondEvent = CameraInitializedEvent( + const secondEvent = CameraInitializedEvent( 1, 1024, 640, @@ -215,7 +215,7 @@ void main() { ); test('equals should return false if focusMode is different', () { - const CameraInitializedEvent firstEvent = CameraInitializedEvent( + const firstEvent = CameraInitializedEvent( 1, 1024, 640, @@ -224,7 +224,7 @@ void main() { FocusMode.auto, true, ); - const CameraInitializedEvent secondEvent = CameraInitializedEvent( + const secondEvent = CameraInitializedEvent( 1, 1024, 640, @@ -238,7 +238,7 @@ void main() { }); test('equals should return false if focusPointSupported is different', () { - const CameraInitializedEvent firstEvent = CameraInitializedEvent( + const firstEvent = CameraInitializedEvent( 1, 1024, 640, @@ -247,7 +247,7 @@ void main() { FocusMode.auto, true, ); - const CameraInitializedEvent secondEvent = CameraInitializedEvent( + const secondEvent = CameraInitializedEvent( 1, 1024, 640, @@ -261,7 +261,7 @@ void main() { }); test('hashCode should match hashCode of all properties', () { - const CameraInitializedEvent event = CameraInitializedEvent( + const event = CameraInitializedEvent( 1, 1024, 640, @@ -286,7 +286,7 @@ void main() { group('CameraResolutionChangesEvent tests', () { test('Constructor should initialize all properties', () { - const CameraResolutionChangedEvent event = CameraResolutionChangedEvent( + const event = CameraResolutionChangedEvent( 1, 1024, 640, @@ -298,7 +298,7 @@ void main() { }); test('fromJson should initialize all properties', () { - final CameraResolutionChangedEvent event = + final event = CameraResolutionChangedEvent.fromJson(const { 'cameraId': 1, 'captureWidth': 1024.0, @@ -311,7 +311,7 @@ void main() { }); test('toJson should return a map with all fields', () { - const CameraResolutionChangedEvent event = CameraResolutionChangedEvent( + const event = CameraResolutionChangedEvent( 1, 1024, 640, @@ -326,43 +326,43 @@ void main() { }); test('equals should return true if objects are the same', () { - const CameraResolutionChangedEvent firstEvent = + const firstEvent = CameraResolutionChangedEvent(1, 1024, 640); - const CameraResolutionChangedEvent secondEvent = + const secondEvent = CameraResolutionChangedEvent(1, 1024, 640); expect(firstEvent == secondEvent, true); }); test('equals should return false if cameraId is different', () { - const CameraResolutionChangedEvent firstEvent = + const firstEvent = CameraResolutionChangedEvent(1, 1024, 640); - const CameraResolutionChangedEvent secondEvent = + const secondEvent = CameraResolutionChangedEvent(2, 1024, 640); expect(firstEvent == secondEvent, false); }); test('equals should return false if captureWidth is different', () { - const CameraResolutionChangedEvent firstEvent = + const firstEvent = CameraResolutionChangedEvent(1, 1024, 640); - const CameraResolutionChangedEvent secondEvent = + const secondEvent = CameraResolutionChangedEvent(1, 2048, 640); expect(firstEvent == secondEvent, false); }); test('equals should return false if captureHeight is different', () { - const CameraResolutionChangedEvent firstEvent = + const firstEvent = CameraResolutionChangedEvent(1, 1024, 640); - const CameraResolutionChangedEvent secondEvent = + const secondEvent = CameraResolutionChangedEvent(1, 1024, 980); expect(firstEvent == secondEvent, false); }); test('hashCode should match hashCode of all properties', () { - const CameraResolutionChangedEvent event = CameraResolutionChangedEvent( + const event = CameraResolutionChangedEvent( 1, 1024, 640, @@ -379,13 +379,13 @@ void main() { group('CameraClosingEvent tests', () { test('Constructor should initialize all properties', () { - const CameraClosingEvent event = CameraClosingEvent(1); + const event = CameraClosingEvent(1); expect(event.cameraId, 1); }); test('fromJson should initialize all properties', () { - final CameraClosingEvent event = CameraClosingEvent.fromJson( + final event = CameraClosingEvent.fromJson( const {'cameraId': 1}, ); @@ -393,7 +393,7 @@ void main() { }); test('toJson should return a map with all fields', () { - const CameraClosingEvent event = CameraClosingEvent(1); + const event = CameraClosingEvent(1); final Map jsonMap = event.toJson(); @@ -402,22 +402,22 @@ void main() { }); test('equals should return true if objects are the same', () { - const CameraClosingEvent firstEvent = CameraClosingEvent(1); - const CameraClosingEvent secondEvent = CameraClosingEvent(1); + const firstEvent = CameraClosingEvent(1); + const secondEvent = CameraClosingEvent(1); expect(firstEvent == secondEvent, true); }); test('equals should return false if cameraId is different', () { - const CameraClosingEvent firstEvent = CameraClosingEvent(1); - const CameraClosingEvent secondEvent = CameraClosingEvent(2); + const firstEvent = CameraClosingEvent(1); + const secondEvent = CameraClosingEvent(2); expect(firstEvent == secondEvent, false); }); test('hashCode should match hashCode of all properties', () { - const CameraClosingEvent event = CameraClosingEvent(1); - final int expectedHashCode = event.cameraId.hashCode; + const event = CameraClosingEvent(1); + final expectedHashCode = event.cameraId.hashCode; expect(event.hashCode, expectedHashCode); }); @@ -425,14 +425,14 @@ void main() { group('CameraErrorEvent tests', () { test('Constructor should initialize all properties', () { - const CameraErrorEvent event = CameraErrorEvent(1, 'Error'); + const event = CameraErrorEvent(1, 'Error'); expect(event.cameraId, 1); expect(event.description, 'Error'); }); test('fromJson should initialize all properties', () { - final CameraErrorEvent event = CameraErrorEvent.fromJson( + final event = CameraErrorEvent.fromJson( const {'cameraId': 1, 'description': 'Error'}, ); @@ -441,7 +441,7 @@ void main() { }); test('toJson should return a map with all fields', () { - const CameraErrorEvent event = CameraErrorEvent(1, 'Error'); + const event = CameraErrorEvent(1, 'Error'); final Map jsonMap = event.toJson(); @@ -451,28 +451,28 @@ void main() { }); test('equals should return true if objects are the same', () { - const CameraErrorEvent firstEvent = CameraErrorEvent(1, 'Error'); - const CameraErrorEvent secondEvent = CameraErrorEvent(1, 'Error'); + const firstEvent = CameraErrorEvent(1, 'Error'); + const secondEvent = CameraErrorEvent(1, 'Error'); expect(firstEvent == secondEvent, true); }); test('equals should return false if cameraId is different', () { - const CameraErrorEvent firstEvent = CameraErrorEvent(1, 'Error'); - const CameraErrorEvent secondEvent = CameraErrorEvent(2, 'Error'); + const firstEvent = CameraErrorEvent(1, 'Error'); + const secondEvent = CameraErrorEvent(2, 'Error'); expect(firstEvent == secondEvent, false); }); test('equals should return false if description is different', () { - const CameraErrorEvent firstEvent = CameraErrorEvent(1, 'Error'); - const CameraErrorEvent secondEvent = CameraErrorEvent(1, 'Ooops'); + const firstEvent = CameraErrorEvent(1, 'Error'); + const secondEvent = CameraErrorEvent(1, 'Ooops'); expect(firstEvent == secondEvent, false); }); test('hashCode should match hashCode of all properties', () { - const CameraErrorEvent event = CameraErrorEvent(1, 'Error'); + const event = CameraErrorEvent(1, 'Error'); final int expectedHashCode = Object.hash( event.cameraId.hashCode, event.description, diff --git a/packages/camera/camera_platform_interface/test/events/device_event_test.dart b/packages/camera/camera_platform_interface/test/events/device_event_test.dart index ffd77a42ffb..fe7132fd10a 100644 --- a/packages/camera/camera_platform_interface/test/events/device_event_test.dart +++ b/packages/camera/camera_platform_interface/test/events/device_event_test.dart @@ -11,7 +11,7 @@ void main() { group('DeviceOrientationChangedEvent tests', () { test('Constructor should initialize all properties', () { - const DeviceOrientationChangedEvent event = DeviceOrientationChangedEvent( + const event = DeviceOrientationChangedEvent( DeviceOrientation.portraitUp, ); @@ -19,7 +19,7 @@ void main() { }); test('fromJson should initialize all properties', () { - final DeviceOrientationChangedEvent event = + final event = DeviceOrientationChangedEvent.fromJson(const { 'orientation': 'portraitUp', }); @@ -28,7 +28,7 @@ void main() { }); test('toJson should return a map with all fields', () { - const DeviceOrientationChangedEvent event = DeviceOrientationChangedEvent( + const event = DeviceOrientationChangedEvent( DeviceOrientation.portraitUp, ); @@ -39,28 +39,28 @@ void main() { }); test('equals should return true if objects are the same', () { - const DeviceOrientationChangedEvent firstEvent = + const firstEvent = DeviceOrientationChangedEvent(DeviceOrientation.portraitUp); - const DeviceOrientationChangedEvent secondEvent = + const secondEvent = DeviceOrientationChangedEvent(DeviceOrientation.portraitUp); expect(firstEvent == secondEvent, true); }); test('equals should return false if orientation is different', () { - const DeviceOrientationChangedEvent firstEvent = + const firstEvent = DeviceOrientationChangedEvent(DeviceOrientation.portraitUp); - const DeviceOrientationChangedEvent secondEvent = + const secondEvent = DeviceOrientationChangedEvent(DeviceOrientation.landscapeLeft); expect(firstEvent == secondEvent, false); }); test('hashCode should match hashCode of all properties', () { - const DeviceOrientationChangedEvent event = DeviceOrientationChangedEvent( + const event = DeviceOrientationChangedEvent( DeviceOrientation.portraitUp, ); - final int expectedHashCode = event.orientation.hashCode; + final expectedHashCode = event.orientation.hashCode; expect(event.hashCode, expectedHashCode); }); diff --git a/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart b/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart index 78cf02f8069..13a72f4a3d1 100644 --- a/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart +++ b/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart @@ -22,7 +22,7 @@ void main() { group('Creation, Initialization & Disposal Tests', () { test('Should send creation data and receive back a camera id', () async { // Arrange - final MethodChannelMock cameraMockChannel = MethodChannelMock( + final cameraMockChannel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: { 'create': { @@ -31,7 +31,7 @@ void main() { }, }, ); - final MethodChannelCamera camera = MethodChannelCamera(); + final camera = MethodChannelCamera(); // Act final int cameraId = await camera.createCameraWithSettings( @@ -78,7 +78,7 @@ void main() { ), }, ); - final MethodChannelCamera camera = MethodChannelCamera(); + final camera = MethodChannelCamera(); // Act expect( @@ -126,7 +126,7 @@ void main() { ), }, ); - final MethodChannelCamera camera = MethodChannelCamera(); + final camera = MethodChannelCamera(); // Act expect( @@ -174,7 +174,7 @@ void main() { ), }, ); - final MethodChannelCamera camera = MethodChannelCamera(); + final camera = MethodChannelCamera(); // Act expect( @@ -198,7 +198,7 @@ void main() { test('Should send initialization data', () async { // Arrange - final MethodChannelMock cameraMockChannel = MethodChannelMock( + final cameraMockChannel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: { 'create': { @@ -208,7 +208,7 @@ void main() { 'initialize': null, }, ); - final MethodChannelCamera camera = MethodChannelCamera(); + final camera = MethodChannelCamera(); final int cameraId = await camera.createCameraWithSettings( const CameraDescription( name: 'Test', @@ -255,7 +255,7 @@ void main() { test('Should send a disposal call on dispose', () async { // Arrange - final MethodChannelMock cameraMockChannel = MethodChannelMock( + final cameraMockChannel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: { 'create': {'cameraId': 1}, @@ -264,7 +264,7 @@ void main() { }, ); - final MethodChannelCamera camera = MethodChannelCamera(); + final camera = MethodChannelCamera(); final int cameraId = await camera.createCameraWithSettings( const CameraDescription( name: 'Test', @@ -351,11 +351,11 @@ void main() { // Act final Stream eventStream = camera .onCameraInitialized(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); // Emit test events - final CameraInitializedEvent event = CameraInitializedEvent( + final event = CameraInitializedEvent( cameraId, 3840, 2160, @@ -380,13 +380,13 @@ void main() { // Act final Stream resolutionStream = camera .onCameraResolutionChanged(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(resolutionStream); // Emit test events - final CameraResolutionChangedEvent fhdEvent = + final fhdEvent = CameraResolutionChangedEvent(cameraId, 1920, 1080); - final CameraResolutionChangedEvent uhdEvent = + final uhdEvent = CameraResolutionChangedEvent(cameraId, 3840, 2160); await camera.handleCameraMethodCall( MethodCall('resolution_changed', fhdEvent.toJson()), @@ -420,11 +420,11 @@ void main() { final Stream eventStream = camera.onCameraClosing( cameraId, ); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); // Emit test events - final CameraClosingEvent event = CameraClosingEvent(cameraId); + final event = CameraClosingEvent(cameraId); await camera.handleCameraMethodCall( MethodCall('camera_closing', event.toJson()), cameraId, @@ -452,11 +452,11 @@ void main() { final Stream errorStream = camera.onCameraError( cameraId, ); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(errorStream); // Emit test events - final CameraErrorEvent event = CameraErrorEvent( + final event = CameraErrorEvent( cameraId, 'Error Description', ); @@ -486,11 +486,11 @@ void main() { // Act final Stream eventStream = camera .onDeviceOrientationChanged(); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); // Emit test events - const DeviceOrientationChangedEvent event = + const event = DeviceOrientationChangedEvent(DeviceOrientation.portraitUp); await camera.handleDeviceMethodCall( MethodCall('orientation_changed', event.toJson()), @@ -558,7 +558,7 @@ void main() { 'Should fetch CameraDescription instances for available cameras', () async { // Arrange - final List returnData = [ + final returnData = [ { 'name': 'Test 1', 'lensFacing': 'front', @@ -570,7 +570,7 @@ void main() { 'sensorOrientation': 2, }, ]; - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'availableCameras': returnData}, ); @@ -584,11 +584,11 @@ void main() { isMethodCall('availableCameras', arguments: null), ]); expect(cameras.length, returnData.length); - for (int i = 0; i < returnData.length; i++) { + for (var i = 0; i < returnData.length; i++) { final Map typedData = (returnData[i] as Map) .cast(); - final CameraDescription cameraDescription = CameraDescription( + final cameraDescription = CameraDescription( name: typedData['name']! as String, lensDirection: parseCameraLensDirection( typedData['lensFacing']! as String, @@ -636,7 +636,7 @@ void main() { test('Should take a picture and return an XFile instance', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'takePicture': '/test/path.jpg'}, ); @@ -656,7 +656,7 @@ void main() { test('Should prepare for video recording', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'prepareForVideoRecording': null}, ); @@ -672,7 +672,7 @@ void main() { test('Should start recording a video', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'startVideoRecording': null}, ); @@ -695,13 +695,13 @@ void main() { test('Should set description while recording', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'setDescriptionWhileRecording': null}, ); // Act - const CameraDescription cameraDescription = CameraDescription( + const cameraDescription = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.back, sensorOrientation: 0, @@ -719,7 +719,7 @@ void main() { test('Should stop a video recording and return the file', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'stopVideoRecording': '/test/path.mp4'}, ); @@ -739,7 +739,7 @@ void main() { test('Should pause a video recording', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'pauseVideoRecording': null}, ); @@ -758,7 +758,7 @@ void main() { test('Should resume a video recording', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'resumeVideoRecording': null}, ); @@ -777,7 +777,7 @@ void main() { test('Should set the flash mode', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'setFlashMode': null}, ); @@ -814,7 +814,7 @@ void main() { test('Should set the exposure mode', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'setExposureMode': null}, ); @@ -841,7 +841,7 @@ void main() { test('Should set the exposure point', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'setExposurePoint': null}, ); @@ -875,7 +875,7 @@ void main() { test('Should get the min exposure offset', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'getMinExposureOffset': 2.0}, ); @@ -897,7 +897,7 @@ void main() { test('Should get the max exposure offset', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'getMaxExposureOffset': 2.0}, ); @@ -919,7 +919,7 @@ void main() { test('Should get the exposure offset step size', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'getExposureOffsetStepSize': 0.25}, ); @@ -941,7 +941,7 @@ void main() { test('Should set the exposure offset', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'setExposureOffset': 0.6}, ); @@ -964,7 +964,7 @@ void main() { test('Should set the focus mode', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'setFocusMode': null}, ); @@ -991,7 +991,7 @@ void main() { test('Should set the exposure point', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'setFocusPoint': null}, ); @@ -1035,7 +1035,7 @@ void main() { test( 'Should throw MissingPluginException when handling unknown method', () { - final MethodChannelCamera camera = MethodChannelCamera(); + final camera = MethodChannelCamera(); expect( () => camera.handleCameraMethodCall( @@ -1049,7 +1049,7 @@ void main() { test('Should get the max zoom level', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'getMaxZoomLevel': 10.0}, ); @@ -1069,7 +1069,7 @@ void main() { test('Should get the min zoom level', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'getMinZoomLevel': 1.0}, ); @@ -1089,7 +1089,7 @@ void main() { test('Should set the zoom level', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'setZoomLevel': null}, ); @@ -1138,7 +1138,7 @@ void main() { test('Should lock the capture orientation', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'lockCaptureOrientation': null}, ); @@ -1163,7 +1163,7 @@ void main() { test('Should unlock the capture orientation', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'unlockCaptureOrientation': null}, ); @@ -1182,7 +1182,7 @@ void main() { test('Should pause the camera preview', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'pausePreview': null}, ); @@ -1201,7 +1201,7 @@ void main() { test('Should resume the camera preview', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'resumePreview': null}, ); @@ -1220,7 +1220,7 @@ void main() { test('Should start streaming', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: { 'startImageStream': null, @@ -1243,7 +1243,7 @@ void main() { test('Should stop streaming', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: { 'startImageStream': null, @@ -1266,7 +1266,7 @@ void main() { test('Should set the ImageFileFormat to heif', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'setImageFileFormat': 'heif'}, ); @@ -1288,7 +1288,7 @@ void main() { test('Should set the ImageFileFormat to jpeg', () async { // Arrange - final MethodChannelMock channel = MethodChannelMock( + final channel = MethodChannelMock( channelName: 'plugins.flutter.io/camera', methods: {'setImageFileFormat': 'jpeg'}, ); diff --git a/packages/camera/camera_platform_interface/test/types/camera_description_test.dart b/packages/camera/camera_platform_interface/test/types/camera_description_test.dart index 8b5aa448ab8..6bf9ee3f2bc 100644 --- a/packages/camera/camera_platform_interface/test/types/camera_description_test.dart +++ b/packages/camera/camera_platform_interface/test/types/camera_description_test.dart @@ -26,7 +26,7 @@ void main() { group('CameraDescription tests', () { test('Constructor should initialize all properties', () { - const CameraDescription description = CameraDescription( + const description = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, @@ -40,13 +40,13 @@ void main() { }); test('equals should return true if objects are the same', () { - const CameraDescription firstDescription = CameraDescription( + const firstDescription = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, lensType: CameraLensType.ultraWide, ); - const CameraDescription secondDescription = CameraDescription( + const secondDescription = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, @@ -57,13 +57,13 @@ void main() { }); test('equals should return false if name is different', () { - const CameraDescription firstDescription = CameraDescription( + const firstDescription = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, lensType: CameraLensType.ultraWide, ); - const CameraDescription secondDescription = CameraDescription( + const secondDescription = CameraDescription( name: 'Testing', lensDirection: CameraLensDirection.front, sensorOrientation: 90, @@ -74,13 +74,13 @@ void main() { }); test('equals should return false if lens direction is different', () { - const CameraDescription firstDescription = CameraDescription( + const firstDescription = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, lensType: CameraLensType.ultraWide, ); - const CameraDescription secondDescription = CameraDescription( + const secondDescription = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.back, sensorOrientation: 90, @@ -91,13 +91,13 @@ void main() { }); test('equals should return true if sensor orientation is different', () { - const CameraDescription firstDescription = CameraDescription( + const firstDescription = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 0, lensType: CameraLensType.ultraWide, ); - const CameraDescription secondDescription = CameraDescription( + const secondDescription = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, @@ -110,7 +110,7 @@ void main() { test( 'hashCode should match hashCode of all equality-tested properties', () { - const CameraDescription description = CameraDescription( + const description = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 0, @@ -127,7 +127,7 @@ void main() { ); test('toString should return correct string representation', () { - const CameraDescription description = CameraDescription( + const description = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, diff --git a/packages/camera/camera_platform_interface/test/types/camera_exception_test.dart b/packages/camera/camera_platform_interface/test/types/camera_exception_test.dart index 295fc5d7602..5eea0a8697f 100644 --- a/packages/camera/camera_platform_interface/test/types/camera_exception_test.dart +++ b/packages/camera/camera_platform_interface/test/types/camera_exception_test.dart @@ -7,21 +7,21 @@ import 'package:flutter_test/flutter_test.dart'; void main() { test('constructor should initialize properties', () { - const String code = 'TEST_ERROR'; - const String description = 'This is a test error'; - final CameraException exception = CameraException(code, description); + const code = 'TEST_ERROR'; + const description = 'This is a test error'; + final exception = CameraException(code, description); expect(exception.code, code); expect(exception.description, description); }); test('toString: Should return a description of the exception', () { - const String code = 'TEST_ERROR'; - const String description = 'This is a test error'; - const String expected = 'CameraException($code, $description)'; - final CameraException exception = CameraException(code, description); + const code = 'TEST_ERROR'; + const description = 'This is a test error'; + const expected = 'CameraException($code, $description)'; + final exception = CameraException(code, description); - final String actual = exception.toString(); + final actual = exception.toString(); expect(actual, expected); }); diff --git a/packages/camera/camera_platform_interface/test/types/camera_image_data_test.dart b/packages/camera/camera_platform_interface/test/types/camera_image_data_test.dart index ea60b9b0f1a..b5b1f6610f5 100644 --- a/packages/camera/camera_platform_interface/test/types/camera_image_data_test.dart +++ b/packages/camera/camera_platform_interface/test/types/camera_image_data_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { test('CameraImageData can be created', () { debugDefaultTargetPlatformOverride = TargetPlatform.android; - final CameraImageData cameraImage = CameraImageData( + final cameraImage = CameraImageData( format: const CameraImageFormat(ImageFormatGroup.jpeg, raw: 42), height: 100, width: 200, diff --git a/packages/camera/camera_platform_interface/test/types/media_settings_test.dart b/packages/camera/camera_platform_interface/test/types/media_settings_test.dart index 4da938acc84..65f619b1673 100644 --- a/packages/camera/camera_platform_interface/test/types/media_settings_test.dart +++ b/packages/camera/camera_platform_interface/test/types/media_settings_test.dart @@ -11,7 +11,7 @@ void main() { test( 'MediaSettings non-parametrized constructor should have correct initial values', () { - const MediaSettings settingsWithNoParameters = MediaSettings(); + const settingsWithNoParameters = MediaSettings(); expect( settingsWithNoParameters.resolutionPreset, @@ -50,7 +50,7 @@ void main() { ); test('MediaSettings fps should hold parameters', () { - const MediaSettings settings = MediaSettings( + const settings = MediaSettings( resolutionPreset: ResolutionPreset.low, fps: 20, videoBitrate: 128000, @@ -91,7 +91,7 @@ void main() { }); test('MediaSettings hash should be Object.hash of passed parameters', () { - const MediaSettings settings = MediaSettings( + const settings = MediaSettings( resolutionPreset: ResolutionPreset.low, fps: 20, videoBitrate: 128000, @@ -109,10 +109,10 @@ void main() { group('MediaSettings == operator', () { const ResolutionPreset preset1 = ResolutionPreset.low; - const int fps1 = 20; - const int videoBitrate1 = 128000; - const int audioBitrate1 = 32000; - const bool enableAudio1 = true; + const fps1 = 20; + const videoBitrate1 = 128000; + const audioBitrate1 = 32000; + const enableAudio1 = true; const ResolutionPreset preset2 = ResolutionPreset.high; const int fps2 = fps1 + 10; @@ -120,7 +120,7 @@ void main() { const int audioBitrate2 = audioBitrate1 * 2; const bool enableAudio2 = !enableAudio1; - const MediaSettings settings1 = MediaSettings( + const settings1 = MediaSettings( resolutionPreset: ResolutionPreset.low, fps: 20, videoBitrate: 128000, @@ -129,7 +129,7 @@ void main() { ); test('should compare resolutionPreset', () { - const MediaSettings settings2 = MediaSettings( + const settings2 = MediaSettings( resolutionPreset: preset2, fps: fps1, videoBitrate: videoBitrate1, @@ -141,7 +141,7 @@ void main() { }); test('should compare fps', () { - const MediaSettings settings2 = MediaSettings( + const settings2 = MediaSettings( resolutionPreset: preset1, fps: fps2, videoBitrate: videoBitrate1, @@ -153,7 +153,7 @@ void main() { }); test('should compare videoBitrate', () { - const MediaSettings settings2 = MediaSettings( + const settings2 = MediaSettings( resolutionPreset: preset1, fps: fps1, videoBitrate: videoBitrate2, @@ -165,7 +165,7 @@ void main() { }); test('should compare audioBitrate', () { - const MediaSettings settings2 = MediaSettings( + const settings2 = MediaSettings( resolutionPreset: preset1, fps: fps1, videoBitrate: videoBitrate1, @@ -177,7 +177,7 @@ void main() { }); test('should compare enableAudio', () { - const MediaSettings settings2 = MediaSettings( + const settings2 = MediaSettings( resolutionPreset: preset1, fps: fps1, videoBitrate: videoBitrate1, @@ -190,7 +190,7 @@ void main() { }); test('should return true when all parameters are equal', () { - const MediaSettings sameSettings = MediaSettings( + const sameSettings = MediaSettings( resolutionPreset: preset1, fps: fps1, videoBitrate: videoBitrate1, @@ -202,7 +202,7 @@ void main() { }); test('Identical objects should be equal', () { - const MediaSettings settingsIdentical = settings1; + const settingsIdentical = settings1; expect( settings1 == settingsIdentical, diff --git a/packages/camera/camera_web/example/integration_test/camera_bitrate_test.dart b/packages/camera/camera_web/example/integration_test/camera_bitrate_test.dart index c6547ca28bf..8b939682d9f 100644 --- a/packages/camera/camera_web/example/integration_test/camera_bitrate_test.dart +++ b/packages/camera/camera_web/example/integration_test/camera_bitrate_test.dart @@ -20,21 +20,21 @@ import 'helpers/helpers.dart'; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - const Size videoSize = Size(320, 240); + const videoSize = Size(320, 240); /// Draw some seconds of random video frames on canvas in realtime. Future simulateCamera(HTMLCanvasElement canvasElement) async { - const int fps = 15; - const int seconds = 3; + const fps = 15; + const seconds = 3; const int frameDuration = 1000 ~/ fps; - final Random random = Random(0); + final random = Random(0); - for (int n = 0; n < fps * seconds; n++) { + for (var n = 0; n < fps * seconds; n++) { await Future.delayed(const Duration(milliseconds: frameDuration)); final int w = videoSize.width ~/ 20; final int h = videoSize.height ~/ 20; - for (int y = 0; y < videoSize.height; y += h) { - for (int x = 0; x < videoSize.width; x += w) { + for (var y = 0; y < videoSize.height; y += h) { + for (var x = 0; x < videoSize.width; x += w) { final int r = random.nextInt(255); final int g = random.nextInt(255); final int b = random.nextInt(255); @@ -49,36 +49,36 @@ void main() { WidgetTester tester, ) async { //const String supportedVideoType = 'video/webm'; - const String supportedVideoType = 'video/webm;codecs="vp9,opus"'; + const supportedVideoType = 'video/webm;codecs="vp9,opus"'; bool isVideoTypeSupported(String type) => type == supportedVideoType; Future recordVideo(int videoBitrate) async { - final MockWindow mockWindow = MockWindow(); - final MockNavigator mockNavigator = MockNavigator(); - final MockMediaDevices mockMediaDevices = MockMediaDevices(); + final mockWindow = MockWindow(); + final mockNavigator = MockNavigator(); + final mockMediaDevices = MockMediaDevices(); - final Window window = createJSInteropWrapper(mockWindow) as Window; - final Navigator navigator = + final window = createJSInteropWrapper(mockWindow) as Window; + final navigator = createJSInteropWrapper(mockNavigator) as Navigator; - final MediaDevices mediaDevices = + final mediaDevices = createJSInteropWrapper(mockMediaDevices) as MediaDevices; mockWindow.navigator = navigator; mockNavigator.mediaDevices = mediaDevices; - final HTMLCanvasElement canvasElement = HTMLCanvasElement() + final canvasElement = HTMLCanvasElement() ..width = videoSize.width.toInt() ..height = videoSize.height.toInt() ..context2D.clearRect(0, 0, videoSize.width, videoSize.height); - final HTMLVideoElement videoElement = HTMLVideoElement(); + final videoElement = HTMLVideoElement(); - final MockCameraService cameraService = MockCameraService(); + final cameraService = MockCameraService(); CameraPlatform.instance = CameraPlugin(cameraService: cameraService) ..window = window; - final CameraOptions options = CameraOptions( + final options = CameraOptions( audio: const AudioConstraints(), video: VideoConstraints( width: VideoSizeConstraint(ideal: videoSize.width.toInt()), @@ -86,13 +86,13 @@ void main() { ), ); - final int cameraId = videoBitrate; + final cameraId = videoBitrate; when( cameraService.getMediaStreamForOptions(options, cameraId: cameraId), ).thenAnswer((_) async => canvasElement.captureStream()); - final Camera camera = Camera( + final camera = Camera( textureId: cameraId, cameraService: cameraService, options: options, @@ -125,7 +125,7 @@ void main() { return length; } - const int kilobits = 1024; + const kilobits = 1024; const int megabits = kilobits * kilobits; final int lengthSmall = await recordVideo(500 * kilobits); diff --git a/packages/camera/camera_web/example/integration_test/camera_options_test.dart b/packages/camera/camera_web/example/integration_test/camera_options_test.dart index c6e5740f0cb..1c92bb74109 100644 --- a/packages/camera/camera_web/example/integration_test/camera_options_test.dart +++ b/packages/camera/camera_web/example/integration_test/camera_options_test.dart @@ -14,7 +14,7 @@ void main() { group('CameraOptions', () { testWidgets('serializes correctly', (WidgetTester tester) async { - final CameraOptions cameraOptions = CameraOptions( + final cameraOptions = CameraOptions( audio: const AudioConstraints(enabled: true), video: VideoConstraints( facingMode: FacingModeConstraint.exact(CameraType.user), @@ -90,7 +90,7 @@ void main() { group('VideoConstraints', () { testWidgets('serializes correctly', (WidgetTester tester) async { - final VideoConstraints videoConstraints = VideoConstraints( + final videoConstraints = VideoConstraints( facingMode: FacingModeConstraint.exact(CameraType.user), width: const VideoSizeConstraint(ideal: 100, maximum: 100), height: const VideoSizeConstraint(ideal: 50, maximum: 50), diff --git a/packages/camera/camera_web/example/integration_test/camera_service_test.dart b/packages/camera/camera_web/example/integration_test/camera_service_test.dart index 485fcac5508..fd18ec60225 100644 --- a/packages/camera/camera_web/example/integration_test/camera_service_test.dart +++ b/packages/camera/camera_web/example/integration_test/camera_service_test.dart @@ -23,7 +23,7 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('CameraService', () { - const int cameraId = 1; + const cameraId = 1; late MockWindow mockWindow; late MockNavigator mockNavigator; @@ -70,13 +70,13 @@ void main() { mockMediaDevices .getUserMedia = ([web.MediaStreamConstraints? constraints]) { capturedConstraints = constraints; - final web.MediaStream stream = + final stream = createJSInteropWrapper(FakeMediaStream([])) as web.MediaStream; return Future.value(stream).toJS; }.toJS; - final CameraOptions options = CameraOptions( + final options = CameraOptions( video: VideoConstraints( facingMode: FacingModeConstraint.exact(CameraType.user), width: const VideoSizeConstraint(ideal: 200), diff --git a/packages/camera/camera_web/example/integration_test/camera_test.dart b/packages/camera/camera_web/example/integration_test/camera_test.dart index 69e0e55c8d3..3ed087921f9 100644 --- a/packages/camera/camera_web/example/integration_test/camera_test.dart +++ b/packages/camera/camera_web/example/integration_test/camera_test.dart @@ -23,7 +23,7 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('Camera', () { - const int textureId = 1; + const textureId = 1; late MockWindow mockWindow; late MockNavigator mockNavigator; @@ -66,14 +66,14 @@ void main() { group('initialize', () { testWidgets('calls CameraService.getMediaStreamForOptions ' 'with provided options', (WidgetTester tester) async { - final CameraOptions options = CameraOptions( + final options = CameraOptions( video: VideoConstraints( facingMode: FacingModeConstraint.exact(CameraType.user), width: const VideoSizeConstraint(ideal: 200), ), ); - final Camera camera = Camera( + final camera = Camera( textureId: textureId, options: options, cameraService: cameraService, @@ -88,14 +88,14 @@ void main() { testWidgets('creates a video element ' 'with correct properties', (WidgetTester tester) async { - const AudioConstraints audioConstraints = AudioConstraints( + const audioConstraints = AudioConstraints( enabled: true, ); - final VideoConstraints videoConstraints = VideoConstraints( + final videoConstraints = VideoConstraints( facingMode: FacingModeConstraint(CameraType.user), ); - final Camera camera = Camera( + final camera = Camera( textureId: textureId, options: CameraOptions( audio: audioConstraints, @@ -127,11 +127,11 @@ void main() { testWidgets('flips the video element horizontally ' 'for a back camera', (WidgetTester tester) async { - final VideoConstraints videoConstraints = VideoConstraints( + final videoConstraints = VideoConstraints( facingMode: FacingModeConstraint(CameraType.environment), ); - final Camera camera = Camera( + final camera = Camera( textureId: textureId, options: CameraOptions(video: videoConstraints), cameraService: cameraService, @@ -144,7 +144,7 @@ void main() { testWidgets('creates a wrapping div element ' 'with correct properties', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -153,7 +153,7 @@ void main() { expect(camera.divElement, isNotNull); expect(camera.divElement.style.objectFit, equals('cover')); - final JSArray? array = + final array = (globalContext['Array']! as JSObject).callMethod( 'from'.toJS, camera.divElement.children, @@ -163,7 +163,7 @@ void main() { }); testWidgets('initializes the camera stream', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -177,7 +177,7 @@ void main() { 'when CameraService.getMediaStreamForOptions throws', ( WidgetTester tester, ) async { - final Exception exception = Exception( + final exception = Exception( 'A media stream exception occured.', ); @@ -188,7 +188,7 @@ void main() { ), ).thenThrow(exception); - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -201,9 +201,9 @@ void main() { testWidgets('starts playing the video element', ( WidgetTester tester, ) async { - bool startedPlaying = false; + var startedPlaying = false; - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -225,11 +225,11 @@ void main() { testWidgets('initializes the camera stream ' 'from CameraService.getMediaStreamForOptions ' 'if it does not exist', (WidgetTester tester) async { - const CameraOptions options = CameraOptions( + const options = CameraOptions( video: VideoConstraints(width: VideoSizeConstraint(ideal: 100)), ); - final Camera camera = Camera( + final camera = Camera( textureId: textureId, options: options, cameraService: cameraService, @@ -255,7 +255,7 @@ void main() { group('pause', () { testWidgets('pauses the camera stream', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -273,7 +273,7 @@ void main() { group('stop', () { testWidgets('resets the camera stream', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -290,7 +290,7 @@ void main() { group('takePicture', () { testWidgets('returns a captured picture', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -329,7 +329,7 @@ void main() { }); testWidgets('if the flash mode is auto', (WidgetTester tester) async { - final Camera camera = + final camera = Camera(textureId: textureId, cameraService: cameraService) ..window = window ..stream = videoStream @@ -338,7 +338,7 @@ void main() { await camera.play(); - final List capturedConstraints = + final capturedConstraints = []; mockVideoTrack.applyConstraints = ([MediaTrackConstraints? constraints]) { @@ -356,7 +356,7 @@ void main() { }); testWidgets('if the flash mode is always', (WidgetTester tester) async { - final Camera camera = + final camera = Camera(textureId: textureId, cameraService: cameraService) ..window = window ..stream = videoStream @@ -365,7 +365,7 @@ void main() { await camera.play(); - final List capturedConstraints = + final capturedConstraints = []; mockVideoTrack.applyConstraints = ([MediaTrackConstraints? constraints]) { @@ -389,14 +389,14 @@ void main() { 'based on the first video track settings', ( WidgetTester tester, ) async { - const Size videoSize = Size(1280, 720); + const videoSize = Size(1280, 720); final HTMLVideoElement videoElement = getVideoElementWithBlankStream( videoSize, ); mediaStream = videoElement.captureStream(); - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -409,10 +409,10 @@ void main() { testWidgets('returns Size.zero ' 'if the camera is missing video tracks', (WidgetTester tester) async { // Create a video stream with no video tracks. - final HTMLVideoElement videoElement = HTMLVideoElement(); + final videoElement = HTMLVideoElement(); mediaStream = videoElement.captureStream(); - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -456,7 +456,7 @@ void main() { return MediaTrackCapabilities(torch: [true.toJS].toJS); }.toJS; - final Camera camera = + final camera = Camera(textureId: textureId, cameraService: cameraService) ..window = window ..stream = videoStream; @@ -478,12 +478,12 @@ void main() { return MediaTrackCapabilities(torch: [true.toJS].toJS); }.toJS; - final Camera camera = + final camera = Camera(textureId: textureId, cameraService: cameraService) ..window = window ..stream = videoStream; - final List capturedConstraints = + final capturedConstraints = []; mockVideoTrack.applyConstraints = ([MediaTrackConstraints? constraints]) { @@ -509,12 +509,12 @@ void main() { return MediaTrackCapabilities(torch: [true.toJS].toJS); }.toJS; - final Camera camera = + final camera = Camera(textureId: textureId, cameraService: cameraService) ..window = window ..stream = videoStream; - final List capturedConstraints = + final capturedConstraints = []; mockVideoTrack.applyConstraints = ([MediaTrackConstraints? constraints]) { @@ -542,7 +542,7 @@ void main() { return MediaTrackCapabilities(torch: [true.toJS].toJS); }.toJS; - final Camera camera = + final camera = Camera(textureId: textureId, cameraService: cameraService) ..window = window ..stream = videoStream; @@ -576,7 +576,7 @@ void main() { return MediaTrackCapabilities(torch: [false.toJS].toJS); }.toJS; - final Camera camera = + final camera = Camera(textureId: textureId, cameraService: cameraService) ..window = window ..stream = videoStream; @@ -611,7 +611,7 @@ void main() { return MediaTrackCapabilities(torch: [true.toJS].toJS); }.toJS; - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, )..window = window; @@ -642,12 +642,12 @@ void main() { 'from CameraService.getZoomLevelCapabilityForCamera', ( WidgetTester tester, ) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); - final ZoomLevelCapability zoomLevelCapability = ZoomLevelCapability( + final zoomLevelCapability = ZoomLevelCapability( minimum: 50.0, maximum: 100.0, videoTrack: @@ -674,12 +674,12 @@ void main() { 'from CameraService.getZoomLevelCapabilityForCamera', ( WidgetTester tester, ) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); - final ZoomLevelCapability zoomLevelCapability = ZoomLevelCapability( + final zoomLevelCapability = ZoomLevelCapability( minimum: 50.0, maximum: 100.0, videoTrack: @@ -706,22 +706,22 @@ void main() { 'from CameraService.getZoomLevelCapabilityForCamera', ( WidgetTester tester, ) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); - final MockMediaStreamTrack mockVideoTrack = MockMediaStreamTrack(); - final MediaStreamTrack videoTrack = + final mockVideoTrack = MockMediaStreamTrack(); + final videoTrack = createJSInteropWrapper(mockVideoTrack) as MediaStreamTrack; - final ZoomLevelCapability zoomLevelCapability = ZoomLevelCapability( + final zoomLevelCapability = ZoomLevelCapability( minimum: 50.0, maximum: 100.0, videoTrack: videoTrack, ); - final List capturedConstraints = + final capturedConstraints = []; mockVideoTrack.applyConstraints = ([MediaTrackConstraints? constraints]) { @@ -735,7 +735,7 @@ void main() { cameraService.getZoomLevelCapabilityForCamera(camera), ).thenReturn(zoomLevelCapability); - const double zoom = 75.0; + const zoom = 75.0; camera.setZoomLevel(zoom); @@ -748,12 +748,12 @@ void main() { 'when the provided zoom level is below minimum', ( WidgetTester tester, ) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); - final ZoomLevelCapability zoomLevelCapability = ZoomLevelCapability( + final zoomLevelCapability = ZoomLevelCapability( minimum: 50.0, maximum: 100.0, videoTrack: @@ -787,12 +787,12 @@ void main() { 'when the provided zoom level is below minimum', ( WidgetTester tester, ) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); - final ZoomLevelCapability zoomLevelCapability = ZoomLevelCapability( + final zoomLevelCapability = ZoomLevelCapability( minimum: 50.0, maximum: 100.0, videoTrack: @@ -830,16 +830,16 @@ void main() { 'based on the first video track settings', ( WidgetTester tester, ) async { - final MockVideoElement mockVideoElement = MockVideoElement(); - final HTMLVideoElement videoElement = + final mockVideoElement = MockVideoElement(); + final videoElement = createJSInteropWrapper(mockVideoElement) as HTMLVideoElement; - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, )..videoElement = videoElement; - final MockMediaStreamTrack firstVideoTrack = MockMediaStreamTrack(); + final firstVideoTrack = MockMediaStreamTrack(); mockVideoElement.srcObject = createJSInteropWrapper( @@ -866,16 +866,16 @@ void main() { 'if the first video track is missing the facing mode', ( WidgetTester tester, ) async { - final MockVideoElement mockVideoElement = MockVideoElement(); - final HTMLVideoElement videoElement = + final mockVideoElement = MockVideoElement(); + final videoElement = createJSInteropWrapper(mockVideoElement) as HTMLVideoElement; - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, )..videoElement = videoElement; - final MockMediaStreamTrack firstVideoTrack = MockMediaStreamTrack(); + final firstVideoTrack = MockMediaStreamTrack(); videoElement.srcObject = createJSInteropWrapper( @@ -897,10 +897,10 @@ void main() { testWidgets('returns null ' 'if the camera is missing video tracks', (WidgetTester tester) async { // Create a video stream with no video tracks. - final HTMLVideoElement videoElement = HTMLVideoElement(); + final videoElement = HTMLVideoElement(); mediaStream = videoElement.captureStream(); - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -913,7 +913,7 @@ void main() { group('getViewType', () { testWidgets('returns a correct view type', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -928,7 +928,7 @@ void main() { }); group('video recording', () { - const String supportedVideoType = 'video/webm'; + const supportedVideoType = 'video/webm'; late MockMediaRecorder mockMediaRecorder; late MediaRecorder mediaRecorder; @@ -944,7 +944,7 @@ void main() { group('startVideoRecording', () { testWidgets('creates a media recorder ' 'with appropriate options', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: 1, cameraService: cameraService, )..isVideoTypeSupported = isVideoTypeSupported; @@ -964,7 +964,7 @@ void main() { testWidgets('listens to the media recorder data events', ( WidgetTester tester, ) async { - final Camera camera = + final camera = Camera(textureId: 1, cameraService: cameraService) ..mediaRecorder = mediaRecorder ..isVideoTypeSupported = isVideoTypeSupported; @@ -972,7 +972,7 @@ void main() { await camera.initialize(); await camera.play(); - final List capturedEvents = []; + final capturedEvents = []; mockMediaRecorder.addEventListener = (String type, EventListener? callback, [JSAny? options]) { capturedEvents.add(type); @@ -989,7 +989,7 @@ void main() { testWidgets('listens to the media recorder stop events', ( WidgetTester tester, ) async { - final Camera camera = + final camera = Camera(textureId: 1, cameraService: cameraService) ..mediaRecorder = mediaRecorder ..isVideoTypeSupported = isVideoTypeSupported; @@ -997,7 +997,7 @@ void main() { await camera.initialize(); await camera.play(); - final List capturedEvents = []; + final capturedEvents = []; mockMediaRecorder.addEventListener = (String type, EventListener? callback, [JSAny? options]) { capturedEvents.add(type); @@ -1009,7 +1009,7 @@ void main() { }); testWidgets('starts a video recording', (WidgetTester tester) async { - final Camera camera = + final camera = Camera(textureId: 1, cameraService: cameraService) ..mediaRecorder = mediaRecorder ..isVideoTypeSupported = isVideoTypeSupported; @@ -1017,7 +1017,7 @@ void main() { await camera.initialize(); await camera.play(); - final List capturedStarts = []; + final capturedStarts = []; mockMediaRecorder.start = ([int? timeslice]) { capturedStarts.add(timeslice); }.toJS; @@ -1030,7 +1030,7 @@ void main() { group('throws a CameraWebException', () { testWidgets('with notSupported error ' 'when no video types are supported', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: 1, cameraService: cameraService, )..isVideoTypeSupported = (String type) => false; @@ -1060,12 +1060,12 @@ void main() { group('pauseVideoRecording', () { testWidgets('pauses a video recording', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: 1, cameraService: cameraService, )..mediaRecorder = mediaRecorder; - int pauses = 0; + var pauses = 0; mockMediaRecorder.pause = () { pauses++; }.toJS; @@ -1080,7 +1080,7 @@ void main() { 'if the video recording was not started', ( WidgetTester tester, ) async { - final Camera camera = Camera( + final camera = Camera( textureId: 1, cameraService: cameraService, ); @@ -1106,12 +1106,12 @@ void main() { group('resumeVideoRecording', () { testWidgets('resumes a video recording', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: 1, cameraService: cameraService, )..mediaRecorder = mediaRecorder; - int resumes = 0; + var resumes = 0; mockMediaRecorder.resume = () { resumes++; }.toJS; @@ -1126,7 +1126,7 @@ void main() { 'if the video recording was not started', ( WidgetTester tester, ) async { - final Camera camera = Camera( + final camera = Camera( textureId: 1, cameraService: cameraService, ); @@ -1154,7 +1154,7 @@ void main() { testWidgets('stops a video recording and ' 'returns the captured file ' 'based on all video data parts', (WidgetTester tester) async { - final Camera camera = + final camera = Camera(textureId: 1, cameraService: cameraService) ..mediaRecorder = mediaRecorder ..isVideoTypeSupported = isVideoTypeSupported; @@ -1184,17 +1184,17 @@ void main() { await camera.startVideoRecording(); - int stops = 0; + var stops = 0; mockMediaRecorder.stop = () { stops++; }.toJS; final Future videoFileFuture = camera.stopVideoRecording(); - final Blob capturedVideoPartOne = Blob([].toJS); - final Blob capturedVideoPartTwo = Blob([].toJS); + final capturedVideoPartOne = Blob([].toJS); + final capturedVideoPartTwo = Blob([].toJS); - final List capturedVideoParts = [ + final capturedVideoParts = [ capturedVideoPartOne, capturedVideoPartTwo, ]; @@ -1230,7 +1230,7 @@ void main() { 'if the video recording was not started', ( WidgetTester tester, ) async { - final Camera camera = Camera( + final camera = Camera( textureId: 1, cameraService: cameraService, ); @@ -1269,7 +1269,7 @@ void main() { testWidgets('stops listening to the media recorder data events', ( WidgetTester tester, ) async { - final Camera camera = + final camera = Camera(textureId: 1, cameraService: cameraService) ..mediaRecorder = mediaRecorder ..isVideoTypeSupported = isVideoTypeSupported; @@ -1279,7 +1279,7 @@ void main() { await camera.startVideoRecording(); - final List capturedEvents = []; + final capturedEvents = []; mockMediaRecorder.removeEventListener = (String type, EventListener? callback, [JSAny? options]) { capturedEvents.add(type); @@ -1298,7 +1298,7 @@ void main() { testWidgets('stops listening to the media recorder stop events', ( WidgetTester tester, ) async { - final Camera camera = + final camera = Camera(textureId: 1, cameraService: cameraService) ..mediaRecorder = mediaRecorder ..isVideoTypeSupported = isVideoTypeSupported; @@ -1308,7 +1308,7 @@ void main() { await camera.startVideoRecording(); - final List capturedEvents = []; + final capturedEvents = []; mockMediaRecorder.removeEventListener = (String type, EventListener? callback, [JSAny? options]) { capturedEvents.add(type); @@ -1324,12 +1324,12 @@ void main() { testWidgets('stops listening to the media recorder errors', ( WidgetTester tester, ) async { - final StreamController onErrorStreamController = + final onErrorStreamController = StreamController(); - final MockEventStreamProvider provider = + final provider = MockEventStreamProvider(); - final Camera camera = + final camera = Camera(textureId: 1, cameraService: cameraService) ..mediaRecorder = mediaRecorder ..isVideoTypeSupported = isVideoTypeSupported @@ -1357,7 +1357,7 @@ void main() { testWidgets("resets the video element's source", ( WidgetTester tester, ) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -1369,7 +1369,7 @@ void main() { }); testWidgets('closes the onEnded stream', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -1383,7 +1383,7 @@ void main() { testWidgets('closes the onVideoRecordedEvent stream', ( WidgetTester tester, ) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -1397,7 +1397,7 @@ void main() { testWidgets('closes the onVideoRecordingError stream', ( WidgetTester tester, ) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); @@ -1413,13 +1413,13 @@ void main() { group('onVideoRecordedEvent', () { testWidgets('emits a VideoRecordedEvent ' 'when a video recording is created', (WidgetTester tester) async { - const String supportedVideoType = 'video/webm'; + const supportedVideoType = 'video/webm'; - final MockMediaRecorder mockMediaRecorder = MockMediaRecorder(); - final MediaRecorder mediaRecorder = + final mockMediaRecorder = MockMediaRecorder(); + final mediaRecorder = createJSInteropWrapper(mockMediaRecorder) as MediaRecorder; - final Camera camera = + final camera = Camera(textureId: 1, cameraService: cameraService) ..mediaRecorder = mediaRecorder ..isVideoTypeSupported = (String type) => type == 'video/webm'; @@ -1439,7 +1439,7 @@ void main() { } }.toJS; - final StreamQueue streamQueue = + final streamQueue = StreamQueue(camera.onVideoRecordedEvent); await camera.startVideoRecording(); @@ -1490,12 +1490,12 @@ void main() { group('onEnded', () { testWidgets('emits the default video track ' 'when it emits an ended event', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(camera.onEnded); await camera.initialize(); @@ -1514,12 +1514,12 @@ void main() { testWidgets('emits the default video track ' 'when the camera is stopped', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: cameraService, ); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(camera.onEnded); await camera.initialize(); @@ -1541,15 +1541,15 @@ void main() { testWidgets('emits an ErrorEvent ' 'when the media recorder fails ' 'when recording a video', (WidgetTester tester) async { - final MockMediaRecorder mockMediaRecorder = MockMediaRecorder(); - final MediaRecorder mediaRecorder = + final mockMediaRecorder = MockMediaRecorder(); + final mediaRecorder = createJSInteropWrapper(mockMediaRecorder) as MediaRecorder; - final StreamController errorController = + final errorController = StreamController(); - final MockEventStreamProvider provider = + final provider = MockEventStreamProvider(); - final Camera camera = + final camera = Camera(textureId: textureId, cameraService: cameraService) ..mediaRecorder = mediaRecorder ..mediaRecorderOnErrorProvider = provider; @@ -1558,7 +1558,7 @@ void main() { provider.forTarget(mediaRecorder), ).thenAnswer((_) => errorController.stream); - final StreamQueue streamQueue = StreamQueue( + final streamQueue = StreamQueue( camera.onVideoRecordingError, ); @@ -1567,7 +1567,7 @@ void main() { await camera.startVideoRecording(); - final ErrorEvent errorEvent = ErrorEvent('type'); + final errorEvent = ErrorEvent('type'); errorController.add(errorEvent); expect(await streamQueue.next, equals(errorEvent)); diff --git a/packages/camera/camera_web/example/integration_test/camera_web_exception_test.dart b/packages/camera/camera_web/example/integration_test/camera_web_exception_test.dart index 7ae645f164e..81226b94355 100644 --- a/packages/camera/camera_web/example/integration_test/camera_web_exception_test.dart +++ b/packages/camera/camera_web/example/integration_test/camera_web_exception_test.dart @@ -12,11 +12,11 @@ void main() { group('CameraWebException', () { testWidgets('sets all properties', (WidgetTester tester) async { - const int cameraId = 1; + const cameraId = 1; const CameraErrorCode code = CameraErrorCode.notFound; - const String description = 'The camera is not found.'; + const description = 'The camera is not found.'; - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, code, description, @@ -30,11 +30,11 @@ void main() { testWidgets('toString includes all properties', ( WidgetTester tester, ) async { - const int cameraId = 2; + const cameraId = 2; const CameraErrorCode code = CameraErrorCode.notReadable; - const String description = 'The camera is not readable.'; + const description = 'The camera is not readable.'; - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, code, description, diff --git a/packages/camera/camera_web/example/integration_test/camera_web_test.dart b/packages/camera/camera_web/example/integration_test/camera_web_test.dart index 78e2f24dc5a..970d9741bb2 100644 --- a/packages/camera/camera_web/example/integration_test/camera_web_test.dart +++ b/packages/camera/camera_web/example/integration_test/camera_web_test.dart @@ -27,7 +27,7 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('CameraPlugin', () { - const int cameraId = 1; + const cameraId = 1; late MockWindow mockWindow; late MockNavigator mockNavigator; @@ -127,11 +127,11 @@ void main() { testWidgets('releases the camera stream ' 'used to request video permissions', (WidgetTester tester) async { - final MockMediaStreamTrack mockVideoTrack = MockMediaStreamTrack(); - final MediaStreamTrack videoTrack = + final mockVideoTrack = MockMediaStreamTrack(); + final videoTrack = createJSInteropWrapper(mockVideoTrack) as MediaStreamTrack; - bool videoTrackStopped = false; + var videoTrackStopped = false; mockVideoTrack.stop = () { videoTrackStopped = true; }.toJS; @@ -155,7 +155,7 @@ void main() { testWidgets('gets a video stream ' 'for a video input device', (WidgetTester tester) async { - final MediaDeviceInfo videoDevice = + final videoDevice = createJSInteropWrapper( FakeMediaDeviceInfo( '1', @@ -186,7 +186,7 @@ void main() { testWidgets('does not get a video stream ' 'for the video input device ' 'with an empty device id', (WidgetTester tester) async { - final MediaDeviceInfo videoDevice = + final videoDevice = createJSInteropWrapper( FakeMediaDeviceInfo( '', @@ -217,7 +217,7 @@ void main() { testWidgets('gets the facing mode ' 'from the first available video track ' 'of the video input device', (WidgetTester tester) async { - final MediaDeviceInfo videoDevice = + final videoDevice = createJSInteropWrapper( FakeMediaDeviceInfo( '1', @@ -227,7 +227,7 @@ void main() { ) as MediaDeviceInfo; - final MediaStream videoStream = + final videoStream = createJSInteropWrapper( FakeMediaStream([ createJSInteropWrapper(MockMediaStreamTrack()) @@ -265,7 +265,7 @@ void main() { testWidgets('returns appropriate camera descriptions ' 'for multiple video devices ' 'based on video streams', (WidgetTester tester) async { - final MediaDeviceInfo firstVideoDevice = + final firstVideoDevice = createJSInteropWrapper( FakeMediaDeviceInfo( '1', @@ -275,7 +275,7 @@ void main() { ) as MediaDeviceInfo; - final MediaDeviceInfo secondVideoDevice = + final secondVideoDevice = createJSInteropWrapper( FakeMediaDeviceInfo( '4', @@ -286,7 +286,7 @@ void main() { as MediaDeviceInfo; // Create a video stream for the first video device. - final MediaStream firstVideoStream = + final firstVideoStream = createJSInteropWrapper( FakeMediaStream([ createJSInteropWrapper(MockMediaStreamTrack()) @@ -298,7 +298,7 @@ void main() { as MediaStream; // Create a video stream for the second video device. - final MediaStream secondVideoStream = + final secondVideoStream = createJSInteropWrapper( FakeMediaStream([ createJSInteropWrapper(MockMediaStreamTrack()) @@ -401,7 +401,7 @@ void main() { testWidgets('sets camera metadata ' 'for the camera description', (WidgetTester tester) async { - final MediaDeviceInfo videoDevice = + final videoDevice = createJSInteropWrapper( FakeMediaDeviceInfo( '1', @@ -411,7 +411,7 @@ void main() { ) as MediaDeviceInfo; - final MediaStream videoStream = + final videoStream = createJSInteropWrapper( FakeMediaStream([ createJSInteropWrapper(MockMediaStreamTrack()) @@ -462,7 +462,7 @@ void main() { testWidgets('releases the video stream ' 'of a video input device', (WidgetTester tester) async { - final MediaDeviceInfo videoDevice = + final videoDevice = createJSInteropWrapper( FakeMediaDeviceInfo( '1', @@ -472,17 +472,17 @@ void main() { ) as MediaDeviceInfo; - final List tracks = []; - final List stops = List.generate(2, (_) => false); - for (int i = 0; i < stops.length; i++) { - final MockMediaStreamTrack track = MockMediaStreamTrack(); + final tracks = []; + final stops = List.generate(2, (_) => false); + for (var i = 0; i < stops.length; i++) { + final track = MockMediaStreamTrack(); track.stop = () { stops[i] = true; }.toJS; tracks.add(createJSInteropWrapper(track) as MediaStreamTrack); } - final MediaStream videoStream = + final videoStream = createJSInteropWrapper(FakeMediaStream(tracks)) as MediaStream; mockMediaDevices.enumerateDevices = () { @@ -509,7 +509,7 @@ void main() { testWidgets('when MediaDevices.enumerateDevices throws DomException', ( WidgetTester tester, ) async { - final DOMException exception = DOMException('UnknownError'); + final exception = DOMException('UnknownError'); mockMediaDevices.enumerateDevices = () { throw exception; @@ -533,7 +533,7 @@ void main() { testWidgets('when CameraService.getMediaStreamForOptions ' 'throws CameraWebException', (WidgetTester tester) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.security, 'description', @@ -557,7 +557,7 @@ void main() { testWidgets('when CameraService.getMediaStreamForOptions ' 'throws PlatformException', (WidgetTester tester) async { - final PlatformException exception = PlatformException( + final exception = PlatformException( code: CameraErrorCode.notSupported.toString(), message: 'message', ); @@ -582,16 +582,16 @@ void main() { group('createCamera', () { group('creates a camera', () { - const Size ultraHighResolutionSize = Size(3840, 2160); - const Size maxResolutionSize = Size(3840, 2160); + const ultraHighResolutionSize = Size(3840, 2160); + const maxResolutionSize = Size(3840, 2160); - const CameraDescription cameraDescription = CameraDescription( + const cameraDescription = CameraDescription( name: 'name', lensDirection: CameraLensDirection.front, sensorOrientation: 0, ); - const CameraMetadata cameraMetadata = CameraMetadata( + const cameraMetadata = CameraMetadata( deviceId: 'deviceId', facingMode: 'user', ); @@ -824,9 +824,9 @@ void main() { when(camera.videoElement).thenReturn(videoElement); - final MockEventStreamProvider errorProvider = + final errorProvider = MockEventStreamProvider(); - final MockEventStreamProvider abortProvider = + final abortProvider = MockEventStreamProvider(); (CameraPlatform.instance as CameraPlugin).videoElementOnErrorProvider = @@ -903,7 +903,7 @@ void main() { testWidgets('when camera throws CameraWebException', ( WidgetTester tester, ) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.permissionDenied, 'description', @@ -929,7 +929,7 @@ void main() { testWidgets('when camera throws DomException', ( WidgetTester tester, ) async { - final DOMException exception = DOMException('NotAllowedError'); + final exception = DOMException('NotAllowedError'); when(camera.initialize()).thenAnswer((_) => Future.value()); when(camera.play()).thenThrow(exception); @@ -960,7 +960,7 @@ void main() { testWidgets('requests full-screen mode ' 'on documentElement', (WidgetTester tester) async { - int fullscreenCalls = 0; + var fullscreenCalls = 0; mockDocumentElement.requestFullscreen = ([FullscreenOptions? options]) { fullscreenCalls++; return Future.value().toJS; @@ -982,7 +982,7 @@ void main() { ), ).thenReturn(OrientationType.landscapeSecondary); - final List capturedTypes = []; + final capturedTypes = []; mockScreenOrientation.lock = (OrientationLockType orientation) { capturedTypes.add(orientation); return Future.value().toJS; @@ -1030,7 +1030,7 @@ void main() { testWidgets('when lock throws DomException', ( WidgetTester tester, ) async { - final DOMException exception = DOMException('NotAllowedError'); + final exception = DOMException('NotAllowedError'); mockScreenOrientation.lock = (OrientationLockType orientation) { throw exception; @@ -1065,7 +1065,7 @@ void main() { testWidgets('unlocks the capture orientation', ( WidgetTester tester, ) async { - int unlocks = 0; + var unlocks = 0; mockScreenOrientation.unlock = () { unlocks++; }.toJS; @@ -1099,7 +1099,7 @@ void main() { testWidgets('when unlock throws DomException', ( WidgetTester tester, ) async { - final DOMException exception = DOMException('NotAllowedError'); + final exception = DOMException('NotAllowedError'); mockScreenOrientation.unlock = () { throw exception; @@ -1123,8 +1123,8 @@ void main() { group('takePicture', () { testWidgets('captures a picture', (WidgetTester tester) async { - final MockCamera camera = MockCamera(); - final XFile capturedPicture = XFile('/bogus/test'); + final camera = MockCamera(); + final capturedPicture = XFile('/bogus/test'); when(camera.takePicture()).thenAnswer((_) async => capturedPicture); @@ -1158,8 +1158,8 @@ void main() { testWidgets('when takePicture throws DomException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final DOMException exception = DOMException('NotSupportedError'); + final camera = MockCamera(); + final exception = DOMException('NotSupportedError'); when(camera.takePicture()).thenThrow(exception); @@ -1181,8 +1181,8 @@ void main() { testWidgets('when takePicture throws CameraWebException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final CameraWebException exception = CameraWebException( + final camera = MockCamera(); + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -1232,7 +1232,7 @@ void main() { testWidgets('listens to the onVideoRecordingError stream', ( WidgetTester tester, ) async { - final StreamController videoRecordingErrorController = + final videoRecordingErrorController = StreamController(); when( @@ -1265,7 +1265,7 @@ void main() { testWidgets('when startVideoRecording throws DomException', ( WidgetTester tester, ) async { - final DOMException exception = DOMException('InvalidStateError'); + final exception = DOMException('InvalidStateError'); when(camera.startVideoRecording()).thenThrow(exception); @@ -1287,7 +1287,7 @@ void main() { testWidgets('when startVideoRecording throws CameraWebException', ( WidgetTester tester, ) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -1343,8 +1343,8 @@ void main() { group('stopVideoRecording', () { testWidgets('stops a video recording', (WidgetTester tester) async { - final MockCamera camera = MockCamera(); - final XFile capturedVideo = XFile('/bogus/test'); + final camera = MockCamera(); + final capturedVideo = XFile('/bogus/test'); when( camera.stopVideoRecording(), @@ -1365,10 +1365,10 @@ void main() { testWidgets('stops listening to the onVideoRecordingError stream', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final StreamController videoRecordingErrorController = + final camera = MockCamera(); + final videoRecordingErrorController = StreamController(); - final XFile capturedVideo = XFile('/bogus/test'); + final capturedVideo = XFile('/bogus/test'); when(camera.startVideoRecording()).thenAnswer((_) async {}); @@ -1409,8 +1409,8 @@ void main() { testWidgets('when stopVideoRecording throws DomException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final DOMException exception = DOMException('InvalidStateError'); + final camera = MockCamera(); + final exception = DOMException('InvalidStateError'); when(camera.stopVideoRecording()).thenThrow(exception); @@ -1432,8 +1432,8 @@ void main() { testWidgets('when stopVideoRecording throws CameraWebException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final CameraWebException exception = CameraWebException( + final camera = MockCamera(); + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -1460,7 +1460,7 @@ void main() { group('pauseVideoRecording', () { testWidgets('pauses a video recording', (WidgetTester tester) async { - final MockCamera camera = MockCamera(); + final camera = MockCamera(); when(camera.pauseVideoRecording()).thenAnswer((_) async {}); @@ -1490,8 +1490,8 @@ void main() { testWidgets('when pauseVideoRecording throws DomException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final DOMException exception = DOMException('InvalidStateError'); + final camera = MockCamera(); + final exception = DOMException('InvalidStateError'); when(camera.pauseVideoRecording()).thenThrow(exception); @@ -1513,8 +1513,8 @@ void main() { testWidgets('when pauseVideoRecording throws CameraWebException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final CameraWebException exception = CameraWebException( + final camera = MockCamera(); + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -1541,7 +1541,7 @@ void main() { group('resumeVideoRecording', () { testWidgets('resumes a video recording', (WidgetTester tester) async { - final MockCamera camera = MockCamera(); + final camera = MockCamera(); when(camera.resumeVideoRecording()).thenAnswer((_) async {}); @@ -1571,8 +1571,8 @@ void main() { testWidgets('when resumeVideoRecording throws DomException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final DOMException exception = DOMException('InvalidStateError'); + final camera = MockCamera(); + final exception = DOMException('InvalidStateError'); when(camera.resumeVideoRecording()).thenThrow(exception); @@ -1594,8 +1594,8 @@ void main() { testWidgets('when resumeVideoRecording throws CameraWebException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final CameraWebException exception = CameraWebException( + final camera = MockCamera(); + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -1624,7 +1624,7 @@ void main() { testWidgets('calls setFlashMode on the camera', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); + final camera = MockCamera(); const FlashMode flashMode = FlashMode.always; // Save the camera in the camera plugin. @@ -1656,8 +1656,8 @@ void main() { testWidgets('when setFlashMode throws DomException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final DOMException exception = DOMException('NotSupportedError'); + final camera = MockCamera(); + final exception = DOMException('NotSupportedError'); when(camera.setFlashMode(any)).thenThrow(exception); @@ -1682,8 +1682,8 @@ void main() { testWidgets('when setFlashMode throws CameraWebException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final CameraWebException exception = CameraWebException( + final camera = MockCamera(); + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -1794,8 +1794,8 @@ void main() { testWidgets('calls getMaxZoomLevel on the camera', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - const double maximumZoomLevel = 100.0; + final camera = MockCamera(); + const maximumZoomLevel = 100.0; when(camera.getMaxZoomLevel()).thenReturn(maximumZoomLevel); @@ -1828,8 +1828,8 @@ void main() { testWidgets('when getMaxZoomLevel throws DomException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final DOMException exception = DOMException('NotSupportedError'); + final camera = MockCamera(); + final exception = DOMException('NotSupportedError'); when(camera.getMaxZoomLevel()).thenThrow(exception); @@ -1851,8 +1851,8 @@ void main() { testWidgets('when getMaxZoomLevel throws CameraWebException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final CameraWebException exception = CameraWebException( + final camera = MockCamera(); + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -1881,8 +1881,8 @@ void main() { testWidgets('calls getMinZoomLevel on the camera', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - const double minimumZoomLevel = 100.0; + final camera = MockCamera(); + const minimumZoomLevel = 100.0; when(camera.getMinZoomLevel()).thenReturn(minimumZoomLevel); @@ -1915,8 +1915,8 @@ void main() { testWidgets('when getMinZoomLevel throws DomException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final DOMException exception = DOMException('NotSupportedError'); + final camera = MockCamera(); + final exception = DOMException('NotSupportedError'); when(camera.getMinZoomLevel()).thenThrow(exception); @@ -1938,8 +1938,8 @@ void main() { testWidgets('when getMinZoomLevel throws CameraWebException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final CameraWebException exception = CameraWebException( + final camera = MockCamera(); + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -1968,12 +1968,12 @@ void main() { testWidgets('calls setZoomLevel on the camera', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); + final camera = MockCamera(); // Save the camera in the camera plugin. (CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera; - const double zoom = 100.0; + const zoom = 100.0; await CameraPlatform.instance.setZoomLevel(cameraId, zoom); @@ -1998,8 +1998,8 @@ void main() { testWidgets('when setZoomLevel throws DomException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final DOMException exception = DOMException('NotSupportedError'); + final camera = MockCamera(); + final exception = DOMException('NotSupportedError'); when(camera.setZoomLevel(any)).thenThrow(exception); @@ -2021,8 +2021,8 @@ void main() { testWidgets('when setZoomLevel throws PlatformException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final PlatformException exception = PlatformException( + final camera = MockCamera(); + final exception = PlatformException( code: CameraErrorCode.notSupported.toString(), message: 'message', ); @@ -2047,8 +2047,8 @@ void main() { testWidgets('when setZoomLevel throws CameraWebException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final CameraWebException exception = CameraWebException( + final camera = MockCamera(); + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -2075,7 +2075,7 @@ void main() { group('pausePreview', () { testWidgets('calls pause on the camera', (WidgetTester tester) async { - final MockCamera camera = MockCamera(); + final camera = MockCamera(); // Save the camera in the camera plugin. (CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera; @@ -2103,8 +2103,8 @@ void main() { testWidgets('when pause throws DomException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final DOMException exception = DOMException('NotSupportedError'); + final camera = MockCamera(); + final exception = DOMException('NotSupportedError'); when(camera.pause()).thenThrow(exception); @@ -2127,7 +2127,7 @@ void main() { group('resumePreview', () { testWidgets('calls play on the camera', (WidgetTester tester) async { - final MockCamera camera = MockCamera(); + final camera = MockCamera(); when(camera.play()).thenAnswer((_) async {}); @@ -2157,8 +2157,8 @@ void main() { testWidgets('when play throws DomException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final DOMException exception = DOMException('NotSupportedError'); + final camera = MockCamera(); + final exception = DOMException('NotSupportedError'); when(camera.play()).thenThrow(exception); @@ -2180,8 +2180,8 @@ void main() { testWidgets('when play throws CameraWebException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final CameraWebException exception = CameraWebException( + final camera = MockCamera(); + final exception = CameraWebException( cameraId, CameraErrorCode.unknown, 'description', @@ -2208,7 +2208,7 @@ void main() { testWidgets('buildPreview returns an HtmlElementView ' 'with an appropriate view type', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: cameraId, cameraService: cameraService, ); @@ -2253,9 +2253,9 @@ void main() { when(camera.videoElement).thenReturn(videoElement); - final MockEventStreamProvider errorProvider = + final errorProvider = MockEventStreamProvider(); - final MockEventStreamProvider abortProvider = + final abortProvider = MockEventStreamProvider(); (CameraPlatform.instance as CameraPlugin).videoElementOnErrorProvider = @@ -2280,11 +2280,11 @@ void main() { }); testWidgets('disposes the correct camera', (WidgetTester tester) async { - const int firstCameraId = 0; - const int secondCameraId = 1; + const firstCameraId = 0; + const secondCameraId = 1; - final MockCamera firstCamera = MockCamera(); - final MockCamera secondCamera = MockCamera(); + final firstCamera = MockCamera(); + final secondCamera = MockCamera(); when(firstCamera.dispose()).thenAnswer((_) => Future.value()); when(secondCamera.dispose()).thenAnswer((_) => Future.value()); @@ -2365,8 +2365,8 @@ void main() { testWidgets('when dispose throws DomException', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final DOMException exception = DOMException('InvalidAccessError'); + final camera = MockCamera(); + final exception = DOMException('InvalidAccessError'); when(camera.dispose()).thenThrow(exception); @@ -2389,7 +2389,7 @@ void main() { group('getCamera', () { testWidgets('returns the correct camera', (WidgetTester tester) async { - final Camera camera = Camera( + final camera = Camera( textureId: cameraId, cameraService: cameraService, ); @@ -2445,9 +2445,9 @@ void main() { when(camera.videoElement).thenReturn(videoElement); - final MockEventStreamProvider errorProvider = + final errorProvider = MockEventStreamProvider(); - final MockEventStreamProvider abortProvider = + final abortProvider = MockEventStreamProvider(); (CameraPlatform.instance as CameraPlugin).videoElementOnErrorProvider = @@ -2474,7 +2474,7 @@ void main() { testWidgets('onCameraInitialized emits a CameraInitializedEvent ' 'on initializeCamera', (WidgetTester tester) async { // Mock the camera to use a blank video stream of size 1280x720. - const Size videoSize = Size(1280, 720); + const videoSize = Size(1280, 720); videoElement = getVideoElementWithBlankStream(videoSize); @@ -2482,7 +2482,7 @@ void main() { cameraService.getMediaStreamForOptions(any, cameraId: cameraId), ).thenAnswer((_) async => videoElement.captureStream()); - final Camera camera = Camera( + final camera = Camera( textureId: cameraId, cameraService: cameraService, ); @@ -2494,7 +2494,7 @@ void main() { .instance .onCameraInitialized(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); await CameraPlatform.instance.initializeCamera(cameraId); @@ -2534,7 +2534,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraClosing(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); await CameraPlatform.instance.initializeCamera(cameraId); @@ -2563,12 +2563,12 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); await CameraPlatform.instance.initializeCamera(cameraId); - final MediaError error = + final error = createJSInteropWrapper( FakeMediaError( MediaError.MEDIA_ERR_NETWORK, @@ -2603,12 +2603,12 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); await CameraPlatform.instance.initializeCamera(cameraId); - final MediaError error = + final error = createJSInteropWrapper( FakeMediaError(MediaError.MEDIA_ERR_NETWORK), ) @@ -2638,7 +2638,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); await CameraPlatform.instance.initializeCamera(cameraId); @@ -2660,7 +2660,7 @@ void main() { testWidgets('emits a CameraErrorEvent ' 'on takePicture error', (WidgetTester tester) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -2671,7 +2671,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( @@ -2694,7 +2694,7 @@ void main() { testWidgets('emits a CameraErrorEvent ' 'on setFlashMode error', (WidgetTester tester) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -2705,7 +2705,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( @@ -2731,7 +2731,7 @@ void main() { testWidgets('emits a CameraErrorEvent ' 'on getMaxZoomLevel error', (WidgetTester tester) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.zoomLevelNotSupported, 'description', @@ -2742,7 +2742,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( @@ -2765,7 +2765,7 @@ void main() { testWidgets('emits a CameraErrorEvent ' 'on getMinZoomLevel error', (WidgetTester tester) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.zoomLevelNotSupported, 'description', @@ -2776,7 +2776,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( @@ -2799,7 +2799,7 @@ void main() { testWidgets('emits a CameraErrorEvent ' 'on setZoomLevel error', (WidgetTester tester) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.zoomLevelNotSupported, 'description', @@ -2810,7 +2810,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( @@ -2833,7 +2833,7 @@ void main() { testWidgets('emits a CameraErrorEvent ' 'on resumePreview error', (WidgetTester tester) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.unknown, 'description', @@ -2844,7 +2844,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( @@ -2867,7 +2867,7 @@ void main() { testWidgets('emits a CameraErrorEvent ' 'on startVideoRecording error', (WidgetTester tester) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -2882,7 +2882,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( @@ -2910,13 +2910,13 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); await CameraPlatform.instance.initializeCamera(cameraId); await CameraPlatform.instance.startVideoRecording(cameraId); - final ErrorEvent errorEvent = + final errorEvent = createJSInteropWrapper(FakeErrorEvent('type', 'message')) as ErrorEvent; @@ -2937,7 +2937,7 @@ void main() { testWidgets('emits a CameraErrorEvent ' 'on stopVideoRecording error', (WidgetTester tester) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -2948,7 +2948,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( @@ -2971,7 +2971,7 @@ void main() { testWidgets('emits a CameraErrorEvent ' 'on pauseVideoRecording error', (WidgetTester tester) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -2982,7 +2982,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( @@ -3005,7 +3005,7 @@ void main() { testWidgets('emits a CameraErrorEvent ' 'on resumeVideoRecording error', (WidgetTester tester) async { - final CameraWebException exception = CameraWebException( + final exception = CameraWebException( cameraId, CameraErrorCode.notStarted, 'description', @@ -3016,7 +3016,7 @@ void main() { final Stream eventStream = CameraPlatform.instance .onCameraError(cameraId); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( @@ -3041,9 +3041,9 @@ void main() { testWidgets('onVideoRecordedEvent emits a VideoRecordedEvent', ( WidgetTester tester, ) async { - final MockCamera camera = MockCamera(); - final XFile capturedVideo = XFile('/bogus/test'); - final Stream stream = + final camera = MockCamera(); + final capturedVideo = XFile('/bogus/test'); + final stream = Stream.value( VideoRecordedEvent(cameraId, capturedVideo, Duration.zero), ); @@ -3052,7 +3052,7 @@ void main() { // Save the camera in the camera plugin. (CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera; - final StreamQueue streamQueue = + final streamQueue = StreamQueue( CameraPlatform.instance.onVideoRecordedEvent(cameraId), ); @@ -3064,11 +3064,11 @@ void main() { }); group('onDeviceOrientationChanged', () { - final StreamController eventStreamController = + final eventStreamController = StreamController(); setUp(() { - final MockEventStreamProvider provider = + final provider = MockEventStreamProvider(); (CameraPlatform.instance as CameraPlugin) .orientationOnChangeProvider = @@ -3093,7 +3093,7 @@ void main() { final Stream eventStream = CameraPlatform.instance.onDeviceOrientationChanged(); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( @@ -3125,7 +3125,7 @@ void main() { final Stream eventStream = CameraPlatform.instance.onDeviceOrientationChanged(); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); // Change the screen orientation to landscapePrimary and diff --git a/packages/camera/camera_web/example/integration_test/helpers/mocks.dart b/packages/camera/camera_web/example/integration_test/helpers/mocks.dart index 5bb6d11dfb4..8e191dc9122 100644 --- a/packages/camera/camera_web/example/integration_test/helpers/mocks.dart +++ b/packages/camera/camera_web/example/integration_test/helpers/mocks.dart @@ -245,12 +245,12 @@ class FakeErrorEvent { /// final videoStream = videoElement.captureStream(); /// ``` web.HTMLVideoElement getVideoElementWithBlankStream(Size videoSize) { - final web.HTMLCanvasElement canvasElement = web.HTMLCanvasElement() + final canvasElement = web.HTMLCanvasElement() ..width = videoSize.width.toInt() ..height = videoSize.height.toInt() ..context2D.fillRect(0, 0, videoSize.width, videoSize.height); - final web.HTMLVideoElement videoElement = web.HTMLVideoElement() + final videoElement = web.HTMLVideoElement() ..srcObject = canvasElement.captureStream(); return videoElement; diff --git a/packages/camera/camera_web/example/integration_test/zoom_level_capability_test.dart b/packages/camera/camera_web/example/integration_test/zoom_level_capability_test.dart index 8ee05b05943..dc938d40c3a 100644 --- a/packages/camera/camera_web/example/integration_test/zoom_level_capability_test.dart +++ b/packages/camera/camera_web/example/integration_test/zoom_level_capability_test.dart @@ -17,12 +17,12 @@ void main() { group('ZoomLevelCapability', () { testWidgets('sets all properties', (WidgetTester tester) async { - const double minimum = 100.0; - const double maximum = 400.0; - final MediaStreamTrack videoTrack = + const minimum = 100.0; + const maximum = 400.0; + final videoTrack = createJSInteropWrapper(MockMediaStreamTrack()) as MediaStreamTrack; - final ZoomLevelCapability capability = ZoomLevelCapability( + final capability = ZoomLevelCapability( minimum: minimum, maximum: maximum, videoTrack: videoTrack, @@ -34,7 +34,7 @@ void main() { }); testWidgets('supports value equality', (WidgetTester tester) async { - final MediaStreamTrack videoTrack = + final videoTrack = createJSInteropWrapper(MockMediaStreamTrack()) as MediaStreamTrack; expect( diff --git a/packages/camera/camera_web/lib/src/camera.dart b/packages/camera/camera_web/lib/src/camera.dart index bbfe18b491f..108c0ccbb5a 100644 --- a/packages/camera/camera_web/lib/src/camera.dart +++ b/packages/camera/camera_web/lib/src/camera.dart @@ -255,10 +255,10 @@ class Camera { final int videoWidth = videoElement.videoWidth; final int videoHeight = videoElement.videoHeight; - final web.HTMLCanvasElement canvas = web.HTMLCanvasElement() + final canvas = web.HTMLCanvasElement() ..width = videoWidth ..height = videoHeight; - final bool isBackCamera = getLensDirection() == CameraLensDirection.back; + final isBackCamera = getLensDirection() == CameraLensDirection.back; // Flip the picture horizontally if it is not taken from a back camera. if (!isBackCamera) { @@ -275,7 +275,7 @@ class Camera { videoHeight.toDouble(), ); - final Completer blobCompleter = Completer(); + final blobCompleter = Completer(); canvas.toBlob( (web.Blob blob) { blobCompleter.complete(blob); @@ -456,7 +456,7 @@ class Camera { /// Throws a [CameraWebException] if the browser does not support any of the /// available video mime types from [_videoMimeType]. Future startVideoRecording() async { - final web.MediaRecorderOptions options = web.MediaRecorderOptions( + final options = web.MediaRecorderOptions( mimeType: _videoMimeType, ); if (recorderOptions.audioBitrate != null) { @@ -492,7 +492,7 @@ class Camera { _onVideoRecordingErrorSubscription = mediaRecorderOnErrorProvider .forTarget(mediaRecorder) .listen((web.Event event) { - final web.ErrorEvent error = event as web.ErrorEvent; + final error = event as web.ErrorEvent; videoRecordingErrorController.add(error); }); @@ -511,7 +511,7 @@ class Camera { final web.Blob videoBlob = blobBuilder(_videoData, videoType); // Create a file containing the video blob. - final XFile file = XFile( + final file = XFile( web.URL.createObjectURL(videoBlob), mimeType: _videoMimeType, name: videoBlob.hashCode.toString(), @@ -605,7 +605,7 @@ class Camera { /// Throws a [CameraWebException] if the browser does not support /// any of the available video mime types. String get _videoMimeType { - const List types = [ + const types = [ 'video/webm;codecs="vp9,opus"', 'video/mp4', 'video/webm', @@ -630,7 +630,7 @@ class Camera { /// Applies default styles to the video [element]. void _applyDefaultVideoStyles(web.HTMLVideoElement element) { - final bool isBackCamera = getLensDirection() == CameraLensDirection.back; + final isBackCamera = getLensDirection() == CameraLensDirection.back; // Flip the video horizontally if it is not taken from a back camera. if (!isBackCamera) { diff --git a/packages/camera/camera_web/lib/src/camera_web.dart b/packages/camera/camera_web/lib/src/camera_web.dart index 2210a4ecba2..90033681d28 100644 --- a/packages/camera/camera_web/lib/src/camera_web.dart +++ b/packages/camera/camera_web/lib/src/camera_web.dart @@ -99,7 +99,7 @@ class CameraPlugin extends CameraPlatform { Future> availableCameras() async { try { final web.MediaDevices mediaDevices = window.navigator.mediaDevices; - final List cameras = []; + final cameras = []; // Request video permissions only. final web.MediaStream cameraStream = await _cameraService @@ -125,7 +125,7 @@ class CameraPlugin extends CameraPlatform { .where((web.MediaDeviceInfo device) => device.deviceId.isNotEmpty); // Map video input devices to camera descriptions. - for (final web.MediaDeviceInfo videoInputDevice in videoInputDevices) { + for (final videoInputDevice in videoInputDevices) { // Get the video stream for the current video input device // to later use for the available video tracks. final web.MediaStream videoStream = await _getVideoStreamForDevice( @@ -160,13 +160,13 @@ class CameraPlugin extends CameraPlatform { // https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/label // // Sensor orientation is currently not supported. - final CameraDescription camera = CameraDescription( + final camera = CameraDescription( name: videoInputDevice.label, lensDirection: lensDirection, sensorOrientation: 0, ); - final CameraMetadata cameraMetadata = CameraMetadata( + final cameraMetadata = CameraMetadata( deviceId: videoInputDevice.deviceId, facingMode: facingMode, ); @@ -176,7 +176,7 @@ class CameraPlugin extends CameraPlatform { camerasMetadata[camera] = cameraMetadata; // Release the camera stream of the current video input device. - for (final web.MediaStreamTrack videoTrack in videoTracks) { + for (final videoTrack in videoTracks) { videoTrack.stop(); } } else { @@ -236,7 +236,7 @@ class CameraPlugin extends CameraPlatform { // Create a camera with the given audio and video constraints. // Sensor orientation is currently not supported. - final Camera camera = Camera( + final camera = Camera( textureId: textureId, cameraService: _cameraService, options: CameraOptions( @@ -381,7 +381,7 @@ class CameraPlugin extends CameraPlatform { // Create an initial orientation event that emits the device orientation // as soon as subscribed to this stream. - final web.Event initialOrientationEvent = web.Event('change'); + final initialOrientationEvent = web.Event('change'); return orientationOnChangeProvider .forTarget(orientation) @@ -677,7 +677,7 @@ class CameraPlugin extends CameraPlatform { /// Returns a media video stream for the device with the given [deviceId]. Future _getVideoStreamForDevice(String deviceId) { // Create camera options with the desired device id. - final CameraOptions cameraOptions = CameraOptions( + final cameraOptions = CameraOptions( video: VideoConstraints(deviceId: deviceId), ); diff --git a/packages/camera/camera_web/lib/src/types/camera_options.dart b/packages/camera/camera_web/lib/src/types/camera_options.dart index 49572724b0a..a2c170fd372 100644 --- a/packages/camera/camera_web/lib/src/types/camera_options.dart +++ b/packages/camera/camera_web/lib/src/types/camera_options.dart @@ -238,7 +238,7 @@ class VideoSizeConstraint { // TODO(dit): package:web has a class for this. Use it instead of toJson. /// Converts the current instance to a Map. Object toJson() { - final Map json = {}; + final json = {}; if (ideal != null) { json['ideal'] = ideal; diff --git a/packages/camera/camera_windows/example/integration_test/camera_test.dart b/packages/camera/camera_windows/example/integration_test/camera_test.dart index 03b791503c5..4943ed9079a 100644 --- a/packages/camera/camera_windows/example/integration_test/camera_test.dart +++ b/packages/camera/camera_windows/example/integration_test/camera_test.dart @@ -104,7 +104,7 @@ void main() { .instance .onDeviceOrientationChanged(); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); expect( diff --git a/packages/camera/camera_windows/example/lib/main.dart b/packages/camera/camera_windows/example/lib/main.dart index 3957fe27c0b..215ecb98130 100644 --- a/packages/camera/camera_windows/example/lib/main.dart +++ b/packages/camera/camera_windows/example/lib/main.dart @@ -60,9 +60,9 @@ class _MyAppState extends State { /// Fetches list of available cameras from camera_windows plugin. Future _fetchCameras() async { String cameraInfo; - List cameras = []; + var cameras = []; - int cameraIndex = 0; + var cameraIndex = 0; try { cameras = await CameraPlatform.instance.availableCameras(); if (cameras.isEmpty) { @@ -92,7 +92,7 @@ class _MyAppState extends State { return; } - int cameraId = -1; + var cameraId = -1; try { final int cameraIndex = _cameraIndex % _cameras.length; final CameraDescription camera = _cameras[cameraIndex]; diff --git a/packages/camera/camera_windows/test/camera_windows_test.dart b/packages/camera/camera_windows/test/camera_windows_test.dart index a3b0e0e98ab..951829a4cb1 100644 --- a/packages/camera/camera_windows/test/camera_windows_test.dart +++ b/packages/camera/camera_windows/test/camera_windows_test.dart @@ -27,10 +27,10 @@ void main() { group('Creation, Initialization & Disposal Tests', () { test('Should send creation data and receive back a camera id', () async { // Arrange - final MockCameraApi mockApi = MockCameraApi(); + final mockApi = MockCameraApi(); when(mockApi.create(any, any)).thenAnswer((_) async => 1); - final CameraWindows plugin = CameraWindows(api: mockApi); - const String cameraName = 'Test'; + final plugin = CameraWindows(api: mockApi); + const cameraName = 'Test'; // Act final int cameraId = await plugin.createCameraWithSettings( @@ -52,7 +52,7 @@ void main() { mockApi.create(captureAny, captureAny), ); expect(verification.captured[0], cameraName); - final PlatformMediaSettings? settings = + final settings = verification.captured[1] as PlatformMediaSettings?; expect(settings, isNotNull); expect(settings?.resolutionPreset, PlatformResolutionPreset.low); @@ -63,17 +63,17 @@ void main() { 'Should throw CameraException when create throws a PlatformException', () { // Arrange - const String exceptionCode = 'TESTING_ERROR_CODE'; - const String exceptionMessage = + const exceptionCode = 'TESTING_ERROR_CODE'; + const exceptionMessage = 'Mock error message used during testing.'; - final MockCameraApi mockApi = MockCameraApi(); + final mockApi = MockCameraApi(); when(mockApi.create(any, any)).thenAnswer((_) async { throw PlatformException( code: exceptionCode, message: exceptionMessage, ); }); - final CameraWindows camera = CameraWindows(api: mockApi); + final camera = CameraWindows(api: mockApi); // Act expect( @@ -102,17 +102,17 @@ void main() { 'Should throw CameraException when initialize throws a PlatformException', () { // Arrange - const String exceptionCode = 'TESTING_ERROR_CODE'; - const String exceptionMessage = + const exceptionCode = 'TESTING_ERROR_CODE'; + const exceptionMessage = 'Mock error message used during testing.'; - final MockCameraApi mockApi = MockCameraApi(); + final mockApi = MockCameraApi(); when(mockApi.initialize(any)).thenAnswer((_) async { throw PlatformException( code: exceptionCode, message: exceptionMessage, ); }); - final CameraWindows plugin = CameraWindows(api: mockApi); + final plugin = CameraWindows(api: mockApi); // Act expect( @@ -136,11 +136,11 @@ void main() { test('Should send initialization data', () async { // Arrange - final MockCameraApi mockApi = MockCameraApi(); + final mockApi = MockCameraApi(); when( mockApi.initialize(any), ).thenAnswer((_) async => PlatformSize(width: 1920, height: 1080)); - final CameraWindows plugin = CameraWindows(api: mockApi); + final plugin = CameraWindows(api: mockApi); final int cameraId = await plugin.createCameraWithSettings( const CameraDescription( name: 'Test', @@ -168,11 +168,11 @@ void main() { test('Should send a disposal call on dispose', () async { // Arrange - final MockCameraApi mockApi = MockCameraApi(); + final mockApi = MockCameraApi(); when( mockApi.initialize(any), ).thenAnswer((_) async => PlatformSize(width: 1920, height: 1080)); - final CameraWindows plugin = CameraWindows(api: mockApi); + final plugin = CameraWindows(api: mockApi); final int cameraId = await plugin.createCameraWithSettings( const CameraDescription( name: 'Test', @@ -204,7 +204,7 @@ void main() { late CameraWindows plugin; late int cameraId; setUp(() async { - final MockCameraApi mockApi = MockCameraApi(); + final mockApi = MockCameraApi(); when(mockApi.create(any, any)).thenAnswer((_) async => 1); when( mockApi.initialize(any), @@ -232,11 +232,11 @@ void main() { final Stream eventStream = plugin.onCameraClosing( cameraId, ); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(eventStream); // Emit test events - final CameraClosingEvent event = CameraClosingEvent(cameraId); + final event = CameraClosingEvent(cameraId); plugin.hostCameraHandlers[cameraId]!.cameraClosing(); plugin.hostCameraHandlers[cameraId]!.cameraClosing(); plugin.hostCameraHandlers[cameraId]!.cameraClosing(); @@ -255,12 +255,12 @@ void main() { final Stream errorStream = plugin.onCameraError( cameraId, ); - final StreamQueue streamQueue = + final streamQueue = StreamQueue(errorStream); // Emit test events - const String errorMessage = 'Error Description'; - final CameraErrorEvent event = CameraErrorEvent(cameraId, errorMessage); + const errorMessage = 'Error Description'; + final event = CameraErrorEvent(cameraId, errorMessage); plugin.hostCameraHandlers[cameraId]!.error(errorMessage); plugin.hostCameraHandlers[cameraId]!.error(errorMessage); plugin.hostCameraHandlers[cameraId]!.error(errorMessage); @@ -309,7 +309,7 @@ void main() { 'Should fetch CameraDescription instances for available cameras', () async { // Arrange - final List returnData = ['Test 1', 'Test 2']; + final returnData = ['Test 1', 'Test 2']; when( mockApi.getAvailableCameras(), ).thenAnswer((_) async => returnData); @@ -320,7 +320,7 @@ void main() { // Assert expect(cameras.length, returnData.length); - for (int i = 0; i < returnData.length; i++) { + for (var i = 0; i < returnData.length; i++) { expect(cameras[i].name, returnData[i]); // This value isn't provided by the platform, so is hard-coded to front. expect(cameras[i].lensDirection, CameraLensDirection.front); @@ -334,8 +334,8 @@ void main() { 'Should throw CameraException when availableCameras throws a PlatformException', () { // Arrange - const String code = 'TESTING_ERROR_CODE'; - const String message = 'Mock error message used during testing.'; + const code = 'TESTING_ERROR_CODE'; + const message = 'Mock error message used during testing.'; when(mockApi.getAvailableCameras()).thenAnswer( (_) async => throw PlatformException(code: code, message: message), ); @@ -362,7 +362,7 @@ void main() { test('Should take a picture and return an XFile instance', () async { // Arrange - const String stubPath = '/test/path.jpg'; + const stubPath = '/test/path.jpg'; when(mockApi.takePicture(any)).thenAnswer((_) async => stubPath); // Act @@ -403,7 +403,7 @@ void main() { test('Should stop a video recording and return the file', () async { // Arrange - const String stubPath = '/test/path.mp4'; + const stubPath = '/test/path.mp4'; when(mockApi.stopVideoRecording(any)).thenAnswer((_) async => stubPath); // Act diff --git a/packages/cross_file/example/lib/readme_excerpts.dart b/packages/cross_file/example/lib/readme_excerpts.dart index e8c4ea2c2cb..94e3c879b87 100644 --- a/packages/cross_file/example/lib/readme_excerpts.dart +++ b/packages/cross_file/example/lib/readme_excerpts.dart @@ -9,7 +9,7 @@ import 'package:cross_file/cross_file.dart'; /// Demonstrate instantiating an XFile for the README. Future instantiateXFile() async { // #docregion Instantiate - final XFile file = XFile('assets/hello.txt'); + final file = XFile('assets/hello.txt'); print('File information:'); print('- Path: ${file.path}'); diff --git a/packages/cross_file/lib/src/types/html.dart b/packages/cross_file/lib/src/types/html.dart index a8047e6a926..9c85e1511b8 100644 --- a/packages/cross_file/lib/src/types/html.dart +++ b/packages/cross_file/lib/src/types/html.dart @@ -131,7 +131,7 @@ class XFile extends XFileBase { throw Exception('Safari cannot handle XFiles larger than 4GB.'); } - final Completer blobCompleter = Completer(); + final blobCompleter = Completer(); late XMLHttpRequest request; request = XMLHttpRequest() @@ -183,7 +183,7 @@ class XFile extends XFileBase { // Converts an html Blob object to a Uint8List, through a FileReader. Future _blobToByteBuffer(Blob blob) async { - final FileReader reader = FileReader(); + final reader = FileReader(); reader.readAsArrayBuffer(blob); await reader.onLoadEnd.first; diff --git a/packages/cross_file/lib/src/types/io.dart b/packages/cross_file/lib/src/types/io.dart index 74ca1806cc3..c1931a743a8 100644 --- a/packages/cross_file/lib/src/types/io.dart +++ b/packages/cross_file/lib/src/types/io.dart @@ -81,7 +81,7 @@ class XFile extends XFileBase { if (_bytes == null) { await _file.copy(path); } else { - final File fileToSave = File(path); + final fileToSave = File(path); // TODO(kevmoo): Remove ignore and fix when the MIN Dart SDK is 3.3 // ignore: unnecessary_non_null_assertion await fileToSave.writeAsBytes(_bytes!); diff --git a/packages/cross_file/test/x_file_html_test.dart b/packages/cross_file/test/x_file_html_test.dart index f71f1271829..75bbcebc6aa 100644 --- a/packages/cross_file/test/x_file_html_test.dart +++ b/packages/cross_file/test/x_file_html_test.dart @@ -26,7 +26,7 @@ final String textFileUrl = void main() { group('Create with an objectUrl', () { - final XFile file = XFile(textFileUrl); + final file = XFile(textFileUrl); test('Can be read as a string', () async { expect(await file.readAsString(), equals(expectedStringContents)); @@ -46,7 +46,7 @@ void main() { }); group('Create from data', () { - final XFile file = XFile.fromData(bytes); + final file = XFile.fromData(bytes); test('Can be read as a string', () async { expect(await file.readAsString(), equals(expectedStringContents)); @@ -65,10 +65,10 @@ void main() { }); test('Prefers local bytes over path if both are provided', () async { - const String text = 'Hello World'; - const String path = 'test/x_file_html_test.dart'; + const text = 'Hello World'; + const path = 'test/x_file_html_test.dart'; - final XFile file = XFile.fromData( + final file = XFile.fromData( utf8.encode(text), path: path, name: 'x_file_html_test.dart', @@ -84,7 +84,7 @@ void main() { }); group('Blob backend', () { - final XFile file = XFile(textFileUrl); + final file = XFile(textFileUrl); test('Stores data as a Blob', () async { // Read the blob from its path 'natively' @@ -107,11 +107,11 @@ void main() { }); group('saveTo(..)', () { - const String crossFileDomElementId = '__x_file_dom_element'; + const crossFileDomElementId = '__x_file_dom_element'; group('CrossFile saveTo(..)', () { test('creates a DOM container', () async { - final XFile file = XFile.fromData(bytes); + final file = XFile.fromData(bytes); await file.saveTo(''); @@ -123,7 +123,7 @@ void main() { }); test('create anchor element', () async { - final XFile file = XFile.fromData(bytes, name: textFile.name); + final file = XFile.fromData(bytes, name: textFile.name); await file.saveTo('path'); @@ -132,7 +132,7 @@ void main() { )!; late html.HTMLAnchorElement element; - for (int i = 0; i < container.childNodes.length; i++) { + for (var i = 0; i < container.childNodes.length; i++) { final html.Element test = container.children.item(i)!; if (test.tagName == 'A') { element = test as html.HTMLAnchorElement; @@ -146,20 +146,20 @@ void main() { }); test('anchor element is clicked', () async { - final html.HTMLAnchorElement mockAnchor = + final mockAnchor = html.document.createElement('a') as html.HTMLAnchorElement; - final CrossFileTestOverrides overrides = CrossFileTestOverrides( + final overrides = CrossFileTestOverrides( createAnchorElement: (_, __) => mockAnchor, ); - final XFile file = XFile.fromData( + final file = XFile.fromData( bytes, name: textFile.name, overrides: overrides, ); - bool clicked = false; + var clicked = false; mockAnchor.onClick.listen((html.MouseEvent event) => clicked = true); await file.saveTo('path'); diff --git a/packages/cross_file/test/x_file_io_test.dart b/packages/cross_file/test/x_file_io_test.dart index 56a3b8cb9cc..904a5c08c50 100644 --- a/packages/cross_file/test/x_file_io_test.dart +++ b/packages/cross_file/test/x_file_io_test.dart @@ -24,28 +24,28 @@ final String textFilePath = textFile.path; void main() { group('Create with a path', () { test('Can be read as a string', () async { - final XFile file = XFile(textFilePath); + final file = XFile(textFilePath); expect(await file.readAsString(), equals(expectedStringContents)); }); test('Can be read as bytes', () async { - final XFile file = XFile(textFilePath); + final file = XFile(textFilePath); expect(await file.readAsBytes(), equals(bytes)); }); test('Can be read as a stream', () async { - final XFile file = XFile(textFilePath); + final file = XFile(textFilePath); expect(await file.openRead().first, equals(bytes)); }); test('Stream can be sliced', () async { - final XFile file = XFile(textFilePath); + final file = XFile(textFilePath); expect(await file.openRead(2, 5).first, equals(bytes.sublist(2, 5))); }); test('saveTo(..) creates file', () async { - final XFile file = XFile(textFilePath); + final file = XFile(textFilePath); final Directory tempDir = Directory.systemTemp.createTempSync(); - final File targetFile = File('${tempDir.path}/newFilePath.txt'); + final targetFile = File('${tempDir.path}/newFilePath.txt'); if (targetFile.existsSync()) { await targetFile.delete(); } @@ -59,9 +59,9 @@ void main() { }); test('saveTo(..) does not load the file into memory', () async { - final TestXFile file = TestXFile(textFilePath); + final file = TestXFile(textFilePath); final Directory tempDir = Directory.systemTemp.createTempSync(); - final File targetFile = File('${tempDir.path}/newFilePath.txt'); + final targetFile = File('${tempDir.path}/newFilePath.txt'); if (targetFile.existsSync()) { await targetFile.delete(); } @@ -79,7 +79,7 @@ void main() { }); group('Create with data', () { - final XFile file = XFile.fromData(bytes); + final file = XFile.fromData(bytes); test('Can be read as a string', () async { expect(await file.readAsString(), equals(expectedStringContents)); @@ -98,7 +98,7 @@ void main() { test('Function saveTo(..) creates file', () async { final Directory tempDir = Directory.systemTemp.createTempSync(); - final File targetFile = File('${tempDir.path}/newFilePath.txt'); + final targetFile = File('${tempDir.path}/newFilePath.txt'); if (targetFile.existsSync()) { await targetFile.delete(); } diff --git a/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart b/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart index 8b80e00d45a..c857a070288 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart +++ b/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart @@ -117,7 +117,7 @@ class SignInDemoState extends State { final auth.AuthClient client = authorization.authClient(scopes: scopes); // Prepare a People Service authenticated client. - final PeopleServiceApi peopleApi = PeopleServiceApi(client); + final peopleApi = PeopleServiceApi(client); // Retrieve a list of connected contacts' names. final ListConnectionsResponse response = await peopleApi.people.connections .list('people/me', personFields: 'names'); diff --git a/packages/extension_google_sign_in_as_googleapis_auth/lib/extension_google_sign_in_as_googleapis_auth.dart b/packages/extension_google_sign_in_as_googleapis_auth/lib/extension_google_sign_in_as_googleapis_auth.dart index 57fdfba8a9a..494bfdef1b0 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/lib/extension_google_sign_in_as_googleapis_auth.dart +++ b/packages/extension_google_sign_in_as_googleapis_auth/lib/extension_google_sign_in_as_googleapis_auth.dart @@ -16,7 +16,7 @@ extension GoogleApisGoogleSignInAuth on GoogleSignInClientAuthorization { /// the authorization. Passing scopes here that have not been authorized will /// likely result in API errors when using the client. gapis.AuthClient authClient({required List scopes}) { - final gapis.AccessCredentials credentials = gapis.AccessCredentials( + final credentials = gapis.AccessCredentials( gapis.AccessToken( 'Bearer', accessToken, diff --git a/packages/extension_google_sign_in_as_googleapis_auth/test/extension_google_sign_in_as_googleapis_auth_test.dart b/packages/extension_google_sign_in_as_googleapis_auth/test/extension_google_sign_in_as_googleapis_auth_test.dart index 8884b459906..f32d4f93605 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/test/extension_google_sign_in_as_googleapis_auth_test.dart +++ b/packages/extension_google_sign_in_as_googleapis_auth/test/extension_google_sign_in_as_googleapis_auth_test.dart @@ -19,8 +19,8 @@ void main() { test( 'authClient returned client contains the expected information', () async { - const List scopes = ['some-scope', 'another-scope']; - final FakeGoogleSignInClientAuthorization signInAuth = + const scopes = ['some-scope', 'another-scope']; + final signInAuth = FakeGoogleSignInClientAuthorization(); final gapis.AuthClient client = signInAuth.authClient(scopes: scopes); expect( diff --git a/packages/file_selector/file_selector/example/lib/get_directory_page.dart b/packages/file_selector/file_selector/example/lib/get_directory_page.dart index d98e718807f..9f8b6fdc37b 100644 --- a/packages/file_selector/file_selector/example/lib/get_directory_page.dart +++ b/packages/file_selector/file_selector/example/lib/get_directory_page.dart @@ -14,7 +14,7 @@ class GetDirectoryPage extends StatelessWidget { final bool _isIOS = !kIsWeb && defaultTargetPlatform == TargetPlatform.iOS; Future _getDirectoryPath(BuildContext context) async { - const String confirmButtonText = 'Choose'; + const confirmButtonText = 'Choose'; final String? directoryPath = await getDirectoryPath( confirmButtonText: confirmButtonText, ); diff --git a/packages/file_selector/file_selector/example/lib/get_multiple_directories_page.dart b/packages/file_selector/file_selector/example/lib/get_multiple_directories_page.dart index d1095da159f..aa519552e04 100644 --- a/packages/file_selector/file_selector/example/lib/get_multiple_directories_page.dart +++ b/packages/file_selector/file_selector/example/lib/get_multiple_directories_page.dart @@ -12,7 +12,7 @@ class GetMultipleDirectoriesPage extends StatelessWidget { const GetMultipleDirectoriesPage({super.key}); Future _getDirectoryPaths(BuildContext context) async { - const String confirmButtonText = 'Choose'; + const confirmButtonText = 'Choose'; final List directoryPaths = await getDirectoryPaths( confirmButtonText: confirmButtonText, ); @@ -20,8 +20,8 @@ class GetMultipleDirectoriesPage extends StatelessWidget { // Operation was canceled by the user. return; } - String paths = ''; - for (final String? path in directoryPaths) { + var paths = ''; + for (final path in directoryPaths) { paths += '${path!} \n'; } if (context.mounted) { diff --git a/packages/file_selector/file_selector/example/lib/open_image_page.dart b/packages/file_selector/file_selector/example/lib/open_image_page.dart index 20c4e87e64b..e2260c97860 100644 --- a/packages/file_selector/file_selector/example/lib/open_image_page.dart +++ b/packages/file_selector/file_selector/example/lib/open_image_page.dart @@ -15,7 +15,7 @@ class OpenImagePage extends StatelessWidget { Future _openImageFile(BuildContext context) async { // #docregion SingleOpen - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'images', extensions: ['jpg', 'png'], uniformTypeIdentifiers: ['public.jpeg', 'public.png'], diff --git a/packages/file_selector/file_selector/example/lib/open_multiple_images_page.dart b/packages/file_selector/file_selector/example/lib/open_multiple_images_page.dart index 9f74c92f5af..eb6b0e9f91f 100644 --- a/packages/file_selector/file_selector/example/lib/open_multiple_images_page.dart +++ b/packages/file_selector/file_selector/example/lib/open_multiple_images_page.dart @@ -15,12 +15,12 @@ class OpenMultipleImagesPage extends StatelessWidget { Future _openImageFile(BuildContext context) async { // #docregion MultiOpen - const XTypeGroup jpgsTypeGroup = XTypeGroup( + const jpgsTypeGroup = XTypeGroup( label: 'JPEGs', extensions: ['jpg', 'jpeg'], uniformTypeIdentifiers: ['public.jpeg'], ); - const XTypeGroup pngTypeGroup = XTypeGroup( + const pngTypeGroup = XTypeGroup( label: 'PNGs', extensions: ['png'], uniformTypeIdentifiers: ['public.png'], diff --git a/packages/file_selector/file_selector/example/lib/open_text_page.dart b/packages/file_selector/file_selector/example/lib/open_text_page.dart index 55ea3ff7d69..ab6dd5a6825 100644 --- a/packages/file_selector/file_selector/example/lib/open_text_page.dart +++ b/packages/file_selector/file_selector/example/lib/open_text_page.dart @@ -13,7 +13,7 @@ class OpenTextPage extends StatelessWidget { const OpenTextPage({super.key}); Future _openTextFile(BuildContext context) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'text', extensions: ['txt', 'json'], uniformTypeIdentifiers: ['public.text'], diff --git a/packages/file_selector/file_selector/example/lib/readme_standalone_excerpts.dart b/packages/file_selector/file_selector/example/lib/readme_standalone_excerpts.dart index afc9c9f0857..cbfc728c884 100644 --- a/packages/file_selector/file_selector/example/lib/readme_standalone_excerpts.dart +++ b/packages/file_selector/file_selector/example/lib/readme_standalone_excerpts.dart @@ -36,7 +36,7 @@ class _MyAppState extends State { Future saveFile() async { // #docregion Save - const String fileName = 'suggested_name.txt'; + const fileName = 'suggested_name.txt'; final FileSaveLocation? result = await getSaveLocation( suggestedName: fileName, ); @@ -45,9 +45,9 @@ class _MyAppState extends State { return; } - final Uint8List fileData = Uint8List.fromList('Hello World!'.codeUnits); - const String mimeType = 'text/plain'; - final XFile textFile = XFile.fromData( + final fileData = Uint8List.fromList('Hello World!'.codeUnits); + const mimeType = 'text/plain'; + final textFile = XFile.fromData( fileData, mimeType: mimeType, name: fileName, diff --git a/packages/file_selector/file_selector/example/lib/save_text_page.dart b/packages/file_selector/file_selector/example/lib/save_text_page.dart index d5dcd117458..809c7f43d20 100644 --- a/packages/file_selector/file_selector/example/lib/save_text_page.dart +++ b/packages/file_selector/file_selector/example/lib/save_text_page.dart @@ -36,9 +36,9 @@ class SaveTextPage extends StatelessWidget { } final String text = _contentController.text; - final Uint8List fileData = Uint8List.fromList(text.codeUnits); - const String fileMimeType = 'text/plain'; - final XFile textFile = XFile.fromData( + final fileData = Uint8List.fromList(text.codeUnits); + const fileMimeType = 'text/plain'; + final textFile = XFile.fromData( fileData, mimeType: fileMimeType, name: fileName, diff --git a/packages/file_selector/file_selector/test/file_selector_test.dart b/packages/file_selector/file_selector/test/file_selector_test.dart index 4a0cda7983b..2db506f0892 100644 --- a/packages/file_selector/file_selector/test/file_selector_test.dart +++ b/packages/file_selector/file_selector/test/file_selector_test.dart @@ -9,11 +9,11 @@ import 'package:plugin_platform_interface/plugin_platform_interface.dart'; void main() { late FakeFileSelector fakePlatformImplementation; - const String initialDirectory = '/home/flutteruser'; - const String confirmButtonText = 'Use this profile picture'; - const String suggestedName = 'suggested_name'; + const initialDirectory = '/home/flutteruser'; + const confirmButtonText = 'Use this profile picture'; + const suggestedName = 'suggested_name'; - const List acceptedTypeGroups = [ + const acceptedTypeGroups = [ XTypeGroup( label: 'documents', mimeTypes: [ @@ -30,7 +30,7 @@ void main() { }); group('openFile', () { - final XFile expectedFile = XFile('path'); + final expectedFile = XFile('path'); test('works', () async { fakePlatformImplementation @@ -89,7 +89,7 @@ void main() { }); group('openFiles', () { - final List expectedFiles = [XFile('path')]; + final expectedFiles = [XFile('path')]; test('works', () async { fakePlatformImplementation @@ -152,10 +152,10 @@ void main() { }); group('getSaveLocation', () { - const String expectedSavePath = '/example/path'; + const expectedSavePath = '/example/path'; test('works', () async { - const int expectedActiveFilter = 1; + const expectedActiveFilter = 1; fakePlatformImplementation ..setExpectations( initialDirectory: initialDirectory, @@ -230,7 +230,7 @@ void main() { }); test('sets the directory creation control flag', () async { - const bool canCreateDirectories = false; + const canCreateDirectories = false; fakePlatformImplementation ..setExpectations(canCreateDirectories: canCreateDirectories) ..setPathsResponse([expectedSavePath]); @@ -243,7 +243,7 @@ void main() { }); group('getDirectoryPath', () { - const String expectedDirectoryPath = '/example/path'; + const expectedDirectoryPath = '/example/path'; test('works', () async { fakePlatformImplementation @@ -293,7 +293,7 @@ void main() { }); test('sets the directory creation control flag', () async { - const bool canCreateDirectories = true; + const canCreateDirectories = true; fakePlatformImplementation ..setExpectations(canCreateDirectories: canCreateDirectories) ..setPathsResponse([expectedDirectoryPath]); @@ -306,7 +306,7 @@ void main() { }); group('getDirectoryPaths', () { - const List expectedDirectoryPaths = [ + const expectedDirectoryPaths = [ '/example/path', '/example/2/path', ]; @@ -356,7 +356,7 @@ void main() { expect(directoryPaths, expectedDirectoryPaths); }); test('sets the directory creation control flag', () async { - const bool canCreateDirectories = true; + const canCreateDirectories = true; fakePlatformImplementation ..setExpectations(canCreateDirectories: canCreateDirectories) ..setPathsResponse(expectedDirectoryPaths); diff --git a/packages/file_selector/file_selector_android/example/lib/open_image_page.dart b/packages/file_selector/file_selector_android/example/lib/open_image_page.dart index 637b0c6acad..245ac40f3b1 100644 --- a/packages/file_selector/file_selector_android/example/lib/open_image_page.dart +++ b/packages/file_selector/file_selector_android/example/lib/open_image_page.dart @@ -13,7 +13,7 @@ class OpenImagePage extends StatelessWidget { const OpenImagePage({super.key}); Future _openImageFile(BuildContext context) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'images', extensions: ['jpg', 'png'], uniformTypeIdentifiers: ['public.image'], diff --git a/packages/file_selector/file_selector_android/example/lib/open_multiple_images_page.dart b/packages/file_selector/file_selector_android/example/lib/open_multiple_images_page.dart index cedb64fa990..9bc2cfa80fc 100644 --- a/packages/file_selector/file_selector_android/example/lib/open_multiple_images_page.dart +++ b/packages/file_selector/file_selector_android/example/lib/open_multiple_images_page.dart @@ -13,12 +13,12 @@ class OpenMultipleImagesPage extends StatelessWidget { const OpenMultipleImagesPage({super.key}); Future _openImageFile(BuildContext context) async { - const XTypeGroup jpgsTypeGroup = XTypeGroup( + const jpgsTypeGroup = XTypeGroup( label: 'JPEGs', extensions: ['jpg', 'jpeg'], uniformTypeIdentifiers: ['public.jpeg'], ); - const XTypeGroup pngTypeGroup = XTypeGroup( + const pngTypeGroup = XTypeGroup( label: 'PNGs', extensions: ['png'], uniformTypeIdentifiers: ['public.png'], @@ -31,8 +31,8 @@ class OpenMultipleImagesPage extends StatelessWidget { return; } - final List imageBytes = []; - for (final XFile file in files) { + final imageBytes = []; + for (final file in files) { imageBytes.add(await file.readAsBytes()); } if (context.mounted) { diff --git a/packages/file_selector/file_selector_android/example/lib/open_text_page.dart b/packages/file_selector/file_selector_android/example/lib/open_text_page.dart index 8c22c88ca3b..5469e580146 100644 --- a/packages/file_selector/file_selector_android/example/lib/open_text_page.dart +++ b/packages/file_selector/file_selector_android/example/lib/open_text_page.dart @@ -12,7 +12,7 @@ class OpenTextPage extends StatelessWidget { const OpenTextPage({super.key}); Future _openTextFile(BuildContext context) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'text', extensions: ['txt', 'json'], uniformTypeIdentifiers: ['public.text'], diff --git a/packages/file_selector/file_selector_android/lib/src/file_selector_android.dart b/packages/file_selector/file_selector_android/lib/src/file_selector_android.dart index 303330d3de3..461ede2e67e 100644 --- a/packages/file_selector/file_selector_android/lib/src/file_selector_android.dart +++ b/packages/file_selector/file_selector_android/lib/src/file_selector_android.dart @@ -76,8 +76,8 @@ class FileSelectorAndroid extends FileSelectorPlatform { return FileTypes(extensions: [], mimeTypes: []); } - final Set mimeTypes = {}; - final Set extensions = {}; + final mimeTypes = {}; + final extensions = {}; for (final XTypeGroup group in typeGroups) { if (!group.allowsAny && diff --git a/packages/file_selector/file_selector_android/test/file_selector_android_test.dart b/packages/file_selector/file_selector_android/test/file_selector_android_test.dart index 61f79ff9211..b4f7ece33b9 100644 --- a/packages/file_selector/file_selector_android/test/file_selector_android_test.dart +++ b/packages/file_selector/file_selector_android/test/file_selector_android_test.dart @@ -61,12 +61,12 @@ void main() { ), ); - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( extensions: ['txt'], mimeTypes: ['text/plain'], ); - const XTypeGroup group2 = XTypeGroup( + const group2 = XTypeGroup( extensions: ['jpg'], mimeTypes: ['image/jpg'], ); @@ -120,12 +120,12 @@ void main() { ]), ); - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( extensions: ['txt'], mimeTypes: ['text/plain'], ); - const XTypeGroup group2 = XTypeGroup( + const group2 = XTypeGroup( extensions: ['jpg'], mimeTypes: ['image/jpg'], ); diff --git a/packages/file_selector/file_selector_ios/example/lib/open_image_page.dart b/packages/file_selector/file_selector_ios/example/lib/open_image_page.dart index 226400974b2..e3e059150f0 100644 --- a/packages/file_selector/file_selector_ios/example/lib/open_image_page.dart +++ b/packages/file_selector/file_selector_ios/example/lib/open_image_page.dart @@ -15,7 +15,7 @@ class OpenImagePage extends StatelessWidget { const OpenImagePage({super.key}); Future _openImageFile(BuildContext context) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'images', extensions: ['jpg', 'png'], uniformTypeIdentifiers: ['public.image'], diff --git a/packages/file_selector/file_selector_ios/example/lib/open_multiple_images_page.dart b/packages/file_selector/file_selector_ios/example/lib/open_multiple_images_page.dart index 8650a2e06d2..9585ac87deb 100644 --- a/packages/file_selector/file_selector_ios/example/lib/open_multiple_images_page.dart +++ b/packages/file_selector/file_selector_ios/example/lib/open_multiple_images_page.dart @@ -15,12 +15,12 @@ class OpenMultipleImagesPage extends StatelessWidget { const OpenMultipleImagesPage({super.key}); Future _openImageFile(BuildContext context) async { - const XTypeGroup jpgsTypeGroup = XTypeGroup( + const jpgsTypeGroup = XTypeGroup( label: 'JPEGs', extensions: ['jpg', 'jpeg'], uniformTypeIdentifiers: ['public.jpeg'], ); - const XTypeGroup pngTypeGroup = XTypeGroup( + const pngTypeGroup = XTypeGroup( label: 'PNGs', extensions: ['png'], uniformTypeIdentifiers: ['public.png'], diff --git a/packages/file_selector/file_selector_ios/example/lib/open_text_page.dart b/packages/file_selector/file_selector_ios/example/lib/open_text_page.dart index 970caf19f8e..9a9b36126b1 100644 --- a/packages/file_selector/file_selector_ios/example/lib/open_text_page.dart +++ b/packages/file_selector/file_selector_ios/example/lib/open_text_page.dart @@ -12,7 +12,7 @@ class OpenTextPage extends StatelessWidget { const OpenTextPage({super.key}); Future _openTextFile(BuildContext context) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'text', extensions: ['txt', 'json'], uniformTypeIdentifiers: ['public.text'], diff --git a/packages/file_selector/file_selector_ios/lib/file_selector_ios.dart b/packages/file_selector/file_selector_ios/lib/file_selector_ios.dart index ac2af48c7bc..2f6f241333f 100644 --- a/packages/file_selector/file_selector_ios/lib/file_selector_ios.dart +++ b/packages/file_selector/file_selector_ios/lib/file_selector_ios.dart @@ -54,12 +54,12 @@ class FileSelectorIOS extends FileSelectorPlatform { List _allowedUtiListFromTypeGroups(List? typeGroups) { // iOS requires a list of allowed types, so allowing all is expressed via // a root type rather than an empty list. - const List allowAny = ['public.data']; + const allowAny = ['public.data']; if (typeGroups == null || typeGroups.isEmpty) { return allowAny; } - final List allowedUTIs = []; + final allowedUTIs = []; for (final XTypeGroup typeGroup in typeGroups) { // If any group allows everything, no filtering should be done. if (typeGroup.allowsAny) { diff --git a/packages/file_selector/file_selector_ios/test/file_selector_ios_test.dart b/packages/file_selector/file_selector_ios/test/file_selector_ios_test.dart index e19dc3fa6ff..ef6bad4693b 100644 --- a/packages/file_selector/file_selector_ios/test/file_selector_ios_test.dart +++ b/packages/file_selector/file_selector_ios/test/file_selector_ios_test.dart @@ -31,14 +31,14 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], uniformTypeIdentifiers: ['public.text'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -59,7 +59,7 @@ void main() { expect(api.passedConfig?.allowMultiSelection, isFalse); }); test('throws for a type group that does not support iOS', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'images', webWildCards: ['images/*'], ); @@ -79,7 +79,7 @@ void main() { }); test('correctly handles a wildcard group', () async { - const XTypeGroup group = XTypeGroup(label: 'text'); + const group = XTypeGroup(label: 'text'); await expectLater( plugin.openFile(acceptedTypeGroups: [group]), @@ -98,14 +98,14 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], uniformTypeIdentifiers: ['public.text'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -126,7 +126,7 @@ void main() { }); test('throws for a type group that does not support iOS', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'images', webWildCards: ['images/*'], ); @@ -146,7 +146,7 @@ void main() { }); test('correctly handles a wildcard group', () async { - const XTypeGroup group = XTypeGroup(label: 'text'); + const group = XTypeGroup(label: 'text'); await expectLater( plugin.openFiles(acceptedTypeGroups: [group]), diff --git a/packages/file_selector/file_selector_linux/example/lib/get_directory_page.dart b/packages/file_selector/file_selector_linux/example/lib/get_directory_page.dart index e483b8c640c..70e4aab79e1 100644 --- a/packages/file_selector/file_selector_linux/example/lib/get_directory_page.dart +++ b/packages/file_selector/file_selector_linux/example/lib/get_directory_page.dart @@ -12,7 +12,7 @@ class GetDirectoryPage extends StatelessWidget { const GetDirectoryPage({super.key}); Future _getDirectoryPath(BuildContext context) async { - const String confirmButtonText = 'Choose'; + const confirmButtonText = 'Choose'; final String? directoryPath = await FileSelectorPlatform.instance .getDirectoryPath(confirmButtonText: confirmButtonText); if (directoryPath == null) { diff --git a/packages/file_selector/file_selector_linux/example/lib/get_multiple_directories_page.dart b/packages/file_selector/file_selector_linux/example/lib/get_multiple_directories_page.dart index fe7fd3d2416..b18cb5fd3be 100644 --- a/packages/file_selector/file_selector_linux/example/lib/get_multiple_directories_page.dart +++ b/packages/file_selector/file_selector_linux/example/lib/get_multiple_directories_page.dart @@ -12,7 +12,7 @@ class GetMultipleDirectoriesPage extends StatelessWidget { const GetMultipleDirectoriesPage({super.key}); Future _getDirectoryPaths(BuildContext context) async { - const String confirmButtonText = 'Choose'; + const confirmButtonText = 'Choose'; final List directoryPaths = await FileSelectorPlatform.instance .getDirectoryPaths(confirmButtonText: confirmButtonText); if (directoryPaths.isEmpty) { diff --git a/packages/file_selector/file_selector_linux/example/lib/open_image_page.dart b/packages/file_selector/file_selector_linux/example/lib/open_image_page.dart index f5705d244ad..6554cbfb8b8 100644 --- a/packages/file_selector/file_selector_linux/example/lib/open_image_page.dart +++ b/packages/file_selector/file_selector_linux/example/lib/open_image_page.dart @@ -15,7 +15,7 @@ class OpenImagePage extends StatelessWidget { const OpenImagePage({super.key}); Future _openImageFile(BuildContext context) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'images', extensions: ['jpg', 'png'], ); diff --git a/packages/file_selector/file_selector_linux/example/lib/open_multiple_images_page.dart b/packages/file_selector/file_selector_linux/example/lib/open_multiple_images_page.dart index 0b9fe352516..9648be318aa 100644 --- a/packages/file_selector/file_selector_linux/example/lib/open_multiple_images_page.dart +++ b/packages/file_selector/file_selector_linux/example/lib/open_multiple_images_page.dart @@ -15,11 +15,11 @@ class OpenMultipleImagesPage extends StatelessWidget { const OpenMultipleImagesPage({super.key}); Future _openImageFile(BuildContext context) async { - const XTypeGroup jpgsTypeGroup = XTypeGroup( + const jpgsTypeGroup = XTypeGroup( label: 'JPEGs', extensions: ['jpg', 'jpeg'], ); - const XTypeGroup pngTypeGroup = XTypeGroup( + const pngTypeGroup = XTypeGroup( label: 'PNGs', extensions: ['png'], ); diff --git a/packages/file_selector/file_selector_linux/example/lib/open_text_page.dart b/packages/file_selector/file_selector_linux/example/lib/open_text_page.dart index 0a50be30b83..023cd8c03a7 100644 --- a/packages/file_selector/file_selector_linux/example/lib/open_text_page.dart +++ b/packages/file_selector/file_selector_linux/example/lib/open_text_page.dart @@ -12,7 +12,7 @@ class OpenTextPage extends StatelessWidget { const OpenTextPage({super.key}); Future _openTextFile(BuildContext context) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'text', extensions: ['txt', 'json'], ); diff --git a/packages/file_selector/file_selector_linux/example/lib/save_text_page.dart b/packages/file_selector/file_selector_linux/example/lib/save_text_page.dart index bcc26efe8db..988176f6498 100644 --- a/packages/file_selector/file_selector_linux/example/lib/save_text_page.dart +++ b/packages/file_selector/file_selector_linux/example/lib/save_text_page.dart @@ -24,9 +24,9 @@ class SaveTextPage extends StatelessWidget { return; } final String text = _contentController.text; - final Uint8List fileData = Uint8List.fromList(text.codeUnits); - const String fileMimeType = 'text/plain'; - final XFile textFile = XFile.fromData( + final fileData = Uint8List.fromList(text.codeUnits); + const fileMimeType = 'text/plain'; + final textFile = XFile.fromData( fileData, mimeType: fileMimeType, name: fileName, diff --git a/packages/file_selector/file_selector_linux/test/file_selector_linux_test.dart b/packages/file_selector/file_selector_linux/test/file_selector_linux_test.dart index 4f6786b5cfb..01c068d4279 100644 --- a/packages/file_selector/file_selector_linux/test/file_selector_linux_test.dart +++ b/packages/file_selector/file_selector_linux/test/file_selector_linux_test.dart @@ -26,7 +26,7 @@ void main() { group('openFile', () { test('passes the core flags correctly', () async { - const String path = '/foo/bar'; + const path = '/foo/bar'; api.result = [path]; expect((await plugin.openFile())?.path, path); @@ -42,13 +42,13 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -76,21 +76,21 @@ void main() { }); test('passes initialDirectory correctly', () async { - const String path = '/example/directory'; + const path = '/example/directory'; await plugin.openFile(initialDirectory: path); expect(api.passedOptions?.currentFolderPath, path); }); test('passes confirmButtonText correctly', () async { - const String button = 'Open File'; + const button = 'Open File'; await plugin.openFile(confirmButtonText: button); expect(api.passedOptions?.acceptButtonLabel, button); }); test('throws for a type group that does not support Linux', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'images', webWildCards: ['images/*'], ); @@ -102,7 +102,7 @@ void main() { }); test('passes a wildcard group correctly', () async { - const XTypeGroup group = XTypeGroup(label: 'any'); + const group = XTypeGroup(label: 'any'); await plugin.openFile(acceptedTypeGroups: [group]); @@ -125,13 +125,13 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -159,21 +159,21 @@ void main() { }); test('passes initialDirectory correctly', () async { - const String path = '/example/directory'; + const path = '/example/directory'; await plugin.openFiles(initialDirectory: path); expect(api.passedOptions?.currentFolderPath, path); }); test('passes confirmButtonText correctly', () async { - const String button = 'Open File'; + const button = 'Open File'; await plugin.openFiles(confirmButtonText: button); expect(api.passedOptions?.acceptButtonLabel, button); }); test('throws for a type group that does not support Linux', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'images', webWildCards: ['images/*'], ); @@ -185,7 +185,7 @@ void main() { }); test('passes a wildcard group correctly', () async { - const XTypeGroup group = XTypeGroup(label: 'any'); + const group = XTypeGroup(label: 'any'); await plugin.openFiles(acceptedTypeGroups: [group]); @@ -195,7 +195,7 @@ void main() { group('getSaveLocation', () { test('passes the core flags correctly', () async { - const String path = '/foo/bar'; + const path = '/foo/bar'; api.result = [path]; expect((await plugin.getSaveLocation())?.path, path); @@ -204,13 +204,13 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -240,7 +240,7 @@ void main() { }); test('passes initialDirectory correctly', () async { - const String path = '/example/directory'; + const path = '/example/directory'; await plugin.getSaveLocation( options: const SaveDialogOptions(initialDirectory: path), ); @@ -249,7 +249,7 @@ void main() { }); test('passes confirmButtonText correctly', () async { - const String button = 'Open File'; + const button = 'Open File'; await plugin.getSaveLocation( options: const SaveDialogOptions(confirmButtonText: button), ); @@ -258,7 +258,7 @@ void main() { }); test('throws for a type group that does not support Linux', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'images', webWildCards: ['images/*'], ); @@ -270,7 +270,7 @@ void main() { }); test('passes a wildcard group correctly', () async { - const XTypeGroup group = XTypeGroup(label: 'any'); + const group = XTypeGroup(label: 'any'); await plugin.getSaveLocation(acceptedTypeGroups: [group]); @@ -280,7 +280,7 @@ void main() { group('getSavePath (deprecated)', () { test('passes the core flags correctly', () async { - const String path = '/foo/bar'; + const path = '/foo/bar'; api.result = [path]; expect(await plugin.getSavePath(), path); @@ -289,13 +289,13 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -325,21 +325,21 @@ void main() { }); test('passes initialDirectory correctly', () async { - const String path = '/example/directory'; + const path = '/example/directory'; await plugin.getSavePath(initialDirectory: path); expect(api.passedOptions?.currentFolderPath, path); }); test('passes confirmButtonText correctly', () async { - const String button = 'Open File'; + const button = 'Open File'; await plugin.getSavePath(confirmButtonText: button); expect(api.passedOptions?.acceptButtonLabel, button); }); test('throws for a type group that does not support Linux', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'images', webWildCards: ['images/*'], ); @@ -351,7 +351,7 @@ void main() { }); test('passes a wildcard group correctly', () async { - const XTypeGroup group = XTypeGroup(label: 'any'); + const group = XTypeGroup(label: 'any'); await plugin.getSavePath(acceptedTypeGroups: [group]); @@ -361,7 +361,7 @@ void main() { group('getDirectoryPath', () { test('passes the core flags correctly', () async { - const String path = '/foo/bar'; + const path = '/foo/bar'; api.result = [path]; expect(await plugin.getDirectoryPath(), path); @@ -371,14 +371,14 @@ void main() { }); test('passes initialDirectory correctly', () async { - const String path = '/example/directory'; + const path = '/example/directory'; await plugin.getDirectoryPath(initialDirectory: path); expect(api.passedOptions?.currentFolderPath, path); }); test('passes confirmButtonText correctly', () async { - const String button = 'Select Folder'; + const button = 'Select Folder'; await plugin.getDirectoryPath(confirmButtonText: button); expect(api.passedOptions?.acceptButtonLabel, button); @@ -387,7 +387,7 @@ void main() { group('getDirectoryPathWithOptions', () { test('passes the core flags correctly', () async { - const String path = '/foo/bar'; + const path = '/foo/bar'; api.result = [path]; expect( @@ -400,7 +400,7 @@ void main() { }); test('passes initialDirectory correctly', () async { - const String path = '/example/directory'; + const path = '/example/directory'; await plugin.getDirectoryPathWithOptions( const FileDialogOptions(initialDirectory: path), ); @@ -409,7 +409,7 @@ void main() { }); test('passes confirmButtonText correctly', () async { - const String button = 'Select Folder'; + const button = 'Select Folder'; await plugin.getDirectoryPathWithOptions( const FileDialogOptions(confirmButtonText: button), ); @@ -435,14 +435,14 @@ void main() { }); test('passes initialDirectory correctly', () async { - const String path = '/example/directory'; + const path = '/example/directory'; await plugin.getDirectoryPaths(initialDirectory: path); expect(api.passedOptions?.currentFolderPath, path); }); test('passes confirmButtonText correctly', () async { - const String button = 'Select one or mode folders'; + const button = 'Select one or mode folders'; await plugin.getDirectoryPaths(confirmButtonText: button); expect(api.passedOptions?.acceptButtonLabel, button); @@ -469,7 +469,7 @@ void main() { }); test('passes initialDirectory correctly', () async { - const String path = '/example/directory'; + const path = '/example/directory'; await plugin.getDirectoryPathsWithOptions( const FileDialogOptions(initialDirectory: path), ); @@ -478,7 +478,7 @@ void main() { }); test('passes confirmButtonText correctly', () async { - const String button = 'Select one or mode folders'; + const button = 'Select one or mode folders'; await plugin.getDirectoryPathsWithOptions( const FileDialogOptions(confirmButtonText: button), ); diff --git a/packages/file_selector/file_selector_macos/example/lib/get_directory_page.dart b/packages/file_selector/file_selector_macos/example/lib/get_directory_page.dart index edbd299fda2..065f5c0837e 100644 --- a/packages/file_selector/file_selector_macos/example/lib/get_directory_page.dart +++ b/packages/file_selector/file_selector_macos/example/lib/get_directory_page.dart @@ -12,7 +12,7 @@ class GetDirectoryPage extends StatelessWidget { const GetDirectoryPage({super.key}); Future _getDirectoryPath(BuildContext context) async { - const String confirmButtonText = 'Choose'; + const confirmButtonText = 'Choose'; final String? directoryPath = await FileSelectorPlatform.instance .getDirectoryPathWithOptions( const FileDialogOptions( diff --git a/packages/file_selector/file_selector_macos/example/lib/get_multiple_directories_page.dart b/packages/file_selector/file_selector_macos/example/lib/get_multiple_directories_page.dart index c0b32ace41d..18ae7f52db3 100644 --- a/packages/file_selector/file_selector_macos/example/lib/get_multiple_directories_page.dart +++ b/packages/file_selector/file_selector_macos/example/lib/get_multiple_directories_page.dart @@ -12,7 +12,7 @@ class GetMultipleDirectoriesPage extends StatelessWidget { const GetMultipleDirectoriesPage({super.key}); Future _getDirectoryPaths(BuildContext context) async { - const String confirmButtonText = 'Choose'; + const confirmButtonText = 'Choose'; final List directoriesPaths = await FileSelectorPlatform.instance .getDirectoryPathsWithOptions( const FileDialogOptions( diff --git a/packages/file_selector/file_selector_macos/example/lib/open_image_page.dart b/packages/file_selector/file_selector_macos/example/lib/open_image_page.dart index f5705d244ad..6554cbfb8b8 100644 --- a/packages/file_selector/file_selector_macos/example/lib/open_image_page.dart +++ b/packages/file_selector/file_selector_macos/example/lib/open_image_page.dart @@ -15,7 +15,7 @@ class OpenImagePage extends StatelessWidget { const OpenImagePage({super.key}); Future _openImageFile(BuildContext context) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'images', extensions: ['jpg', 'png'], ); diff --git a/packages/file_selector/file_selector_macos/example/lib/open_multiple_images_page.dart b/packages/file_selector/file_selector_macos/example/lib/open_multiple_images_page.dart index 0b9fe352516..9648be318aa 100644 --- a/packages/file_selector/file_selector_macos/example/lib/open_multiple_images_page.dart +++ b/packages/file_selector/file_selector_macos/example/lib/open_multiple_images_page.dart @@ -15,11 +15,11 @@ class OpenMultipleImagesPage extends StatelessWidget { const OpenMultipleImagesPage({super.key}); Future _openImageFile(BuildContext context) async { - const XTypeGroup jpgsTypeGroup = XTypeGroup( + const jpgsTypeGroup = XTypeGroup( label: 'JPEGs', extensions: ['jpg', 'jpeg'], ); - const XTypeGroup pngTypeGroup = XTypeGroup( + const pngTypeGroup = XTypeGroup( label: 'PNGs', extensions: ['png'], ); diff --git a/packages/file_selector/file_selector_macos/example/lib/open_text_page.dart b/packages/file_selector/file_selector_macos/example/lib/open_text_page.dart index 0a50be30b83..023cd8c03a7 100644 --- a/packages/file_selector/file_selector_macos/example/lib/open_text_page.dart +++ b/packages/file_selector/file_selector_macos/example/lib/open_text_page.dart @@ -12,7 +12,7 @@ class OpenTextPage extends StatelessWidget { const OpenTextPage({super.key}); Future _openTextFile(BuildContext context) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'text', extensions: ['txt', 'json'], ); diff --git a/packages/file_selector/file_selector_macos/example/lib/save_text_page.dart b/packages/file_selector/file_selector_macos/example/lib/save_text_page.dart index c535252ead9..b7847bdcc1f 100644 --- a/packages/file_selector/file_selector_macos/example/lib/save_text_page.dart +++ b/packages/file_selector/file_selector_macos/example/lib/save_text_page.dart @@ -24,9 +24,9 @@ class SaveTextPage extends StatelessWidget { return; } final String text = _contentController.text; - final Uint8List fileData = Uint8List.fromList(text.codeUnits); - const String fileMimeType = 'text/plain'; - final XFile textFile = XFile.fromData( + final fileData = Uint8List.fromList(text.codeUnits); + const fileMimeType = 'text/plain'; + final textFile = XFile.fromData( fileData, mimeType: fileMimeType, name: fileName, diff --git a/packages/file_selector/file_selector_macos/lib/file_selector_macos.dart b/packages/file_selector/file_selector_macos/lib/file_selector_macos.dart index dbcbd345fc2..c534e43df1d 100644 --- a/packages/file_selector/file_selector_macos/lib/file_selector_macos.dart +++ b/packages/file_selector/file_selector_macos/lib/file_selector_macos.dart @@ -165,7 +165,7 @@ class FileSelectorMacOS extends FileSelectorPlatform { if (typeGroups == null || typeGroups.isEmpty) { return null; } - final AllowedTypes allowedTypes = AllowedTypes( + final allowedTypes = AllowedTypes( extensions: [], mimeTypes: [], utis: [], diff --git a/packages/file_selector/file_selector_macos/test/file_selector_macos_test.dart b/packages/file_selector/file_selector_macos/test/file_selector_macos_test.dart index 1a8d3bfcc11..58563ddcff8 100644 --- a/packages/file_selector/file_selector_macos/test/file_selector_macos_test.dart +++ b/packages/file_selector/file_selector_macos/test/file_selector_macos_test.dart @@ -50,14 +50,14 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], uniformTypeIdentifiers: ['public.text'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -97,7 +97,7 @@ void main() { }); test('throws for a type group that does not support macOS', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'images', webWildCards: ['images/*'], ); @@ -109,7 +109,7 @@ void main() { }); test('allows a wildcard group', () async { - const XTypeGroup group = XTypeGroup(label: 'text'); + const group = XTypeGroup(label: 'text'); await expectLater( plugin.openFile(acceptedTypeGroups: [group]), @@ -145,14 +145,14 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], uniformTypeIdentifiers: ['public.text'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -192,7 +192,7 @@ void main() { }); test('throws for a type group that does not support macOS', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'images', webWildCards: ['images/*'], ); @@ -204,7 +204,7 @@ void main() { }); test('allows a wildcard group', () async { - const XTypeGroup group = XTypeGroup(label: 'text'); + const group = XTypeGroup(label: 'text'); await expectLater( plugin.openFiles(acceptedTypeGroups: [group]), @@ -236,14 +236,14 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], uniformTypeIdentifiers: ['public.text'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -282,7 +282,7 @@ void main() { }); test('throws for a type group that does not support macOS', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'images', webWildCards: ['images/*'], ); @@ -294,7 +294,7 @@ void main() { }); test('allows a wildcard group', () async { - const XTypeGroup group = XTypeGroup(label: 'text'); + const group = XTypeGroup(label: 'text'); await expectLater( plugin.getSavePath(acceptedTypeGroups: [group]), @@ -349,14 +349,14 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], uniformTypeIdentifiers: ['public.text'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -401,7 +401,7 @@ void main() { }); test('throws for a type group that does not support macOS', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'images', webWildCards: ['images/*'], ); @@ -413,7 +413,7 @@ void main() { }); test('allows a wildcard group', () async { - const XTypeGroup group = XTypeGroup(label: 'text'); + const group = XTypeGroup(label: 'text'); await expectLater( plugin.getSaveLocation(acceptedTypeGroups: [group]), diff --git a/packages/file_selector/file_selector_platform_interface/test/method_channel_file_selector_test.dart b/packages/file_selector/file_selector_platform_interface/test/method_channel_file_selector_test.dart index 75f8924fcce..12b3839b8b8 100644 --- a/packages/file_selector/file_selector_platform_interface/test/method_channel_file_selector_test.dart +++ b/packages/file_selector/file_selector_platform_interface/test/method_channel_file_selector_test.dart @@ -11,9 +11,9 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); group('$MethodChannelFileSelector()', () { - final MethodChannelFileSelector plugin = MethodChannelFileSelector(); + final plugin = MethodChannelFileSelector(); - final List log = []; + final log = []; setUp(() { TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger @@ -29,14 +29,14 @@ void main() { group('#openFile', () { test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], uniformTypeIdentifiers: ['public.text'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -93,14 +93,14 @@ void main() { }); group('#openFiles', () { test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], uniformTypeIdentifiers: ['public.text'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -158,14 +158,14 @@ void main() { group('#getSavePath', () { test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], uniformTypeIdentifiers: ['public.text'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], diff --git a/packages/file_selector/file_selector_platform_interface/test/x_type_group_test.dart b/packages/file_selector/file_selector_platform_interface/test/x_type_group_test.dart index f6abcd23da5..6cfed38b5d9 100644 --- a/packages/file_selector/file_selector_platform_interface/test/x_type_group_test.dart +++ b/packages/file_selector/file_selector_platform_interface/test/x_type_group_test.dart @@ -8,12 +8,12 @@ import 'package:flutter_test/flutter_test.dart'; void main() { group('XTypeGroup', () { test('toJSON() creates correct map', () { - const List extensions = ['txt', 'jpg']; - const List mimeTypes = ['text/plain']; - const List uniformTypeIdentifiers = ['public.plain-text']; - const List webWildCards = ['image/*']; - const String label = 'test group'; - const XTypeGroup group = XTypeGroup( + const extensions = ['txt', 'jpg']; + const mimeTypes = ['text/plain']; + const uniformTypeIdentifiers = ['public.plain-text']; + const webWildCards = ['image/*']; + const label = 'test group'; + const group = XTypeGroup( label: label, extensions: extensions, mimeTypes: mimeTypes, @@ -32,7 +32,7 @@ void main() { }); test('a wildcard group can be created', () { - const XTypeGroup group = XTypeGroup(label: 'Any'); + const group = XTypeGroup(label: 'Any'); final Map jsonMap = group.toJSON(); expect(jsonMap['extensions'], null); @@ -43,7 +43,7 @@ void main() { }); test('allowsAny treats empty arrays the same as null', () { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'Any', extensions: [], mimeTypes: [], @@ -55,19 +55,19 @@ void main() { }); test('allowsAny returns false if anything is set', () { - const XTypeGroup extensionOnly = XTypeGroup( + const extensionOnly = XTypeGroup( label: 'extensions', extensions: ['txt'], ); - const XTypeGroup mimeOnly = XTypeGroup( + const mimeOnly = XTypeGroup( label: 'mime', mimeTypes: ['text/plain'], ); - const XTypeGroup utiOnly = XTypeGroup( + const utiOnly = XTypeGroup( label: 'utis', uniformTypeIdentifiers: ['public.text'], ); - const XTypeGroup webOnly = XTypeGroup( + const webOnly = XTypeGroup( label: 'web', webWildCards: ['.txt'], ); @@ -80,10 +80,10 @@ void main() { group('macUTIs -> uniformTypeIdentifiers transition', () { test('passing only macUTIs should fill uniformTypeIdentifiers', () { - const List uniformTypeIdentifiers = [ + const uniformTypeIdentifiers = [ 'public.plain-text', ]; - const XTypeGroup group = XTypeGroup(macUTIs: uniformTypeIdentifiers); + const group = XTypeGroup(macUTIs: uniformTypeIdentifiers); expect(group.uniformTypeIdentifiers, uniformTypeIdentifiers); }); @@ -91,10 +91,10 @@ void main() { test( 'passing only uniformTypeIdentifiers should fill uniformTypeIdentifiers', () { - const List uniformTypeIdentifiers = [ + const uniformTypeIdentifiers = [ 'public.plain-text', ]; - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( uniformTypeIdentifiers: uniformTypeIdentifiers, ); @@ -103,10 +103,10 @@ void main() { ); test('macUTIs getter return macUTIs value passed in constructor', () { - const List uniformTypeIdentifiers = [ + const uniformTypeIdentifiers = [ 'public.plain-text', ]; - const XTypeGroup group = XTypeGroup(macUTIs: uniformTypeIdentifiers); + const group = XTypeGroup(macUTIs: uniformTypeIdentifiers); expect(group.macUTIs, uniformTypeIdentifiers); }); @@ -114,10 +114,10 @@ void main() { test( 'macUTIs getter returns uniformTypeIdentifiers value passed in constructor', () { - const List uniformTypeIdentifiers = [ + const uniformTypeIdentifiers = [ 'public.plain-text', ]; - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( uniformTypeIdentifiers: uniformTypeIdentifiers, ); @@ -145,7 +145,7 @@ void main() { test( 'having uniformTypeIdentifiers and macUTIs as null should leave uniformTypeIdentifiers as null', () { - const XTypeGroup group = XTypeGroup(); + const group = XTypeGroup(); expect(group.uniformTypeIdentifiers, null); }, @@ -153,8 +153,8 @@ void main() { }); test('leading dots are removed from extensions', () { - const List extensions = ['.txt', '.jpg']; - const XTypeGroup group = XTypeGroup(extensions: extensions); + const extensions = ['.txt', '.jpg']; + const group = XTypeGroup(extensions: extensions); expect(group.extensions, ['txt', 'jpg']); }); diff --git a/packages/file_selector/file_selector_web/example/integration_test/dom_helper_test.dart b/packages/file_selector/file_selector_web/example/integration_test/dom_helper_test.dart index 33db0d033ee..b8b07cd0c24 100644 --- a/packages/file_selector/file_selector_web/example/integration_test/dom_helper_test.dart +++ b/packages/file_selector/file_selector_web/example/integration_test/dom_helper_test.dart @@ -17,10 +17,10 @@ void main() { late HTMLInputElement input; FileList? createFileList(List files) { - final DataTransfer dataTransfer = DataTransfer(); + final dataTransfer = DataTransfer(); // Tear-offs of external extension type interop member 'add' are disallowed. // ignore: prefer_foreach - for (final File e in files) { + for (final e in files) { dataTransfer.items.add(e); } return dataTransfer.files; @@ -46,8 +46,8 @@ void main() { }); group('getFiles', () { - final File mockFile1 = File(['123456'.toJS].toJS, 'file1.txt'); - final File mockFile2 = File([].toJS, 'file2.txt'); + final mockFile1 = File(['123456'.toJS].toJS, 'file1.txt'); + final mockFile2 = File([].toJS, 'file2.txt'); testWidgets('works', (_) async { final Future> futureFiles = domHelper.getFiles( @@ -107,8 +107,8 @@ void main() { }); testWidgets('sets the attributes and clicks it', (_) async { - const String accept = '.jpg,.png'; - const bool multiple = true; + const accept = '.jpg,.png'; + const multiple = true; final Future wasClicked = input.onClick.first.then((_) => true); final Future> futureFile = domHelper.getFiles( diff --git a/packages/file_selector/file_selector_web/example/integration_test/file_selector_web_test.dart b/packages/file_selector/file_selector_web/example/integration_test/file_selector_web_test.dart index 74187b82db5..b7d602a4345 100644 --- a/packages/file_selector/file_selector_web/example/integration_test/file_selector_web_test.dart +++ b/packages/file_selector/file_selector_web/example/integration_test/file_selector_web_test.dart @@ -19,16 +19,16 @@ void main() { testWidgets('works', (WidgetTester _) async { final XFile mockFile = createXFile('1001', 'identity.png'); - final MockDomHelper mockDomHelper = MockDomHelper( + final mockDomHelper = MockDomHelper( files: [mockFile], expectAccept: '.jpg,.jpeg,image/png,image/*', ); - final FileSelectorWeb plugin = FileSelectorWeb( + final plugin = FileSelectorWeb( domHelper: mockDomHelper, ); - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'images', extensions: ['jpg', 'jpeg'], mimeTypes: ['image/png'], @@ -50,9 +50,9 @@ void main() { WidgetTester _, ) async { // Simulate returning an empty list of files from the DomHelper... - final MockDomHelper mockDomHelper = MockDomHelper(files: []); + final mockDomHelper = MockDomHelper(files: []); - final FileSelectorWeb plugin = FileSelectorWeb( + final plugin = FileSelectorWeb( domHelper: mockDomHelper, ); @@ -67,17 +67,17 @@ void main() { final XFile mockFile1 = createXFile('123456', 'file1.txt'); final XFile mockFile2 = createXFile('', 'file2.txt'); - final MockDomHelper mockDomHelper = MockDomHelper( + final mockDomHelper = MockDomHelper( files: [mockFile1, mockFile2], expectAccept: '.txt', expectMultiple: true, ); - final FileSelectorWeb plugin = FileSelectorWeb( + final plugin = FileSelectorWeb( domHelper: mockDomHelper, ); - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'files', extensions: ['.txt'], ); @@ -102,7 +102,7 @@ void main() { group('getSavePath', () { testWidgets('returns non-null', (WidgetTester _) async { - final FileSelectorWeb plugin = FileSelectorWeb(); + final plugin = FileSelectorWeb(); final Future savePath = plugin.getSavePath(); expect(await savePath, isNotNull); }); @@ -144,6 +144,6 @@ class MockDomHelper implements DomHelper { } XFile createXFile(String content, String name) { - final Uint8List data = Uint8List.fromList(content.codeUnits); + final data = Uint8List.fromList(content.codeUnits); return XFile.fromData(data, name: name, lastModified: DateTime.now()); } diff --git a/packages/file_selector/file_selector_web/lib/src/dom_helper.dart b/packages/file_selector/file_selector_web/lib/src/dom_helper.dart index d1070ff4c77..2c0205c6155 100644 --- a/packages/file_selector/file_selector_web/lib/src/dom_helper.dart +++ b/packages/file_selector/file_selector_web/lib/src/dom_helper.dart @@ -26,7 +26,7 @@ class DomHelper { bool multiple = false, @visibleForTesting HTMLInputElement? input, }) { - final Completer> completer = Completer>(); + final completer = Completer>(); final HTMLInputElement inputElement = input ?? (document.createElement('input') as HTMLInputElement) ..type = 'file'; @@ -47,8 +47,8 @@ class DomHelper { }); inputElement.onError.first.then((Event event) { - final ErrorEvent error = event as ErrorEvent; - final PlatformException platformException = PlatformException( + final error = event as ErrorEvent; + final platformException = PlatformException( code: error.type, message: error.message, ); diff --git a/packages/file_selector/file_selector_web/lib/src/utils.dart b/packages/file_selector/file_selector_web/lib/src/utils.dart index 8f871ceacf1..d64b69f62a6 100644 --- a/packages/file_selector/file_selector_web/lib/src/utils.dart +++ b/packages/file_selector/file_selector_web/lib/src/utils.dart @@ -9,7 +9,7 @@ String acceptedTypesToString(List? acceptedTypes) { if (acceptedTypes == null) { return ''; } - final List allTypes = []; + final allTypes = []; for (final XTypeGroup group in acceptedTypes) { // If any group allows everything, no filtering should be done. if (group.allowsAny) { diff --git a/packages/file_selector/file_selector_web/test/utils_test.dart b/packages/file_selector/file_selector_web/test/utils_test.dart index 7a86f03e113..33d76d4380e 100644 --- a/packages/file_selector/file_selector_web/test/utils_test.dart +++ b/packages/file_selector/file_selector_web/test/utils_test.dart @@ -13,7 +13,7 @@ void main() { group('FileSelectorWeb utils', () { group('acceptedTypesToString', () { test('works', () { - const List acceptedTypes = [ + const acceptedTypes = [ XTypeGroup(label: 'images', webWildCards: ['images/*']), XTypeGroup(label: 'jpgs', extensions: ['jpg', 'jpeg']), XTypeGroup(label: 'pngs', mimeTypes: ['image/png']), @@ -23,13 +23,13 @@ void main() { }); test('works with an empty list', () { - const List acceptedTypes = []; + const acceptedTypes = []; final String accepts = acceptedTypesToString(acceptedTypes); expect(accepts, ''); }); test('works with extensions', () { - const List acceptedTypes = [ + const acceptedTypes = [ XTypeGroup(label: 'jpgs', extensions: ['jpeg', 'jpg']), XTypeGroup(label: 'pngs', extensions: ['png']), ]; @@ -38,7 +38,7 @@ void main() { }); test('works with mime types', () { - const List acceptedTypes = [ + const acceptedTypes = [ XTypeGroup( label: 'jpgs', mimeTypes: ['image/jpeg', 'image/jpg'], @@ -50,7 +50,7 @@ void main() { }); test('works with web wild cards', () { - const List acceptedTypes = [ + const acceptedTypes = [ XTypeGroup(label: 'images', webWildCards: ['image/*']), XTypeGroup(label: 'audios', webWildCards: ['audio/*']), XTypeGroup(label: 'videos', webWildCards: ['video/*']), @@ -60,7 +60,7 @@ void main() { }); test('throws for a type group that does not support web', () { - const List acceptedTypes = [ + const acceptedTypes = [ XTypeGroup( label: 'text', uniformTypeIdentifiers: ['public.text'], diff --git a/packages/file_selector/file_selector_windows/example/lib/get_directory_page.dart b/packages/file_selector/file_selector_windows/example/lib/get_directory_page.dart index e483b8c640c..70e4aab79e1 100644 --- a/packages/file_selector/file_selector_windows/example/lib/get_directory_page.dart +++ b/packages/file_selector/file_selector_windows/example/lib/get_directory_page.dart @@ -12,7 +12,7 @@ class GetDirectoryPage extends StatelessWidget { const GetDirectoryPage({super.key}); Future _getDirectoryPath(BuildContext context) async { - const String confirmButtonText = 'Choose'; + const confirmButtonText = 'Choose'; final String? directoryPath = await FileSelectorPlatform.instance .getDirectoryPath(confirmButtonText: confirmButtonText); if (directoryPath == null) { diff --git a/packages/file_selector/file_selector_windows/example/lib/get_multiple_directories_page.dart b/packages/file_selector/file_selector_windows/example/lib/get_multiple_directories_page.dart index be1bdfd40a0..6f4ba9ed8c7 100644 --- a/packages/file_selector/file_selector_windows/example/lib/get_multiple_directories_page.dart +++ b/packages/file_selector/file_selector_windows/example/lib/get_multiple_directories_page.dart @@ -12,7 +12,7 @@ class GetMultipleDirectoriesPage extends StatelessWidget { const GetMultipleDirectoriesPage({super.key}); Future _getDirectoryPaths(BuildContext context) async { - const String confirmButtonText = 'Choose'; + const confirmButtonText = 'Choose'; final List directoriesPaths = await FileSelectorPlatform.instance .getDirectoryPaths(confirmButtonText: confirmButtonText); if (directoriesPaths.isEmpty) { diff --git a/packages/file_selector/file_selector_windows/example/lib/open_image_page.dart b/packages/file_selector/file_selector_windows/example/lib/open_image_page.dart index f5705d244ad..6554cbfb8b8 100644 --- a/packages/file_selector/file_selector_windows/example/lib/open_image_page.dart +++ b/packages/file_selector/file_selector_windows/example/lib/open_image_page.dart @@ -15,7 +15,7 @@ class OpenImagePage extends StatelessWidget { const OpenImagePage({super.key}); Future _openImageFile(BuildContext context) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'images', extensions: ['jpg', 'png'], ); diff --git a/packages/file_selector/file_selector_windows/example/lib/open_multiple_images_page.dart b/packages/file_selector/file_selector_windows/example/lib/open_multiple_images_page.dart index 0b9fe352516..9648be318aa 100644 --- a/packages/file_selector/file_selector_windows/example/lib/open_multiple_images_page.dart +++ b/packages/file_selector/file_selector_windows/example/lib/open_multiple_images_page.dart @@ -15,11 +15,11 @@ class OpenMultipleImagesPage extends StatelessWidget { const OpenMultipleImagesPage({super.key}); Future _openImageFile(BuildContext context) async { - const XTypeGroup jpgsTypeGroup = XTypeGroup( + const jpgsTypeGroup = XTypeGroup( label: 'JPEGs', extensions: ['jpg', 'jpeg'], ); - const XTypeGroup pngTypeGroup = XTypeGroup( + const pngTypeGroup = XTypeGroup( label: 'PNGs', extensions: ['png'], ); diff --git a/packages/file_selector/file_selector_windows/example/lib/open_text_page.dart b/packages/file_selector/file_selector_windows/example/lib/open_text_page.dart index 0a50be30b83..023cd8c03a7 100644 --- a/packages/file_selector/file_selector_windows/example/lib/open_text_page.dart +++ b/packages/file_selector/file_selector_windows/example/lib/open_text_page.dart @@ -12,7 +12,7 @@ class OpenTextPage extends StatelessWidget { const OpenTextPage({super.key}); Future _openTextFile(BuildContext context) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'text', extensions: ['txt', 'json'], ); diff --git a/packages/file_selector/file_selector_windows/example/lib/save_text_page.dart b/packages/file_selector/file_selector_windows/example/lib/save_text_page.dart index 4999d0a86a3..ff45a7c969f 100644 --- a/packages/file_selector/file_selector_windows/example/lib/save_text_page.dart +++ b/packages/file_selector/file_selector_windows/example/lib/save_text_page.dart @@ -42,8 +42,8 @@ class SaveTextPage extends StatelessWidget { } } final String text = _contentController.text; - final Uint8List fileData = Uint8List.fromList(text.codeUnits); - final XFile textFile = XFile.fromData(fileData, name: fileName); + final fileData = Uint8List.fromList(text.codeUnits); + final textFile = XFile.fromData(fileData, name: fileName); await textFile.saveTo(result.path); } diff --git a/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart b/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart index f062513bafe..30349f956f7 100644 --- a/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart +++ b/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart @@ -39,13 +39,13 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -75,7 +75,7 @@ void main() { }); test('throws for a type group that does not support Windows', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', mimeTypes: ['text/plain'], ); @@ -87,7 +87,7 @@ void main() { }); test('allows a wildcard group', () async { - const XTypeGroup group = XTypeGroup(label: 'text'); + const group = XTypeGroup(label: 'text'); await expectLater( plugin.openFile(acceptedTypeGroups: [group]), @@ -111,13 +111,13 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -147,7 +147,7 @@ void main() { }); test('throws for a type group that does not support Windows', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', mimeTypes: ['text/plain'], ); @@ -159,7 +159,7 @@ void main() { }); test('allows a wildcard group', () async { - const XTypeGroup group = XTypeGroup(label: 'text'); + const group = XTypeGroup(label: 'text'); await expectLater( plugin.openFiles(acceptedTypeGroups: [group]), @@ -236,13 +236,13 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -264,13 +264,13 @@ void main() { test('returns the selected type group correctly', () async { api.result = ['foo']; api.resultTypeGroupIndex = 1; - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -310,7 +310,7 @@ void main() { }); test('throws for a type group that does not support Windows', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', mimeTypes: ['text/plain'], ); @@ -322,7 +322,7 @@ void main() { }); test('allows a wildcard group', () async { - const XTypeGroup group = XTypeGroup(label: 'text'); + const group = XTypeGroup(label: 'text'); await expectLater( plugin.getSaveLocation(acceptedTypeGroups: [group]), @@ -345,13 +345,13 @@ void main() { }); test('passes the accepted type groups correctly', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', extensions: ['txt'], mimeTypes: ['text/plain'], ); - const XTypeGroup groupTwo = XTypeGroup( + const groupTwo = XTypeGroup( label: 'image', extensions: ['jpg'], mimeTypes: ['image/jpg'], @@ -389,7 +389,7 @@ void main() { }); test('throws for a type group that does not support Windows', () async { - const XTypeGroup group = XTypeGroup( + const group = XTypeGroup( label: 'text', mimeTypes: ['text/plain'], ); @@ -401,7 +401,7 @@ void main() { }); test('allows a wildcard group', () async { - const XTypeGroup group = XTypeGroup(label: 'text'); + const group = XTypeGroup(label: 'text'); await expectLater( plugin.getSavePath(acceptedTypeGroups: [group]), @@ -419,7 +419,7 @@ bool _typeGroupListsMatch(List a, List b) { if (a.length != b.length) { return false; } - for (int i = 0; i < a.length; i++) { + for (var i = 0; i < a.length; i++) { if (!_typeGroupsMatch(a[i], b[i])) { return false; } diff --git a/packages/go_router/example/lib/async_redirection.dart b/packages/go_router/example/lib/async_redirection.dart index ddba52ac036..b36de3b190d 100644 --- a/packages/go_router/example/lib/async_redirection.dart +++ b/packages/go_router/example/lib/async_redirection.dart @@ -55,7 +55,7 @@ class App extends StatelessWidget { // cause go_router to reparse current route if StreamAuth has new sign-in // information. final bool loggedIn = await StreamAuthScope.of(context).isSignedIn(); - final bool loggingIn = state.matchedLocation == '/login'; + final loggingIn = state.matchedLocation == '/login'; if (!loggedIn) { return '/login'; } diff --git a/packages/go_router/example/lib/books/main.dart b/packages/go_router/example/lib/books/main.dart index 8652f0dbd0e..083ce373786 100644 --- a/packages/go_router/example/lib/books/main.dart +++ b/packages/go_router/example/lib/books/main.dart @@ -128,7 +128,7 @@ class Bookstore extends StatelessWidget { String? _guard(BuildContext context, GoRouterState state) { final bool signedIn = _auth.signedIn; - final bool signingIn = state.matchedLocation == '/signin'; + final signingIn = state.matchedLocation == '/signin'; // Go to /signin if the user is not signed in if (!signedIn && !signingIn) { diff --git a/packages/go_router/example/lib/books/src/data/library.dart b/packages/go_router/example/lib/books/src/data/library.dart index a211026ff5f..769b078e29b 100644 --- a/packages/go_router/example/lib/books/src/data/library.dart +++ b/packages/go_router/example/lib/books/src/data/library.dart @@ -50,13 +50,13 @@ class Library { final Author author = allAuthors.firstWhere( (Author author) => author.name == authorName, orElse: () { - final Author value = Author(id: allAuthors.length, name: authorName); + final value = Author(id: allAuthors.length, name: authorName); allAuthors.add(value); return value; }, ); - final Book book = Book( + final book = Book( id: allBooks.length, title: title, isPopular: isPopular, diff --git a/packages/go_router/example/lib/extra_codec.dart b/packages/go_router/example/lib/extra_codec.dart index 5667986dd01..a273b8cf0c6 100644 --- a/packages/go_router/example/lib/extra_codec.dart +++ b/packages/go_router/example/lib/extra_codec.dart @@ -109,7 +109,7 @@ class _MyExtraDecoder extends Converter { if (input == null) { return null; } - final List inputAsList = input as List; + final inputAsList = input as List; if (inputAsList[0] == 'ComplexData1') { return ComplexData1(inputAsList[1]! as String); } diff --git a/packages/go_router/example/lib/others/extra_param.dart b/packages/go_router/example/lib/others/extra_param.dart index 9644aab6708..0b0b2d5bc5e 100644 --- a/packages/go_router/example/lib/others/extra_param.dart +++ b/packages/go_router/example/lib/others/extra_param.dart @@ -71,7 +71,7 @@ class App extends StatelessWidget { builder: (BuildContext context, GoRouterState state) { final Map params = state.extra! as Map; - final String fid = params['fid']! as String; + final fid = params['fid']! as String; return FamilyScreen(fid: fid); }, ), diff --git a/packages/go_router/example/lib/redirection.dart b/packages/go_router/example/lib/redirection.dart index 449324b93c3..19ac494884e 100644 --- a/packages/go_router/example/lib/redirection.dart +++ b/packages/go_router/example/lib/redirection.dart @@ -75,7 +75,7 @@ class App extends StatelessWidget { redirect: (BuildContext context, GoRouterState state) { // if the user is not logged in, they need to login final bool loggedIn = _loginInfo.loggedIn; - final bool loggingIn = state.matchedLocation == '/login'; + final loggingIn = state.matchedLocation == '/login'; if (!loggedIn) { return '/login'; } diff --git a/packages/go_router/example/lib/top_level_on_enter.dart b/packages/go_router/example/lib/top_level_on_enter.dart index 30cd06a83cc..58b63c8a32f 100644 --- a/packages/go_router/example/lib/top_level_on_enter.dart +++ b/packages/go_router/example/lib/top_level_on_enter.dart @@ -33,7 +33,7 @@ class App extends StatelessWidget { @override Widget build(BuildContext context) { - final GlobalKey key = GlobalKey(); + final key = GlobalKey(); return MaterialApp.router( routerConfig: _router(key), @@ -132,7 +132,7 @@ class App extends StatelessWidget { case '/protected': { // ignore: prefer_final_locals - bool isLoggedIn = false; // pretend we’re not authenticated + var isLoggedIn = false; // pretend we’re not authenticated if (!isLoggedIn) { // Chaining block: cancel the original nav, then redirect to /login. // This preserves redirection history to detect loops. diff --git a/packages/go_router/example/test/extra_codec_test.dart b/packages/go_router/example/test/extra_codec_test.dart index 8ada596d54e..345698e67e9 100644 --- a/packages/go_router/example/test/extra_codec_test.dart +++ b/packages/go_router/example/test/extra_codec_test.dart @@ -26,8 +26,8 @@ void main() { }); test('invalid extra throws', () { - const example.MyExtraCodec extraCodec = example.MyExtraCodec(); - const List invalidValue = ['invalid']; + const extraCodec = example.MyExtraCodec(); + const invalidValue = ['invalid']; expect( () => extraCodec.decode(invalidValue), diff --git a/packages/go_router/example/test/path_and_query_params_test.dart b/packages/go_router/example/test/path_and_query_params_test.dart index 68a4760dca1..19ec52d0614 100644 --- a/packages/go_router/example/test/path_and_query_params_test.dart +++ b/packages/go_router/example/test/path_and_query_params_test.dart @@ -12,7 +12,7 @@ void main() { expect(find.text(example.App.title), findsOneWidget); // Directly set the url through platform message. - Map testRouteInformation = { + var testRouteInformation = { 'location': '/family/f1?sort=asc', }; ByteData message = const JSONMethodCodec().encodeMethodCall( diff --git a/packages/go_router/example/test/redirection_test.dart b/packages/go_router/example/test/redirection_test.dart index 23d01ae8cb7..15dc0f0ed96 100644 --- a/packages/go_router/example/test/redirection_test.dart +++ b/packages/go_router/example/test/redirection_test.dart @@ -13,7 +13,7 @@ void main() { expect(find.text('Login'), findsOneWidget); // Directly set the url to the home page. - Map testRouteInformation = { + var testRouteInformation = { 'location': '/', }; ByteData message = const JSONMethodCodec().encodeMethodCall( diff --git a/packages/go_router/example/test/state_restoration/go_route_state_restoration_test.dart b/packages/go_router/example/test/state_restoration/go_route_state_restoration_test.dart index 4e76dbbcc75..e471c0acdac 100644 --- a/packages/go_router/example/test/state_restoration/go_route_state_restoration_test.dart +++ b/packages/go_router/example/test/state_restoration/go_route_state_restoration_test.dart @@ -11,11 +11,11 @@ void main() { 'is restored when restorationIds are provided', ( WidgetTester tester, ) async { - const String homeTitle = 'Home'; - const String loginTitle = 'Login'; + const homeTitle = 'Home'; + const loginTitle = 'Login'; - const String homeText = 'homeText'; - const String loginText = 'loginText'; + const homeText = 'homeText'; + const loginText = 'loginText'; await tester.pumpWidget(const App()); expect(find.text(homeTitle), findsOneWidget); diff --git a/packages/go_router/example/test/state_restoration/shell_route_state_restoration_test.dart b/packages/go_router/example/test/state_restoration/shell_route_state_restoration_test.dart index e551bc730cb..98b3dd07521 100644 --- a/packages/go_router/example/test/state_restoration/shell_route_state_restoration_test.dart +++ b/packages/go_router/example/test/state_restoration/shell_route_state_restoration_test.dart @@ -11,12 +11,12 @@ void main() { 'is restored when restorationIds are provided', ( WidgetTester tester, ) async { - const String homeTitle = 'Home'; - const String welcomeTitle = 'Welcome'; - const String setupTitle = 'Setup'; + const homeTitle = 'Home'; + const welcomeTitle = 'Welcome'; + const setupTitle = 'Setup'; - const String homeText = 'homeText'; - const String setupText = 'setupText'; + const homeText = 'homeText'; + const setupText = 'setupText'; await tester.pumpWidget(const App()); expect(find.text(homeTitle), findsOneWidget); diff --git a/packages/go_router/example/test/state_restoration/stateful_shell_route_state_restoration_test.dart b/packages/go_router/example/test/state_restoration/stateful_shell_route_state_restoration_test.dart index f8a9e892f62..2f4cd106878 100644 --- a/packages/go_router/example/test/state_restoration/stateful_shell_route_state_restoration_test.dart +++ b/packages/go_router/example/test/state_restoration/stateful_shell_route_state_restoration_test.dart @@ -11,11 +11,11 @@ void main() { 'is restored when restorationIds are provided', ( WidgetTester tester, ) async { - const String homeLabel = 'Home'; - const String profileLabel = 'Profile'; + const homeLabel = 'Home'; + const profileLabel = 'Profile'; - const String homeText = 'homeText'; - const String profileText = 'profileText'; + const homeText = 'homeText'; + const profileText = 'profileText'; await tester.pumpWidget(const App()); expect(find.widgetWithText(TextField, homeLabel), findsOneWidget); diff --git a/packages/go_router/lib/src/builder.dart b/packages/go_router/lib/src/builder.dart index dd6f89f10f3..b36e8c9d99d 100644 --- a/packages/go_router/lib/src/builder.dart +++ b/packages/go_router/lib/src/builder.dart @@ -201,10 +201,10 @@ class _CustomNavigatorState extends State<_CustomNavigator> { void _updatePages(BuildContext context) { assert(_pages == null); - final List> pages = >[]; - final Map, RouteMatchBase> pageToRouteMatchBase = + final pages = >[]; + final pageToRouteMatchBase = , RouteMatchBase>{}; - final Map, GoRouterState> registry = + final registry = , GoRouterState>{}; if (widget.matchList.isError) { pages.add(_buildErrorPage(context, widget.matchList)); @@ -280,7 +280,7 @@ class _CustomNavigatorState extends State<_CustomNavigator> { widget.matchList, ); final GlobalKey navigatorKey = match.navigatorKey; - final ShellRouteContext shellRouteContext = ShellRouteContext( + final shellRouteContext = ShellRouteContext( route: match.route, routerState: state, navigatorKey: navigatorKey, @@ -443,7 +443,7 @@ class _CustomNavigatorState extends State<_CustomNavigator> { } bool _handlePopPage(Route route, Object? result) { - final Page page = route.settings as Page; + final page = route.settings as Page; final RouteMatchBase match = _pageToRouteMatchBase[page]!; return widget.onPopPageWithRouteMatch(route, result, match); } diff --git a/packages/go_router/lib/src/configuration.dart b/packages/go_router/lib/src/configuration.dart index 4a22c3e1c5f..ef408b44270 100644 --- a/packages/go_router/lib/src/configuration.dart +++ b/packages/go_router/lib/src/configuration.dart @@ -37,7 +37,7 @@ class RouteConfiguration { } static bool _debugCheckPath(List routes, bool isTopLevel) { - for (final RouteBase route in routes) { + for (final route in routes) { late bool subRouteIsTopLevel; if (route is GoRoute) { if (route.path != '/') { @@ -61,7 +61,7 @@ class RouteConfiguration { List routes, List> allowedKeys, ) { - for (final RouteBase route in routes) { + for (final route in routes) { if (route is GoRoute) { final GlobalKey? parentKey = route.parentNavigatorKey; if (parentKey != null) { @@ -115,13 +115,13 @@ class RouteConfiguration { List routes, Map usedPathParams, ) { - for (final RouteBase route in routes) { + for (final route in routes) { if (route is! GoRoute) { continue; } for (final String pathParam in route.pathParameters) { if (usedPathParams.containsKey(pathParam)) { - final bool sameRoute = usedPathParams[pathParam] == route; + final sameRoute = usedPathParams[pathParam] == route; throw GoError( "duplicate path parameter, '$pathParam' found in ${sameRoute ? '$route' : '${usedPathParams[pathParam]}, and $route'}", ); @@ -137,7 +137,7 @@ class RouteConfiguration { // Check to see that the configured initialLocation of StatefulShellBranches // points to a descendant route of the route branch. bool _debugCheckStatefulShellBranchDefaultLocations(List routes) { - for (final RouteBase route in routes) { + for (final route in routes) { if (route is StatefulShellRoute) { for (final StatefulShellBranch branch in route.branches) { if (branch.initialLocation == null) { @@ -168,7 +168,7 @@ class RouteConfiguration { ); final List matchRoutes = matchList.routes; final int shellIndex = matchRoutes.indexOf(route); - bool matchFound = false; + var matchFound = false; if (shellIndex >= 0 && (shellIndex + 1) < matchRoutes.length) { final RouteBase branchRoot = matchRoutes[shellIndex + 1]; matchFound = branch.routes.contains(branchRoot); @@ -314,9 +314,9 @@ class RouteConfiguration { final _NamedPath path = _nameToPath[name]!; assert(() { // Check that all required params are present - final List paramNames = []; + final paramNames = []; patternToRegExp(path.path, paramNames, caseSensitive: path.caseSensitive); - for (final String paramName in paramNames) { + for (final paramName in paramNames) { assert( pathParameters.containsKey(paramName), 'missing param "$paramName" for $path', @@ -329,7 +329,7 @@ class RouteConfiguration { } return true; }()); - final Map encodedParams = { + final encodedParams = { for (final MapEntry param in pathParameters.entries) param.key: Uri.encodeComponent(param.value), }; @@ -343,7 +343,7 @@ class RouteConfiguration { /// Finds the routes that matched the given URL. RouteMatchList findMatch(Uri uri, {Object? extra}) { - final Map pathParameters = {}; + final pathParameters = {}; final List matches = _getLocRouteMatches( uri, pathParameters, @@ -370,7 +370,7 @@ class RouteConfiguration { for (final ImperativeRouteMatch imperativeMatch in matchList.matches.whereType()) { - final ImperativeRouteMatch match = ImperativeRouteMatch( + final match = ImperativeRouteMatch( pageKey: imperativeMatch.pageKey, matches: findMatch( imperativeMatch.matches.uri, @@ -411,7 +411,7 @@ class RouteConfiguration { required List redirectHistory, }) { FutureOr processRedirect(RouteMatchList prevMatchList) { - final String prevLocation = prevMatchList.uri.toString(); + final prevLocation = prevMatchList.uri.toString(); FutureOr processRouteLevelRedirect( String? routeRedirectLocation, @@ -432,7 +432,7 @@ class RouteConfiguration { return prevMatchList; } - final List routeMatches = []; + final routeMatches = []; prevMatchList.visitRouteMatches((RouteMatchBase match) { if (match.route.redirect != null) { routeMatches.add(match); @@ -492,7 +492,7 @@ class RouteConfiguration { RouteMatchList prevMatchList, { required List redirectHistory, }) { - final String prevLocation = prevMatchList.uri.toString(); + final prevLocation = prevMatchList.uri.toString(); FutureOr done(String? topLocation) { if (topLocation != null && topLocation != prevLocation) { final RouteMatchList newMatch = _getNewMatches( @@ -643,7 +643,7 @@ class RouteConfiguration { } T? result; - bool errorOccurred = false; + var errorOccurred = false; runZonedGuarded( () { @@ -686,7 +686,7 @@ class RouteConfiguration { /// is also appended if not null @visibleForTesting String debugKnownRoutes() { - final StringBuffer sb = StringBuffer(); + final sb = StringBuffer(); sb.writeln('Full paths for routes:'); _debugFullPathsFor( _routingConfig.value.routes, @@ -722,7 +722,7 @@ class RouteConfiguration { final String decorationString = decoration .map((_DecorationType e) => e.toString()) .join(); - String path = parentFullpath; + var path = parentFullpath; if (route is GoRoute) { path = concatenatePaths(parentFullpath, route.path); final String? screenName = route.builder?.runtimeType @@ -769,7 +769,7 @@ class RouteConfiguration { } void _cacheNameToPath(String parentFullPath, List childRoutes) { - for (final RouteBase route in childRoutes) { + for (final route in childRoutes) { if (route is GoRoute) { final String fullPath = concatenatePaths(parentFullPath, route.path); diff --git a/packages/go_router/lib/src/delegate.dart b/packages/go_router/lib/src/delegate.dart index 229c9865b1a..37e56987e35 100644 --- a/packages/go_router/lib/src/delegate.dart +++ b/packages/go_router/lib/src/delegate.dart @@ -56,7 +56,7 @@ class GoRouterDelegate extends RouterDelegate @override Future popRoute() async { final Iterable states = _findCurrentNavigators(); - for (final NavigatorState state in states) { + for (final state in states) { final bool didPop = await state.maybePop(); // Call maybePop() directly if (didPop) { return true; // Return true if maybePop handled the pop @@ -114,7 +114,7 @@ class GoRouterDelegate extends RouterDelegate /// 2. Branch route /// 3. Parent route Iterable _findCurrentNavigators() { - final List states = []; + final states = []; if (navigatorKey.currentState != null) { // Set state directly without canPop check states.add(navigatorKey.currentState!); @@ -179,7 +179,7 @@ class GoRouterDelegate extends RouterDelegate } void _completeRouteMatch(Object? result, RouteMatchBase match) { - RouteMatchBase walker = match; + var walker = match; while (walker is ShellRouteMatch) { walker = walker.matches.last; } @@ -230,14 +230,14 @@ class GoRouterDelegate extends RouterDelegate final BuildContext? navigatorContext = navigatorKey.currentContext; // If navigator is not built or disposed, the GoRoute.onExit is irrelevant. if (navigatorContext != null) { - final List currentGoRouteMatches = []; + final currentGoRouteMatches = []; currentConfiguration.visitRouteMatches((RouteMatchBase match) { if (match is RouteMatch) { currentGoRouteMatches.add(match); } return true; }); - final List newGoRouteMatches = []; + final newGoRouteMatches = []; configuration.visitRouteMatches((RouteMatchBase match) { if (match is RouteMatch) { newGoRouteMatches.add(match); @@ -249,7 +249,7 @@ class GoRouterDelegate extends RouterDelegate currentGoRouteMatches.length, newGoRouteMatches.length, ); - int indexOfFirstDiff = 0; + var indexOfFirstDiff = 0; for (; indexOfFirstDiff < compareUntil; indexOfFirstDiff++) { if (currentGoRouteMatches[indexOfFirstDiff] != newGoRouteMatches[indexOfFirstDiff]) { diff --git a/packages/go_router/lib/src/information_provider.dart b/packages/go_router/lib/src/information_provider.dart index 3824490c1e8..67a985940e0 100644 --- a/packages/go_router/lib/src/information_provider.dart +++ b/packages/go_router/lib/src/information_provider.dart @@ -184,7 +184,7 @@ class GoRouteInformationProvider extends RouteInformationProvider required RouteMatchList base, Object? extra, }) { - final Completer completer = Completer(); + final completer = Completer(); _setValue( location, RouteInformationState( @@ -224,7 +224,7 @@ class GoRouteInformationProvider extends RouteInformationProvider required RouteMatchList base, Object? extra, }) { - final Completer completer = Completer(); + final completer = Completer(); _setValue( location, RouteInformationState( @@ -243,7 +243,7 @@ class GoRouteInformationProvider extends RouteInformationProvider required RouteMatchList base, Object? extra, }) { - final Completer completer = Completer(); + final completer = Completer(); _setValue( location, RouteInformationState( @@ -278,7 +278,7 @@ class GoRouteInformationProvider extends RouteInformationProvider required Uri newLocationUri, required Object? newState, }) { - const DeepCollectionEquality deepCollectionEquality = + const deepCollectionEquality = DeepCollectionEquality(); return !deepCollectionEquality.equals( _value.uri.path, diff --git a/packages/go_router/lib/src/match.dart b/packages/go_router/lib/src/match.dart index b8ddbaac9c2..05124be0a5b 100644 --- a/packages/go_router/lib/src/match.dart +++ b/packages/go_router/lib/src/match.dart @@ -592,7 +592,7 @@ class RouteMatchList with Diagnosticable { /// [RouteMatchA(), RouteMatchB(), RouteMatchC()] /// ``` static String _generateFullPath(Iterable matches) { - String fullPath = ''; + var fullPath = ''; for (final RouteMatchBase match in matches.where( (RouteMatchBase match) => match is! ImperativeRouteMatch, )) { @@ -641,7 +641,7 @@ class RouteMatchList with Diagnosticable { newMatches.isNotEmpty && otherMatches.last.route == newMatches.last.route) { assert(newMatches.last is ShellRouteMatch); - final ShellRouteMatch lastShellRouteMatch = + final lastShellRouteMatch = newMatches.removeLast() as ShellRouteMatch; newMatches.add( // Create a new copy of the `lastShellRouteMatch`. @@ -704,14 +704,14 @@ class RouteMatchList with Diagnosticable { } newRoute as GoRoute; // Need to remove path parameters that are no longer in the fullPath. - final List newParameters = []; + final newParameters = []; patternToRegExp( fullPath, newParameters, caseSensitive: newRoute.caseSensitive, ); final Set validParameters = newParameters.toSet(); - final Map newPathParameters = + final newPathParameters = Map.fromEntries( pathParameters.entries.where( (MapEntry value) => @@ -808,7 +808,7 @@ class RouteMatchList with Diagnosticable { /// The routes for each of the matches. List get routes { - final List result = []; + final result = []; visitRouteMatches((RouteMatchBase match) { result.add(match.route); return true; @@ -831,7 +831,7 @@ class RouteMatchList with Diagnosticable { List matches, RouteMatchVisitor visitor, ) { - for (final RouteMatchBase routeMatch in matches) { + for (final routeMatch in matches) { if (!visitor(routeMatch)) { return false; } @@ -939,7 +939,7 @@ class _RouteMatchListEncoder final RouteConfiguration configuration; @override Map convert(RouteMatchList input) { - final List imperativeMatches = + final imperativeMatches = []; input.visitRouteMatches((RouteMatchBase match) { if (match is ImperativeRouteMatch) { @@ -1016,9 +1016,9 @@ class _RouteMatchListDecoder @override RouteMatchList convert(Map input) { - final String rootLocation = + final rootLocation = input[RouteMatchListCodec._locationKey]! as String; - final Map encodedExtra = + final encodedExtra = input[RouteMatchListCodec._extraKey]! as Map; final Object? extra; @@ -1037,7 +1037,7 @@ class _RouteMatchListDecoder extra: extra, ); - final List? imperativeMatches = + final imperativeMatches = input[RouteMatchListCodec._imperativeMatchesKey] as List?; if (imperativeMatches != null) { for (final Map encodedImperativeMatch @@ -1045,10 +1045,10 @@ class _RouteMatchListDecoder final RouteMatchList imperativeMatchList = convert( encodedImperativeMatch, ); - final ValueKey pageKey = ValueKey( + final pageKey = ValueKey( encodedImperativeMatch[RouteMatchListCodec._pageKey]! as String, ); - final ImperativeRouteMatch imperativeMatch = ImperativeRouteMatch( + final imperativeMatch = ImperativeRouteMatch( pageKey: pageKey, // TODO(chunhtai): Figure out a way to preserve future. // https://github.com/flutter/flutter/issues/128122. diff --git a/packages/go_router/lib/src/parser.dart b/packages/go_router/lib/src/parser.dart index 288682d1603..f4a2d44423a 100644 --- a/packages/go_router/lib/src/parser.dart +++ b/packages/go_router/lib/src/parser.dart @@ -119,7 +119,7 @@ class GoRouteInformationParser extends RouteInformationParser { effectiveRoute.uri, extra: infoState.extra, ); - final List redirectHistory = []; + final redirectHistory = []; final FutureOr afterLegacy = configuration .applyTopLegacyRedirect( diff --git a/packages/go_router/lib/src/path_utils.dart b/packages/go_router/lib/src/path_utils.dart index 29aec2c475f..ed1ce7cc201 100644 --- a/packages/go_router/lib/src/path_utils.dart +++ b/packages/go_router/lib/src/path_utils.dart @@ -28,8 +28,8 @@ RegExp patternToRegExp( List parameters, { required bool caseSensitive, }) { - final StringBuffer buffer = StringBuffer('^'); - int start = 0; + final buffer = StringBuffer('^'); + var start = 0; for (final RegExpMatch match in _parameterRegExp.allMatches(pattern)) { if (match.start > start) { buffer.write(RegExp.escape(pattern.substring(start, match.start))); @@ -78,8 +78,8 @@ String _escapeGroup(String group, [String? name]) { /// 2. Call [patternToPath] with the `pathParameters` from the first step and /// the original `pattern` used for generating the [RegExp]. String patternToPath(String pattern, Map pathParameters) { - final StringBuffer buffer = StringBuffer(); - int start = 0; + final buffer = StringBuffer(); + var start = 0; for (final RegExpMatch match in _parameterRegExp.allMatches(pattern)) { if (match.start > start) { buffer.write(pattern.substring(start, match.start)); @@ -139,7 +139,7 @@ String canonicalUri(String loc) { if (loc.isEmpty) { throw GoException('Location cannot be empty.'); } - String canon = Uri.parse(loc).toString(); + var canon = Uri.parse(loc).toString(); canon = canon.endsWith('?') ? canon.substring(0, canon.length - 1) : canon; final Uri uri = Uri.parse(canon); @@ -176,7 +176,7 @@ String? fullPathForRoute( String parentFullpath, List routes, ) { - for (final RouteBase route in routes) { + for (final route in routes) { final String fullPath = (route is GoRoute) ? concatenatePaths(parentFullpath, route.path) : parentFullpath; diff --git a/packages/go_router/lib/src/route.dart b/packages/go_router/lib/src/route.dart index 7a2a07db385..95fd82a4042 100644 --- a/packages/go_router/lib/src/route.dart +++ b/packages/go_router/lib/src/route.dart @@ -513,7 +513,7 @@ abstract class ShellRouteBase extends RouteBase { List subRoutes, GlobalKey navigatorKey, ) { - for (final RouteBase route in subRoutes) { + for (final route in subRoutes) { assert( route.parentNavigatorKey == null || route.parentNavigatorKey == navigatorKey, @@ -591,7 +591,7 @@ class ShellRouteContext { bool notifyRootObserver, String? restorationScopeId, ) { - final List effectiveObservers = [ + final effectiveObservers = [ ...?observers, ]; @@ -1076,7 +1076,7 @@ class StatefulShellRoute extends ShellRouteBase { static bool _debugValidateParentNavigatorKeys( List branches, ) { - for (final StatefulShellBranch branch in branches) { + for (final branch in branches) { for (final RouteBase route in branch.routes) { if (route is GoRoute) { assert( @@ -1276,7 +1276,7 @@ class StatefulNavigationShell extends StatefulWidget { // TODO(chunhtai): figure out a way to avoid putting navigation API in widget // class. void goBranch(int index, {bool initialLocation = false}) { - final StatefulShellRoute route = + final route = shellRouteContext.route as StatefulShellRoute; final StatefulNavigationShellState? shellState = route._shellStateKey.currentState; @@ -1301,7 +1301,7 @@ class StatefulNavigationShell extends StatefulWidget { /// [StatefulShellBranch.initialLocation], if specified, or the location of the /// [StatefulShellBranch.defaultRoute]. String _effectiveInitialBranchLocation(int index) { - final StatefulShellRoute route = + final route = shellRouteContext.route as StatefulShellRoute; final StatefulShellBranch branch = route.branches[index]; final String? initialLocation = branch.initialLocation; @@ -1311,7 +1311,7 @@ class StatefulNavigationShell extends StatefulWidget { /// Recursively traverses the routes of the provided StackedShellBranch to /// find the first GoRoute, from which a full path will be derived. final GoRoute route = branch.defaultRoute!; - final List parameters = []; + final parameters = []; patternToRegExp( route.path, parameters, @@ -1391,7 +1391,7 @@ class StatefulNavigationShellState extends State bool register = true, ]) { return _branchState.putIfAbsent(branch, () { - final _StatefulShellBranchState branchState = _StatefulShellBranchState( + final branchState = _StatefulShellBranchState( location: _RestorableRouteMatchList(_router.configuration), ); if (register) { @@ -1416,8 +1416,8 @@ class StatefulNavigationShellState extends State } List _scopeMatches(List matches) { - final List result = []; - for (final RouteMatchBase match in matches) { + final result = []; + for (final match in matches) { if (match is ShellRouteMatch) { if (match.route == route) { result.add(match); @@ -1447,10 +1447,10 @@ class StatefulNavigationShellState extends State ); final RouteMatchList previousBranchLocation = branchState.location.value; branchState.location.value = currentBranchLocation; - final bool hasExistingNavigator = branchState.navigator != null; + final hasExistingNavigator = branchState.navigator != null; /// Only update the Navigator of the route match list has changed - final bool locationChanged = + final locationChanged = previousBranchLocation != currentBranchLocation; if (locationChanged || !hasExistingNavigator) { branchState.navigator = shellRouteContext._buildNavigatorForCurrentRoute( @@ -1465,7 +1465,7 @@ class StatefulNavigationShellState extends State } void _preloadBranches() { - for (int i = 0; i < route.branches.length; i++) { + for (var i = 0; i < route.branches.length; i++) { final StatefulShellBranch branch = route.branches[i]; if (i != currentIndex && branch.preload && !_isBranchLoaded(branch)) { // Find the match for the current StatefulShellRoute in matchList diff --git a/packages/go_router/lib/src/router.dart b/packages/go_router/lib/src/router.dart index b0a1971d5ad..7e885742ec5 100644 --- a/packages/go_router/lib/src/router.dart +++ b/packages/go_router/lib/src/router.dart @@ -607,7 +607,7 @@ class GoRouter implements RouterConfig { /// The current GoRouter in the widget tree, if any. static GoRouter? maybeOf(BuildContext context) { - final InheritedGoRouter? inherited = + final inherited = context .getElementForInheritedWidgetOfExactType() ?.widget @@ -639,7 +639,7 @@ class GoRouter implements RouterConfig { if (platformDefaultUri.hasEmptyPath) { platformDefaultUri = platformDefaultUri.replace(path: '/'); } - final String platformDefault = platformDefaultUri.toString(); + final platformDefault = platformDefaultUri.toString(); if (initialLocation == null) { return platformDefault; } else if (platformDefault == '/') { diff --git a/packages/go_router/lib/src/state.dart b/packages/go_router/lib/src/state.dart index b9db0e561ae..80554631915 100644 --- a/packages/go_router/lib/src/state.dart +++ b/packages/go_router/lib/src/state.dart @@ -267,7 +267,7 @@ class GoRouterStateRegistry extends ChangeNotifier { /// Updates this registry with new records. void updateRegistry(Map, GoRouterState> newRegistry) { - bool shouldNotify = false; + var shouldNotify = false; final Set> pagesWithAssociation = _routePageAssociation.values .toSet(); for (final MapEntry, GoRouterState> entry diff --git a/packages/go_router/test/builder_test.dart b/packages/go_router/test/builder_test.dart index 66cc2d58920..73dce5dd1e0 100644 --- a/packages/go_router/test/builder_test.dart +++ b/packages/go_router/test/builder_test.dart @@ -27,7 +27,7 @@ void main() { navigatorKey: GlobalKey(), ); - final RouteMatchList matches = RouteMatchList( + final matches = RouteMatchList( matches: [ RouteMatch( route: config.routes.first as GoRoute, @@ -47,7 +47,7 @@ void main() { }); testWidgets('Builds ShellRoute', (WidgetTester tester) async { - final GlobalKey shellNavigatorKey = + final shellNavigatorKey = GlobalKey(); final RouteConfiguration config = createRouteConfiguration( routes: [ @@ -73,7 +73,7 @@ void main() { navigatorKey: GlobalKey(), ); - final RouteMatchList matches = RouteMatchList( + final matches = RouteMatchList( matches: [ ShellRouteMatch( route: config.routes.first as ShellRouteBase, @@ -101,7 +101,7 @@ void main() { }); testWidgets('Uses the correct navigatorKey', (WidgetTester tester) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); final RouteConfiguration config = createRouteConfiguration( navigatorKey: rootNavigatorKey, @@ -119,7 +119,7 @@ void main() { }, ); - final RouteMatchList matches = RouteMatchList( + final matches = RouteMatchList( matches: [ RouteMatch( route: config.routes.first as GoRoute, @@ -141,9 +141,9 @@ void main() { testWidgets('Builds a Navigator for ShellRoute', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(debugLabel: 'root'); - final GlobalKey shellNavigatorKey = + final shellNavigatorKey = GlobalKey(debugLabel: 'shell'); final RouteConfiguration config = createRouteConfiguration( navigatorKey: rootNavigatorKey, @@ -169,7 +169,7 @@ void main() { }, ); - final RouteMatchList matches = RouteMatchList( + final matches = RouteMatchList( matches: [ ShellRouteMatch( route: config.routes.first as ShellRouteBase, @@ -202,9 +202,9 @@ void main() { testWidgets('Builds a Navigator for ShellRoute with parentNavigatorKey', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(debugLabel: 'root'); - final GlobalKey shellNavigatorKey = + final shellNavigatorKey = GlobalKey(debugLabel: 'shell'); final RouteConfiguration config = createRouteConfiguration( navigatorKey: rootNavigatorKey, @@ -240,7 +240,7 @@ void main() { }, ); - final RouteMatchList matches = RouteMatchList( + final matches = RouteMatchList( matches: [ RouteMatch( route: config.routes.first.routes.first as GoRoute, @@ -265,9 +265,9 @@ void main() { testWidgets('Uses the correct restorationScopeId for ShellRoute', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(debugLabel: 'root'); - final GlobalKey shellNavigatorKey = + final shellNavigatorKey = GlobalKey(debugLabel: 'shell'); final RouteConfiguration config = createRouteConfiguration( navigatorKey: rootNavigatorKey, @@ -294,7 +294,7 @@ void main() { }, ); - final RouteMatchList matches = RouteMatchList( + final matches = RouteMatchList( matches: [ ShellRouteMatch( route: config.routes.first as ShellRouteBase, @@ -329,11 +329,11 @@ void main() { testWidgets('Uses the correct restorationScopeId for StatefulShellRoute', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(debugLabel: 'root'); - final GlobalKey shellNavigatorKey = + final shellNavigatorKey = GlobalKey(debugLabel: 'shell'); - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/a', navigatorKey: rootNavigatorKey, routes: [ @@ -377,7 +377,7 @@ void main() { testWidgets('GoRouter requestFocus defaults to true', ( WidgetTester tester, ) async { - final GoRouter router = GoRouter( + final router = GoRouter( routes: [ GoRoute( path: '/', @@ -400,7 +400,7 @@ void main() { testWidgets('GoRouter requestFocus can be set to false', ( WidgetTester tester, ) async { - final GoRouter router = GoRouter( + final router = GoRouter( routes: [ GoRoute( path: '/', diff --git a/packages/go_router/test/configuration_test.dart b/packages/go_router/test/configuration_test.dart index 86bb596e07d..72db6851710 100644 --- a/packages/go_router/test/configuration_test.dart +++ b/packages/go_router/test/configuration_test.dart @@ -11,13 +11,13 @@ import 'test_helpers.dart'; void main() { group('RouteConfiguration', () { test('throws when parentNavigatorKey is not an ancestor', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey a = GlobalKey( + final a = GlobalKey( debugLabel: 'a', ); - final GlobalKey b = GlobalKey( + final b = GlobalKey( debugLabel: 'b', ); @@ -59,10 +59,10 @@ void main() { }); test('throws when ShellRoute has no children', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final List shellRouteChildren = []; + final shellRouteChildren = []; expect(() { createRouteConfiguration( navigatorKey: root, @@ -78,13 +78,13 @@ void main() { test( 'throws when StatefulShellRoute sub-route uses incorrect parentNavigatorKey', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey keyA = GlobalKey( + final keyA = GlobalKey( debugLabel: 'A', ); - final GlobalKey keyB = GlobalKey( + final keyB = GlobalKey( debugLabel: 'B', ); @@ -126,10 +126,10 @@ void main() { test( 'does not throw when StatefulShellRoute sub-route uses correct parentNavigatorKeys', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey keyA = GlobalKey( + final keyA = GlobalKey( debugLabel: 'A', ); @@ -169,10 +169,10 @@ void main() { test( 'throws when a sub-route of StatefulShellRoute has a parentNavigatorKey', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey someNavigatorKey = + final someNavigatorKey = GlobalKey(); expect(() { createRouteConfiguration( @@ -218,13 +218,13 @@ void main() { ); test('throws when StatefulShellRoute has duplicate navigator keys', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey keyA = GlobalKey( + final keyA = GlobalKey( debugLabel: 'A', ); - final List shellRouteChildren = [ + final shellRouteChildren = [ GoRoute( path: '/a', builder: _mockScreenBuilder, @@ -257,19 +257,19 @@ void main() { test('throws when a child of StatefulShellRoute has an incorrect ' 'parentNavigatorKey', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey sectionANavigatorKey = + final sectionANavigatorKey = GlobalKey(); - final GlobalKey sectionBNavigatorKey = + final sectionBNavigatorKey = GlobalKey(); - final GoRoute routeA = GoRoute( + final routeA = GoRoute( path: '/a', builder: _mockScreenBuilder, parentNavigatorKey: sectionBNavigatorKey, ); - final GoRoute routeB = GoRoute( + final routeB = GoRoute( path: '/b', builder: _mockScreenBuilder, parentNavigatorKey: sectionANavigatorKey, @@ -302,12 +302,12 @@ void main() { test('throws when a branch of a StatefulShellRoute has an incorrect ' 'initialLocation', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey sectionANavigatorKey = + final sectionANavigatorKey = GlobalKey(); - final GlobalKey sectionBNavigatorKey = + final sectionBNavigatorKey = GlobalKey(); expect(() { createRouteConfiguration( @@ -342,12 +342,12 @@ void main() { test('throws when a branch of a StatefulShellRoute has a initialLocation ' 'that is not a descendant of the same branch', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey sectionANavigatorKey = + final sectionANavigatorKey = GlobalKey(); - final GlobalKey sectionBNavigatorKey = + final sectionBNavigatorKey = GlobalKey(); expect(() { createRouteConfiguration( @@ -392,7 +392,7 @@ void main() { test('does not throw when a branch of a StatefulShellRoute has correctly ' 'configured initialLocations', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); @@ -576,10 +576,10 @@ void main() { test( 'throws when there is a GoRoute ancestor with a different parentNavigatorKey', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey shell = GlobalKey( + final shell = GlobalKey( debugLabel: 'shell', ); expect(() { @@ -614,13 +614,13 @@ void main() { ); test('Does not throw with valid parentNavigatorKey configuration', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey shell = GlobalKey( + final shell = GlobalKey( debugLabel: 'shell', ); - final GlobalKey shell2 = GlobalKey( + final shell2 = GlobalKey( debugLabel: 'shell2', ); createRouteConfiguration( @@ -671,10 +671,10 @@ void main() { test( 'Does not throw with multiple nested GoRoutes using parentNavigatorKey in ShellRoute', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey shell = GlobalKey( + final shell = GlobalKey( debugLabel: 'shell', ); createRouteConfiguration( @@ -720,10 +720,10 @@ void main() { ); test('Throws when parentNavigatorKeys are overlapping', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey shell = GlobalKey( + final shell = GlobalKey( debugLabel: 'shell', ); expect( @@ -772,10 +772,10 @@ void main() { test( 'Does not throw when parentNavigatorKeys are overlapping correctly', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey shell = GlobalKey( + final shell = GlobalKey( debugLabel: 'shell', ); createRouteConfiguration( @@ -822,13 +822,13 @@ void main() { test('throws when a GoRoute with a different parentNavigatorKey ' 'exists between a GoRoute with a parentNavigatorKey and ' 'its ShellRoute ancestor', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey shell = GlobalKey( + final shell = GlobalKey( debugLabel: 'shell', ); - final GlobalKey shell2 = GlobalKey( + final shell2 = GlobalKey( debugLabel: 'shell2', ); expect( @@ -881,7 +881,7 @@ void main() { test( 'does not throw when ShellRoute is the child of another ShellRoute', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); createRouteConfiguration( @@ -910,13 +910,13 @@ void main() { ); test('Does not throw with valid parentNavigatorKey configuration', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey shell = GlobalKey( + final shell = GlobalKey( debugLabel: 'shell', ); - final GlobalKey shell2 = GlobalKey( + final shell2 = GlobalKey( debugLabel: 'shell2', ); createRouteConfiguration( @@ -967,7 +967,7 @@ void main() { test( 'throws when ShellRoute contains a GoRoute with a parentNavigatorKey', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); expect(() { @@ -996,10 +996,10 @@ void main() { test( 'All known route strings returned by debugKnownRoutes are correct', () { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey shell = GlobalKey( + final shell = GlobalKey( debugLabel: 'shell', ); diff --git a/packages/go_router/test/cupertino_test.dart b/packages/go_router/test/cupertino_test.dart index 1388b984f49..39c98b042d8 100644 --- a/packages/go_router/test/cupertino_test.dart +++ b/packages/go_router/test/cupertino_test.dart @@ -14,7 +14,7 @@ void main() { testWidgets('returns [true] when CupertinoApp is present', ( WidgetTester tester, ) async { - final GlobalKey<_DummyStatefulWidgetState> key = + final key = GlobalKey<_DummyStatefulWidgetState>(); await tester.pumpWidget( CupertinoApp(home: DummyStatefulWidget(key: key)), @@ -26,7 +26,7 @@ void main() { testWidgets('returns [false] when MaterialApp is present', ( WidgetTester tester, ) async { - final GlobalKey<_DummyStatefulWidgetState> key = + final key = GlobalKey<_DummyStatefulWidgetState>(); await tester.pumpWidget(MaterialApp(home: DummyStatefulWidget(key: key))); final bool isCupertino = isCupertinoApp(key.currentContext! as Element); @@ -35,11 +35,11 @@ void main() { }); test('pageBuilderForCupertinoApp creates a [CupertinoPage] accordingly', () { - final UniqueKey key = UniqueKey(); - const String name = 'name'; - const String arguments = 'arguments'; - const String restorationId = 'restorationId'; - const DummyStatefulWidget child = DummyStatefulWidget(); + final key = UniqueKey(); + const name = 'name'; + const arguments = 'arguments'; + const restorationId = 'restorationId'; + const child = DummyStatefulWidget(); final CupertinoPage page = pageBuilderForCupertinoApp( key: key, name: name, @@ -62,7 +62,7 @@ void main() { ), ); - final Exception exception = Exception('Something went wrong!'); + final exception = Exception('Something went wrong!'); testWidgets( 'shows the exception message when provided', testPageShowsExceptionMessage( diff --git a/packages/go_router/test/custom_transition_page_test.dart b/packages/go_router/test/custom_transition_page_test.dart index 9f4c765d357..144a29c6b19 100644 --- a/packages/go_router/test/custom_transition_page_test.dart +++ b/packages/go_router/test/custom_transition_page_test.dart @@ -10,12 +10,12 @@ void main() { testWidgets( 'CustomTransitionPage builds its child using transitionsBuilder', (WidgetTester tester) async { - const HomeScreen child = HomeScreen(); - final CustomTransitionPage transition = CustomTransitionPage( + const child = HomeScreen(); + final transition = CustomTransitionPage( transitionsBuilder: expectAsync4((_, __, ___, Widget child) => child), child: child, ); - final GoRouter router = GoRouter( + final router = GoRouter( routes: [ GoRoute(path: '/', pageBuilder: (_, __) => transition), ], @@ -31,7 +31,7 @@ void main() { testWidgets('NoTransitionPage does not apply any transition', ( WidgetTester tester, ) async { - final ValueNotifier showHomeValueNotifier = ValueNotifier( + final showHomeValueNotifier = ValueNotifier( false, ); addTearDown(showHomeValueNotifier.dispose); @@ -78,7 +78,7 @@ void main() { testWidgets('NoTransitionPage does not apply any reverse transition', ( WidgetTester tester, ) async { - final ValueNotifier showHomeValueNotifier = ValueNotifier(true); + final showHomeValueNotifier = ValueNotifier(true); addTearDown(showHomeValueNotifier.dispose); await tester.pumpWidget( MaterialApp( @@ -111,12 +111,12 @@ void main() { testWidgets('Dismiss a screen by tapping a modal barrier', ( WidgetTester tester, ) async { - const ValueKey homeKey = ValueKey('home'); - const ValueKey dismissibleModalKey = ValueKey( + const homeKey = ValueKey('home'); + const dismissibleModalKey = ValueKey( 'dismissibleModal', ); - final GoRouter router = GoRouter( + final router = GoRouter( routes: [ GoRoute( path: '/', @@ -147,12 +147,12 @@ void main() { testWidgets('transitionDuration and reverseTransitionDuration is different', ( WidgetTester tester, ) async { - const ValueKey homeKey = ValueKey('home'); - const ValueKey loginKey = ValueKey('login'); - const Duration transitionDuration = Duration(milliseconds: 50); - const Duration reverseTransitionDuration = Duration(milliseconds: 500); + const homeKey = ValueKey('home'); + const loginKey = ValueKey('login'); + const transitionDuration = Duration(milliseconds: 50); + const reverseTransitionDuration = Duration(milliseconds: 500); - final GoRouter router = GoRouter( + final router = GoRouter( routes: [ GoRoute( path: '/', diff --git a/packages/go_router/test/delegate_test.dart b/packages/go_router/test/delegate_test.dart index ae85f7cca1d..e3945314365 100644 --- a/packages/go_router/test/delegate_test.dart +++ b/packages/go_router/test/delegate_test.dart @@ -14,7 +14,7 @@ Future createGoRouter( Listenable? refreshListenable, bool dispose = true, }) async { - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/', routes: [ GoRoute(path: '/', builder: (_, __) => const DummyStatefulWidget()), @@ -33,7 +33,7 @@ Future createGoRouter( Future createGoRouterWithStatefulShellRoute( WidgetTester tester, ) async { - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/', routes: [ GoRoute(path: '/', builder: (_, __) => const DummyStatefulWidget()), @@ -91,7 +91,7 @@ Future createGoRouterWithStatefulShellRouteAndPopScopes( PopInvokedWithResultCallback? onPopBranch, PopInvokedWithResultCallback? onPopBranchSubRoute, }) async { - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/c', routes: [ StatefulShellRoute.indexedStack( @@ -143,7 +143,7 @@ void main() { testWidgets('restore() update currentConfiguration in pop()', ( WidgetTester tester, ) async { - final ValueNotifier valueNotifier = ValueNotifier(0); + final valueNotifier = ValueNotifier(0); final GoRouter goRouter = await createGoRouter( tester, refreshListenable: valueNotifier, @@ -188,9 +188,9 @@ void main() { testWidgets('PopScope intercepts back button on root route', ( WidgetTester tester, ) async { - bool didPop = false; + var didPop = false; - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/', routes: [ GoRoute( @@ -225,9 +225,9 @@ void main() { testWidgets( 'PopScope intercepts back button on StatefulShellRoute builder route', (WidgetTester tester) async { - bool didPopShellRouteBuilder = false; - bool didPopBranch = false; - bool didPopBranchSubRoute = false; + var didPopShellRouteBuilder = false; + var didPopBranch = false; + var didPopBranchSubRoute = false; await createGoRouterWithStatefulShellRouteAndPopScopes( tester, @@ -253,9 +253,9 @@ void main() { testWidgets( 'PopScope intercepts back button on StatefulShellRoute branch route', (WidgetTester tester) async { - bool didPopShellRouteBuilder = false; - bool didPopBranch = false; - bool didPopBranchSubRoute = false; + var didPopShellRouteBuilder = false; + var didPopBranch = false; + var didPopBranchSubRoute = false; await createGoRouterWithStatefulShellRouteAndPopScopes( tester, @@ -281,9 +281,9 @@ void main() { testWidgets( 'PopScope intercepts back button on StatefulShellRoute branch sub route', (WidgetTester tester) async { - bool didPopShellRouteBuilder = false; - bool didPopBranch = false; - bool didPopBranchSubRoute = false; + var didPopShellRouteBuilder = false; + var didPopBranch = false; + var didPopBranchSubRoute = false; final GoRouter goRouter = await createGoRouterWithStatefulShellRouteAndPopScopes( @@ -321,8 +321,8 @@ void main() { }); testWidgets('throw if nothing to pop', (WidgetTester tester) async { - final GlobalKey rootKey = GlobalKey(); - final GlobalKey navKey = GlobalKey(); + final rootKey = GlobalKey(); + final navKey = GlobalKey(); final GoRouter goRouter = await createRouter([ ShellRoute( navigatorKey: rootKey, @@ -357,8 +357,8 @@ void main() { testWidgets('poproute return false if nothing to pop', ( WidgetTester tester, ) async { - final GlobalKey rootKey = GlobalKey(); - final GlobalKey navKey = GlobalKey(); + final rootKey = GlobalKey(); + final navKey = GlobalKey(); final GoRouter goRouter = await createRouter([ ShellRoute( navigatorKey: rootKey, @@ -444,7 +444,7 @@ void main() { await tester.pumpAndSettle(); expect(goRouter.routerDelegate.currentConfiguration.matches.length, 2); - final ShellRouteMatch shellRouteMatch = + final shellRouteMatch = goRouter.routerDelegate.currentConfiguration.matches.last as ShellRouteMatch; expect(shellRouteMatch.matches.length, 2); @@ -469,7 +469,7 @@ void main() { await tester.pumpAndSettle(); expect(goRouter.routerDelegate.currentConfiguration.matches.length, 2); - final ShellRouteMatch shellRouteMatch = + final shellRouteMatch = goRouter.routerDelegate.currentConfiguration.matches.last as ShellRouteMatch; expect(shellRouteMatch.matches.length, 2); @@ -506,7 +506,7 @@ void main() { testWidgets('It should return false if there are no matches in the stack', ( WidgetTester tester, ) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/', routes: [], ); @@ -522,7 +522,7 @@ void main() { testWidgets('It should replace the last match with the given one', ( WidgetTester tester, ) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/', routes: [ GoRoute(path: '/', builder: (_, __) => const SizedBox()), @@ -595,7 +595,7 @@ void main() { testWidgets('It should replace the last match with the given one', ( WidgetTester tester, ) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/', routes: [ GoRoute(path: '/', builder: (_, __) => const SizedBox()), @@ -648,7 +648,7 @@ void main() { testWidgets('It should replace the last match with the given one', ( WidgetTester tester, ) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/', routes: [ GoRoute(path: '/', builder: (_, __) => const SizedBox()), @@ -750,7 +750,7 @@ void main() { WidgetTester tester, { Listenable? refreshListenable, }) async { - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/', routes: [ GoRoute( @@ -869,7 +869,7 @@ void main() { testWidgets('dispose unsubscribes from refreshListenable', ( WidgetTester tester, ) async { - final FakeRefreshListenable refreshListenable = FakeRefreshListenable(); + final refreshListenable = FakeRefreshListenable(); addTearDown(refreshListenable.dispose); final GoRouter goRouter = await createGoRouter( diff --git a/packages/go_router/test/error_page_test.dart b/packages/go_router/test/error_page_test.dart index 339f4299859..b5ac263c1c7 100644 --- a/packages/go_router/test/error_page_test.dart +++ b/packages/go_router/test/error_page_test.dart @@ -14,7 +14,7 @@ void main() { testPageNotFound(widget: widgetsAppBuilder(home: const ErrorScreen(null))), ); - final Exception exception = Exception('Something went wrong!'); + final exception = Exception('Something went wrong!'); testWidgets( 'shows the exception message when provided', testPageShowsExceptionMessage( diff --git a/packages/go_router/test/exception_handling_test.dart b/packages/go_router/test/exception_handling_test.dart index f24b48075b5..8578c6e8754 100644 --- a/packages/go_router/test/exception_handling_test.dart +++ b/packages/go_router/test/exception_handling_test.dart @@ -12,7 +12,7 @@ void main() { testWidgets('throws if more than one exception handlers are provided.', ( WidgetTester tester, ) async { - bool thrown = false; + var thrown = false; try { GoRouter( routes: [ @@ -125,7 +125,7 @@ void main() { testWidgets('can catch errors thrown in redirect callbacks', ( WidgetTester tester, ) async { - bool exceptionCaught = false; + var exceptionCaught = false; String? errorMessage; final GoRouter router = await createRouter( @@ -181,7 +181,7 @@ void main() { testWidgets('can catch non-GoException errors thrown in redirect callbacks', ( WidgetTester tester, ) async { - bool exceptionCaught = false; + var exceptionCaught = false; final GoRouter router = await createRouter( [ diff --git a/packages/go_router/test/extension_test.dart b/packages/go_router/test/extension_test.dart index 9a28d17d4c7..d65bf21b829 100644 --- a/packages/go_router/test/extension_test.dart +++ b/packages/go_router/test/extension_test.dart @@ -12,7 +12,7 @@ void main() { WidgetTester tester, { Listenable? refreshListenable, }) async { - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/', routes: [ GoRoute( diff --git a/packages/go_router/test/extra_codec_test.dart b/packages/go_router/test/extra_codec_test.dart index 859fdf7c558..67d832fdfa1 100644 --- a/packages/go_router/test/extra_codec_test.dart +++ b/packages/go_router/test/extra_codec_test.dart @@ -15,9 +15,9 @@ void main() { testWidgets('router rebuild with extra codec works', ( WidgetTester tester, ) async { - const String initialString = 'some string'; - const String empty = 'empty'; - final GoRouter router = GoRouter( + const initialString = 'some string'; + const empty = 'empty'; + final router = GoRouter( initialLocation: '/', extraCodec: ComplexDataCodec(), initialExtra: ComplexData(initialString), @@ -37,7 +37,7 @@ void main() { ); addTearDown(router.dispose); - final SimpleDependency dependency = SimpleDependency(); + final dependency = SimpleDependency(); addTearDown(() => dependency.dispose()); await tester.pumpWidget( @@ -56,9 +56,9 @@ void main() { testWidgets( 'Restores state correctly', (WidgetTester tester) async { - const String initialString = 'some string'; - const String empty = 'empty'; - final List routes = [ + const initialString = 'some string'; + const empty = 'empty'; + final routes = [ GoRoute( path: '/', builder: (_, GoRouterState state) { diff --git a/packages/go_router/test/go_route_test.dart b/packages/go_router/test/go_route_test.dart index 4ede231e47f..84a01eaae47 100644 --- a/packages/go_router/test/go_route_test.dart +++ b/packages/go_router/test/go_route_test.dart @@ -24,12 +24,12 @@ void main() { testWidgets('ShellRoute can use parent navigator key', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey shellNavigatorKey = + final shellNavigatorKey = GlobalKey(); - final List routes = [ + final routes = [ ShellRoute( navigatorKey: shellNavigatorKey, builder: (BuildContext context, GoRouterState state, Widget child) { @@ -92,12 +92,12 @@ void main() { testWidgets('StatefulShellRoute can use parent navigator key', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey shellNavigatorKey = + final shellNavigatorKey = GlobalKey(); - final List routes = [ + final routes = [ ShellRoute( navigatorKey: shellNavigatorKey, builder: (BuildContext context, GoRouterState state, Widget child) { @@ -159,9 +159,9 @@ void main() { }); test('ShellRoute parent navigator key throw if not match', () async { - final GlobalKey key1 = GlobalKey(); - final GlobalKey key2 = GlobalKey(); - bool hasError = false; + final key1 = GlobalKey(); + final key2 = GlobalKey(); + var hasError = false; try { ShellRoute( navigatorKey: key1, @@ -293,9 +293,9 @@ void main() { testWidgets( 'throw if sub route does not conform with parent navigator key', (WidgetTester tester) async { - final GlobalKey key1 = GlobalKey(); - final GlobalKey key2 = GlobalKey(); - bool hasError = false; + final key1 = GlobalKey(); + final key2 = GlobalKey(); + var hasError = false; try { ShellRoute( navigatorKey: key1, diff --git a/packages/go_router/test/go_router_state_test.dart b/packages/go_router/test/go_router_state_test.dart index 8d82976c14d..eb441e42992 100644 --- a/packages/go_router/test/go_router_state_test.dart +++ b/packages/go_router/test/go_router_state_test.dart @@ -12,7 +12,7 @@ import 'test_helpers.dart'; void main() { group('GoRouterState from context', () { testWidgets('works in builder', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, _) { @@ -39,7 +39,7 @@ void main() { }); testWidgets('works in subtree', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) { @@ -78,7 +78,7 @@ void main() { testWidgets('path parameter persists after page is popped', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) { @@ -121,8 +121,8 @@ void main() { testWidgets('registry retains GoRouterState for exiting route', ( WidgetTester tester, ) async { - final UniqueKey key = UniqueKey(); - final List routes = [ + final key = UniqueKey(); + final routes = [ GoRoute( path: '/', builder: (_, __) { @@ -173,9 +173,9 @@ void main() { testWidgets('imperative pop clears out registry', ( WidgetTester tester, ) async { - final UniqueKey key = UniqueKey(); - final GlobalKey nav = GlobalKey(); - final List routes = [ + final key = UniqueKey(); + final nav = GlobalKey(); + final routes = [ GoRoute( path: '/', builder: (_, __) { @@ -227,7 +227,7 @@ void main() { testWidgets( 'GoRouterState look up should be resilient when there is a nested navigator.', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) { @@ -263,11 +263,11 @@ void main() { testWidgets('GoRouterState topRoute accessible from StatefulShellRoute', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey shellNavigatorKey = + final shellNavigatorKey = GlobalKey(); - final List routes = [ + final routes = [ ShellRoute( navigatorKey: shellNavigatorKey, builder: (BuildContext context, GoRouterState state, Widget child) { diff --git a/packages/go_router/test/go_router_test.dart b/packages/go_router/test/go_router_test.dart index b77f6fc6f71..309d972cae5 100644 --- a/packages/go_router/test/go_router_test.dart +++ b/packages/go_router/test/go_router_test.dart @@ -22,7 +22,7 @@ const bool enableLogs = false; final Logger log = Logger('GoRouter tests'); Future sendPlatformUrl(String url, WidgetTester tester) async { - final Map testRouteInformation = { + final testRouteInformation = { 'location': url, }; final ByteData message = const JSONMethodCodec().encodeMethodCall( @@ -42,7 +42,7 @@ void main() { group('path routes', () { testWidgets('match home route', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -60,7 +60,7 @@ void main() { testWidgets( 'If there is more than one route to match, use the first match', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute(name: '1', path: '/', builder: dummy), GoRoute(name: '2', path: '/', builder: dummy), ]; @@ -78,7 +78,7 @@ void main() { testWidgets('pushReplacement and replace when only one matches', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute(name: '1', path: '/', builder: dummy), GoRoute(name: '2', path: '/a', builder: dummy), GoRoute(name: '3', path: '/b', builder: dummy), @@ -119,7 +119,7 @@ void main() { }); testWidgets('match no routes', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute(path: '/', builder: dummy), ]; @@ -138,7 +138,7 @@ void main() { }); testWidgets('match 2nd top level route', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -164,7 +164,7 @@ void main() { testWidgets('match 2nd top level route with subroutes', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -197,7 +197,7 @@ void main() { testWidgets('match top level route when location has trailing /', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -223,7 +223,7 @@ void main() { testWidgets('match top level route when location has trailing / (2)', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/profile', builder: dummy, @@ -245,7 +245,7 @@ void main() { testWidgets('match top level route when location has trailing / (3)', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/profile', builder: dummy, @@ -267,7 +267,7 @@ void main() { testWidgets( 'match top level route when location has scheme/host and has trailing /', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -289,7 +289,7 @@ void main() { testWidgets( 'match top level route when location has scheme/host and has trailing / (2)', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -316,7 +316,7 @@ void main() { testWidgets( 'match top level route when location has scheme/host and has trailing / (3)', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/profile', builder: dummy, @@ -339,7 +339,7 @@ void main() { testWidgets( 'match top level route when location has scheme/host and has trailing / (4)', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/profile', builder: dummy, @@ -363,11 +363,11 @@ void main() { WidgetTester tester, ) async { // Regression test for https://github.com/flutter/flutter/issues/123369. - final UniqueKey home = UniqueKey(); - final UniqueKey settings = UniqueKey(); - final UniqueKey dialog = UniqueKey(); - final GlobalKey navKey = GlobalKey(); - final List routes = [ + final home = UniqueKey(); + final settings = UniqueKey(); + final dialog = UniqueKey(); + final navKey = GlobalKey(); + final routes = [ GoRoute( path: '/', builder: (_, __) => DummyScreen(key: home), @@ -418,7 +418,7 @@ void main() { WidgetTester tester, ) async { // Regression test for https://github.com/flutter/flutter/issues/141906. - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Text('home'), @@ -480,8 +480,8 @@ void main() { ) async { // Regression test for https://github.com/flutter/flutter/issues/#132229. - final GlobalKey navKey = GlobalKey(); - final List routes = [ + final navKey = GlobalKey(); + final routes = [ GoRoute( path: '/', pageBuilder: (_, __) => @@ -527,7 +527,7 @@ void main() { }); testWidgets('match sub-route', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -555,7 +555,7 @@ void main() { }); testWidgets('match sub-routes', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -633,7 +633,7 @@ void main() { testWidgets('return first matching route if too many subroutes', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -687,7 +687,7 @@ void main() { }); testWidgets('router state', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( name: 'home', path: '/', @@ -777,7 +777,7 @@ void main() { }); testWidgets('match path case insensitively', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -792,7 +792,7 @@ void main() { ]; final GoRouter router = await createRouter(routes, tester); - const String loc = '/FaMiLy/f2'; + const loc = '/FaMiLy/f2'; router.go(loc); await tester.pumpAndSettle(); final List matches = @@ -811,7 +811,7 @@ void main() { }); testWidgets('match path case sensitively', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -825,7 +825,7 @@ void main() { ]; final GoRouter router = await createRouter(routes, tester); - const String wrongLoc = '/FaMiLy/f2'; + const wrongLoc = '/FaMiLy/f2'; router.go(wrongLoc); await tester.pumpAndSettle(); @@ -833,7 +833,7 @@ void main() { expect(find.byType(MaterialErrorScreen), findsOne); expect(find.text('Page Not Found'), findsOne); - const String loc = '/family/f2'; + const loc = '/family/f2'; router.go(loc); await tester.pumpAndSettle(); final List matches = @@ -848,7 +848,7 @@ void main() { testWidgets('supports routes with a different case', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -867,14 +867,14 @@ void main() { ]; final GoRouter router = await createRouter(routes, tester); - const String loc1 = '/abc'; + const loc1 = '/abc'; router.go(loc1); await tester.pumpAndSettle(); expect(find.byKey(const Key('abc')), findsOne); - const String loc = '/ABC'; + const loc = '/ABC'; router.go(loc); await tester.pumpAndSettle(); @@ -884,7 +884,7 @@ void main() { testWidgets( 'If there is more than one route to match, use the first match.', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute(path: '/', builder: dummy), GoRoute(path: '/page1', builder: dummy), GoRoute(path: '/page1', builder: dummy), @@ -904,7 +904,7 @@ void main() { testWidgets('Handles the Android back button correctly', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) { @@ -934,10 +934,10 @@ void main() { testWidgets('Handles the Android back button correctly with ShellRoute', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final List routes = [ + final routes = [ ShellRoute( builder: (BuildContext context, GoRouterState state, Widget child) { return Scaffold( @@ -1012,7 +1012,7 @@ void main() { testWidgets( 'Handles the Android back button when parentNavigatorKey is set to the root navigator', (WidgetTester tester) async { - final List log = []; + final log = []; TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler(SystemChannels.platform, ( MethodCall methodCall, @@ -1030,10 +1030,10 @@ void main() { expect(log, expectations); } - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final List routes = [ + final routes = [ GoRoute( parentNavigatorKey: rootNavigatorKey, path: '/a', @@ -1062,7 +1062,7 @@ void main() { testWidgets("Handles the Android back button when ShellRoute can't pop", ( WidgetTester tester, ) async { - final List log = []; + final log = []; TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler(SystemChannels.platform, ( MethodCall methodCall, @@ -1077,10 +1077,10 @@ void main() { expect(log, expectations); } - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final List routes = [ + final routes = [ GoRoute( parentNavigatorKey: rootNavigatorKey, path: '/a', @@ -1125,10 +1125,10 @@ void main() { testWidgets('does not crash when inherited widget changes', ( WidgetTester tester, ) async { - final ValueNotifier notifier = ValueNotifier('initial'); + final notifier = ValueNotifier('initial'); addTearDown(notifier.dispose); - final List routes = [ + final routes = [ GoRoute( path: '/', pageBuilder: (BuildContext context, GoRouterState state) { @@ -1140,7 +1140,7 @@ void main() { }, ), ]; - final GoRouter router = GoRouter(routes: routes); + final router = GoRouter(routes: routes); addTearDown(router.dispose); await tester.pumpWidget( MaterialApp.router( @@ -1160,7 +1160,7 @@ void main() { testWidgets( 'Handles the Android back button when a second Shell has a GoRoute with parentNavigator key', (WidgetTester tester) async { - final List log = []; + final log = []; TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler(SystemChannels.platform, ( MethodCall methodCall, @@ -1175,14 +1175,14 @@ void main() { expect(log, expectations); } - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey shellNavigatorKeyA = + final shellNavigatorKeyA = GlobalKey(); - final GlobalKey shellNavigatorKeyB = + final shellNavigatorKeyB = GlobalKey(); - final List routes = [ + final routes = [ ShellRoute( navigatorKey: shellNavigatorKeyA, builder: (BuildContext context, GoRouterState state, Widget child) { @@ -1254,7 +1254,7 @@ void main() { ); group('report correct url', () { - final List log = []; + final log = []; setUp(() { GoRouter.optionURLReflectsImperativeAPIs = false; TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger @@ -1276,7 +1276,7 @@ void main() { 'on push shell route with optionURLReflectImperativeAPIs = true', (WidgetTester tester) async { GoRouter.optionURLReflectsImperativeAPIs = true; - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -1302,7 +1302,7 @@ void main() { log.clear(); router.push('/c?foo=bar'); - final RouteMatchListCodec codec = RouteMatchListCodec( + final codec = RouteMatchListCodec( router.configuration, ); await tester.pumpAndSettle(); @@ -1322,7 +1322,7 @@ void main() { WidgetTester tester, ) async { GoRouter.optionURLReflectsImperativeAPIs = true; - final List routes = [ + final routes = [ GoRoute(path: '/', builder: (_, __) => const DummyScreen()), GoRoute(path: '/settings', builder: (_, __) => const DummyScreen()), ]; @@ -1331,7 +1331,7 @@ void main() { log.clear(); router.push('/settings'); - final RouteMatchListCodec codec = RouteMatchListCodec( + final codec = RouteMatchListCodec( router.configuration, ); await tester.pumpAndSettle(); @@ -1347,7 +1347,7 @@ void main() { }); testWidgets('on push', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute(path: '/', builder: (_, __) => const DummyScreen()), GoRoute(path: '/settings', builder: (_, __) => const DummyScreen()), ]; @@ -1356,7 +1356,7 @@ void main() { log.clear(); router.push('/settings'); - final RouteMatchListCodec codec = RouteMatchListCodec( + final codec = RouteMatchListCodec( router.configuration, ); await tester.pumpAndSettle(); @@ -1371,7 +1371,7 @@ void main() { }); testWidgets('on pop', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const DummyScreen(), @@ -1386,7 +1386,7 @@ void main() { tester, initialLocation: '/settings', ); - final RouteMatchListCodec codec = RouteMatchListCodec( + final codec = RouteMatchListCodec( router.configuration, ); log.clear(); @@ -1403,7 +1403,7 @@ void main() { }); testWidgets('on pop twice', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const DummyScreen(), @@ -1427,7 +1427,7 @@ void main() { tester, initialLocation: '/settings/profile', ); - final RouteMatchListCodec codec = RouteMatchListCodec( + final codec = RouteMatchListCodec( router.configuration, ); log.clear(); @@ -1445,7 +1445,7 @@ void main() { }); testWidgets('on pop with path parameters', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const DummyScreen(), @@ -1463,7 +1463,7 @@ void main() { tester, initialLocation: '/settings/123', ); - final RouteMatchListCodec codec = RouteMatchListCodec( + final codec = RouteMatchListCodec( router.configuration, ); log.clear(); @@ -1482,7 +1482,7 @@ void main() { testWidgets('on pop with path parameters case 2', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const DummyScreen(), @@ -1497,7 +1497,7 @@ void main() { tester, initialLocation: '/123/', ); - final RouteMatchListCodec codec = RouteMatchListCodec( + final codec = RouteMatchListCodec( router.configuration, ); log.clear(); @@ -1516,10 +1516,10 @@ void main() { testWidgets('Can manually pop root navigator and display correct url', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) { @@ -1558,7 +1558,7 @@ void main() { initialLocation: '/b/c', navigatorKey: rootNavigatorKey, ); - final RouteMatchListCodec codec = RouteMatchListCodec( + final codec = RouteMatchListCodec( router.configuration, ); expect(find.text('Screen C'), findsOneWidget); @@ -1589,7 +1589,7 @@ void main() { testWidgets('can handle route information update from browser', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const DummyScreen(key: ValueKey('home')), @@ -1615,13 +1615,13 @@ void main() { await tester.pumpAndSettle(); expect(find.byKey(const ValueKey('settings-1')), findsOneWidget); - final Map arguments = + final arguments = log.last.arguments as Map; // Stores the state after the last push. This should contain the encoded // RouteMatchList. final Object? state = (log.last.arguments as Map)['state']; - final String location = + final location = (arguments['location'] ?? arguments['uri']!) as String; router.go('/'); @@ -1647,15 +1647,15 @@ void main() { testWidgets('works correctly with async redirect', ( WidgetTester tester, ) async { - final UniqueKey login = UniqueKey(); - final List routes = [ + final login = UniqueKey(); + final routes = [ GoRoute(path: '/', builder: (_, __) => const DummyScreen()), GoRoute( path: '/login', builder: (_, __) => DummyScreen(key: login), ), ]; - final Completer completer = Completer(); + final completer = Completer(); final GoRouter router = await createRouter( routes, tester, @@ -1664,7 +1664,7 @@ void main() { return '/login'; }, ); - final RouteMatchListCodec codec = RouteMatchListCodec( + final codec = RouteMatchListCodec( router.configuration, ); await tester.pumpAndSettle(); @@ -1690,7 +1690,7 @@ void main() { group('named routes', () { testWidgets('match home route', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( name: 'home', path: '/', @@ -1704,7 +1704,7 @@ void main() { }); testWidgets('match too many routes', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute(name: 'home', path: '/', builder: dummy), GoRoute(name: 'home', path: '/', builder: dummy), ]; @@ -1722,7 +1722,7 @@ void main() { testWidgets('match no routes', (WidgetTester tester) async { await expectLater(() async { - final List routes = [ + final routes = [ GoRoute(name: 'home', path: '/', builder: dummy), ]; final GoRouter router = await createRouter(routes, tester); @@ -1731,7 +1731,7 @@ void main() { }); testWidgets('match 2nd top level route', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( name: 'home', path: '/', @@ -1751,7 +1751,7 @@ void main() { }); testWidgets('match sub-route', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( name: 'home', path: '/', @@ -1773,7 +1773,7 @@ void main() { }); testWidgets('match w/ params', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( name: 'home', path: '/', @@ -1811,7 +1811,7 @@ void main() { }); testWidgets('too few params', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( name: 'home', path: '/', @@ -1843,7 +1843,7 @@ void main() { }); testWidgets('cannot match case insensitive', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( name: 'home', path: '/', @@ -1883,7 +1883,7 @@ void main() { }); testWidgets('too few params', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( name: 'family', path: '/family/:fid', @@ -1898,7 +1898,7 @@ void main() { }); testWidgets('too many params', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( name: 'family', path: '/family/:fid', @@ -1916,7 +1916,7 @@ void main() { }); testWidgets('sparsely named routes', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute(path: '/', builder: dummy, redirect: (_, __) => '/family/f2'), GoRoute( path: '/family/:fid', @@ -1948,8 +1948,8 @@ void main() { testWidgets('preserve path param spaces and slashes', ( WidgetTester tester, ) async { - const String param1 = 'param w/ spaces and slashes'; - final List routes = [ + const param1 = 'param w/ spaces and slashes'; + final routes = [ GoRoute( name: 'page1', path: '/page1/:param1', @@ -1976,8 +1976,8 @@ void main() { testWidgets('preserve query param spaces and slashes', ( WidgetTester tester, ) async { - const String param1 = 'param w/ spaces and slashes'; - final List routes = [ + const param1 = 'param w/ spaces and slashes'; + final routes = [ GoRoute( name: 'page1', path: '/page1', @@ -2003,7 +2003,7 @@ void main() { group('go relative', () { testWidgets('from default route', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -2025,7 +2025,7 @@ void main() { }); testWidgets('from non-default route', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/home', builder: (BuildContext context, GoRouterState state) => @@ -2048,10 +2048,10 @@ void main() { }); testWidgets('match w/ path params', (WidgetTester tester) async { - const String fid = 'f2'; - const String pid = 'p1'; + const fid = 'f2'; + const pid = 'p1'; - final List routes = [ + final routes = [ GoRoute( path: '/home', builder: (BuildContext context, GoRouterState state) => @@ -2095,10 +2095,10 @@ void main() { }); testWidgets('match w/ query params', (WidgetTester tester) async { - const String fid = 'f2'; - const String pid = 'p1'; + const fid = 'f2'; + const pid = 'p1'; - final List routes = [ + final routes = [ GoRoute( path: '/home', builder: (BuildContext context, GoRouterState state) => @@ -2140,9 +2140,9 @@ void main() { }); testWidgets('too few params', (WidgetTester tester) async { - const String pid = 'p1'; + const pid = 'p1'; - final List routes = [ + final routes = [ GoRoute( path: '/home', builder: (BuildContext context, GoRouterState state) => @@ -2181,7 +2181,7 @@ void main() { }); testWidgets('match no route', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/home', builder: (BuildContext context, GoRouterState state) => @@ -2223,8 +2223,8 @@ void main() { testWidgets('preserve path param spaces and slashes', ( WidgetTester tester, ) async { - const String param1 = 'param w/ spaces and slashes'; - final List routes = [ + const param1 = 'param w/ spaces and slashes'; + final routes = [ GoRoute( path: '/home', builder: dummy, @@ -2245,7 +2245,7 @@ void main() { tester, initialLocation: '/home', ); - final String loc = 'page1/${Uri.encodeComponent(param1)}'; + final loc = 'page1/${Uri.encodeComponent(param1)}'; router.go('./$loc'); await tester.pumpAndSettle(); @@ -2258,8 +2258,8 @@ void main() { testWidgets('preserve query param spaces and slashes', ( WidgetTester tester, ) async { - const String param1 = 'param w/ spaces and slashes'; - final List routes = [ + const param1 = 'param w/ spaces and slashes'; + final routes = [ GoRoute( path: '/home', builder: dummy, @@ -2281,7 +2281,7 @@ void main() { initialLocation: '/home', ); - final String loc = Uri( + final loc = Uri( path: 'page1', queryParameters: {'param1': param1}, ).toString(); @@ -2297,7 +2297,7 @@ void main() { group('redirects', () { testWidgets('top-level redirect', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -2316,7 +2316,7 @@ void main() { ], ), ]; - bool redirected = false; + var redirected = false; final GoRouter router = await createRouter( routes, @@ -2348,8 +2348,8 @@ void main() { testWidgets('error thrown during redirect can be caught by onException', ( WidgetTester tester, ) async { - bool exceptionCaught = false; - final List routes = [ + var exceptionCaught = false; + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -2400,7 +2400,7 @@ void main() { WidgetTester tester, ) async { String? capturedNamedLocation; - final List routes = [ + final routes = [ GoRoute( path: '/', name: 'home', @@ -2430,7 +2430,7 @@ void main() { testWidgets('redirect can redirect to same path', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -2469,7 +2469,7 @@ void main() { testWidgets('top-level redirect w/ named routes', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( name: 'home', path: '/', @@ -2507,7 +2507,7 @@ void main() { }); testWidgets('route-level redirect', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -2540,7 +2540,7 @@ void main() { testWidgets('top-level redirect take priority over route level', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -2569,7 +2569,7 @@ void main() { ], ), ]; - bool redirected = false; + var redirected = false; final GoRouter router = await createRouter( routes, tester, @@ -2593,7 +2593,7 @@ void main() { testWidgets('route-level redirect w/ named routes', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( name: 'home', path: '/', @@ -2628,7 +2628,7 @@ void main() { }); testWidgets('multiple mixed redirect', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -2767,7 +2767,7 @@ void main() { testWidgets('expect null path/fullPath on top-level redirect', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -2789,7 +2789,7 @@ void main() { }); testWidgets('top-level redirect state', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -2827,7 +2827,7 @@ void main() { testWidgets('top-level redirect state contains path parameters', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -2861,8 +2861,8 @@ void main() { }); testWidgets('route-level redirect state', (WidgetTester tester) async { - const String loc = '/book/0'; - final List routes = [ + const loc = '/book/0'; + final routes = [ GoRoute( path: '/book/:bookId', redirect: (BuildContext context, GoRouterState state) { @@ -2893,7 +2893,7 @@ void main() { testWidgets('sub-sub-route-level redirect params', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext c, GoRouterState s) => const HomeScreen(), @@ -3000,10 +3000,10 @@ void main() { }); testWidgets('extra not null in redirect', (WidgetTester tester) async { - bool isCallTopRedirect = false; - bool isCallRouteRedirect = false; + var isCallTopRedirect = false; + var isCallRouteRedirect = false; - final List routes = [ + final routes = [ GoRoute( name: 'home', path: '/', @@ -3050,7 +3050,7 @@ void main() { testWidgets('parent route level redirect take priority over child', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3102,7 +3102,7 @@ void main() { testWidgets('redirect when go to a shell route', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ ShellRoute( redirect: (BuildContext context, GoRouterState state) => '/dummy', builder: (BuildContext context, GoRouterState state, Widget child) => @@ -3129,7 +3129,7 @@ void main() { final GoRouter router = await createRouter(routes, tester); - for (final String shellRoute in ['/other', '/other2']) { + for (final shellRoute in ['/other', '/other2']) { router.go(shellRoute); await tester.pump(); expect( @@ -3142,7 +3142,7 @@ void main() { testWidgets('redirect when go to a stateful shell route', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( redirect: (BuildContext context, GoRouterState state) => '/dummy', builder: @@ -3183,7 +3183,7 @@ void main() { final GoRouter router = await createRouter(routes, tester); - for (final String shellRoute in ['/other', '/other2']) { + for (final shellRoute in ['/other', '/other2']) { router.go(shellRoute); await tester.pump(); expect( @@ -3196,7 +3196,7 @@ void main() { group('initial location', () { testWidgets('initial location', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3223,7 +3223,7 @@ void main() { }); testWidgets('initial location with extra', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3253,7 +3253,7 @@ void main() { }); testWidgets('initial location w/ redirection', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3283,7 +3283,7 @@ void main() { .defaultRouteNameTestValue = '/dummy'; - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3320,7 +3320,7 @@ void main() { }); group('_effectiveInitialLocation()', () { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3382,7 +3382,7 @@ void main() { group('params', () { testWidgets('preserve path param case', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3396,8 +3396,8 @@ void main() { ]; final GoRouter router = await createRouter(routes, tester); - for (final String fid in ['f2', 'F2']) { - final String loc = '/family/$fid'; + for (final fid in ['f2', 'F2']) { + final loc = '/family/$fid'; router.go(loc); await tester.pumpAndSettle(); final RouteMatchList matches = @@ -3411,7 +3411,7 @@ void main() { }); testWidgets('preserve query param case', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3425,8 +3425,8 @@ void main() { ]; final GoRouter router = await createRouter(routes, tester); - for (final String fid in ['f2', 'F2']) { - final String loc = '/family?fid=$fid'; + for (final fid in ['f2', 'F2']) { + final loc = '/family?fid=$fid'; router.go(loc); await tester.pumpAndSettle(); final RouteMatchList matches = @@ -3442,8 +3442,8 @@ void main() { testWidgets('preserve path param spaces and slashes', ( WidgetTester tester, ) async { - const String param1 = 'param w/ spaces and slashes'; - final List routes = [ + const param1 = 'param w/ spaces and slashes'; + final routes = [ GoRoute( path: '/page1/:param1', builder: (BuildContext c, GoRouterState s) { @@ -3454,7 +3454,7 @@ void main() { ]; final GoRouter router = await createRouter(routes, tester); - final String loc = '/page1/${Uri.encodeComponent(param1)}'; + final loc = '/page1/${Uri.encodeComponent(param1)}'; router.go(loc); await tester.pumpAndSettle(); @@ -3466,8 +3466,8 @@ void main() { testWidgets('preserve query param spaces and slashes', ( WidgetTester tester, ) async { - const String param1 = 'param w/ spaces and slashes'; - final List routes = [ + const param1 = 'param w/ spaces and slashes'; + final routes = [ GoRoute( path: '/page1', builder: (BuildContext c, GoRouterState s) { @@ -3485,7 +3485,7 @@ void main() { expect(find.byType(DummyScreen), findsOneWidget); expect(matches.uri.queryParameters['param1'], param1); - final String loc = '/page1?param1=${Uri.encodeQueryComponent(param1)}'; + final loc = '/page1?param1=${Uri.encodeQueryComponent(param1)}'; router.go(loc); await tester.pumpAndSettle(); @@ -3621,7 +3621,7 @@ void main() { }); testWidgets('keep param in nested route', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3646,9 +3646,9 @@ void main() { ]; final GoRouter router = await createRouter(routes, tester); - const String fid = 'f1'; - const String pid = 'p2'; - const String loc = '/family/$fid/person/$pid'; + const fid = 'f1'; + const pid = 'p2'; + const loc = '/family/$fid/person/$pid'; router.push(loc); await tester.pumpAndSettle(); @@ -3656,7 +3656,7 @@ void main() { expect(matches.matches, hasLength(2)); expect(find.byType(PersonScreen), findsOneWidget); - final ImperativeRouteMatch imperativeRouteMatch = + final imperativeRouteMatch = matches.matches.last as ImperativeRouteMatch; expect(imperativeRouteMatch.matches.uri.toString(), loc); expect(imperativeRouteMatch.matches.pathParameters['fid'], fid); @@ -3667,7 +3667,7 @@ void main() { WidgetTester tester, ) async { StatefulNavigationShell? routeState; - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( builder: ( @@ -3724,9 +3724,9 @@ void main() { tester, initialLocation: '/a', ); - const String fid = 'f1'; - const String pid = 'p2'; - const String loc = '/family/$fid/person/$pid'; + const fid = 'f1'; + const pid = 'p2'; + const loc = '/family/$fid/person/$pid'; router.go(loc); await tester.pumpAndSettle(); @@ -3734,7 +3734,7 @@ void main() { expect(router.routerDelegate.currentConfiguration.uri.toString(), loc); expect(matches.matches, hasLength(1)); - final ShellRouteMatch shellRouteMatch = + final shellRouteMatch = matches.matches.first as ShellRouteMatch; expect(shellRouteMatch.matches, hasLength(3)); expect(find.byType(PersonScreen), findsOneWidget); @@ -3760,7 +3760,7 @@ void main() { ) async { StatefulNavigationShell? routeState; Object? latestExtra; - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( builder: ( @@ -3795,7 +3795,7 @@ void main() { ], ), ]; - final Object expectedExtra = Object(); + final expectedExtra = Object(); await createRouter( routes, @@ -3824,7 +3824,7 @@ void main() { expect(uri.queryParametersAll, queryParametersAll); } - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3884,7 +3884,7 @@ void main() { expect(uri.queryParametersAll, queryParametersAll); } - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3935,7 +3935,7 @@ void main() { expect(uri.queryParametersAll, queryParametersAll); } - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -3974,9 +3974,9 @@ void main() { }); group('GoRouterHelper extensions', () { - final GlobalKey key = + final key = GlobalKey(); - final List routes = [ + final routes = [ GoRoute( path: '/', name: 'home', @@ -3991,20 +3991,20 @@ void main() { ), ]; - const String name = 'page1'; - final Map params = { + const name = 'page1'; + final params = { 'a-param-key': 'a-param-value', }; - final Map queryParams = { + final queryParams = { 'a-query-key': 'a-query-value', }; - const String location = '/page1'; - const String extra = 'Hello'; + const location = '/page1'; + const extra = 'Hello'; testWidgets('calls [namedLocation] on closest GoRouter', ( WidgetTester tester, ) async { - final GoRouterNamedLocationSpy router = GoRouterNamedLocationSpy( + final router = GoRouterNamedLocationSpy( routes: routes, ); addTearDown(router.dispose); @@ -4022,7 +4022,7 @@ void main() { }); testWidgets('calls [go] on closest GoRouter', (WidgetTester tester) async { - final GoRouterGoSpy router = GoRouterGoSpy(routes: routes); + final router = GoRouterGoSpy(routes: routes); addTearDown(router.dispose); await tester.pumpWidget( MaterialApp.router(routerConfig: router, title: 'GoRouter Example'), @@ -4035,7 +4035,7 @@ void main() { testWidgets('calls [goNamed] on closest GoRouter', ( WidgetTester tester, ) async { - final GoRouterGoNamedSpy router = GoRouterGoNamedSpy(routes: routes); + final router = GoRouterGoNamedSpy(routes: routes); addTearDown(router.dispose); await tester.pumpWidget( MaterialApp.router(routerConfig: router, title: 'GoRouter Example'), @@ -4055,7 +4055,7 @@ void main() { testWidgets('calls [push] on closest GoRouter', ( WidgetTester tester, ) async { - final GoRouterPushSpy router = GoRouterPushSpy(routes: routes); + final router = GoRouterPushSpy(routes: routes); addTearDown(router.dispose); await tester.pumpWidget( MaterialApp.router(routerConfig: router, title: 'GoRouter Example'), @@ -4068,7 +4068,7 @@ void main() { testWidgets('calls [push] on closest GoRouter and waits for result', ( WidgetTester tester, ) async { - final GoRouterPushSpy router = GoRouterPushSpy(routes: routes); + final router = GoRouterPushSpy(routes: routes); addTearDown(router.dispose); await tester.pumpWidget( MaterialApp.router( @@ -4087,7 +4087,7 @@ void main() { testWidgets('calls [pushNamed] on closest GoRouter', ( WidgetTester tester, ) async { - final GoRouterPushNamedSpy router = GoRouterPushNamedSpy(routes: routes); + final router = GoRouterPushNamedSpy(routes: routes); addTearDown(router.dispose); await tester.pumpWidget( MaterialApp.router(routerConfig: router, title: 'GoRouter Example'), @@ -4107,7 +4107,7 @@ void main() { testWidgets('calls [pushNamed] on closest GoRouter and waits for result', ( WidgetTester tester, ) async { - final GoRouterPushNamedSpy router = GoRouterPushNamedSpy(routes: routes); + final router = GoRouterPushNamedSpy(routes: routes); addTearDown(router.dispose); await tester.pumpWidget( MaterialApp.router( @@ -4131,7 +4131,7 @@ void main() { }); testWidgets('calls [pop] on closest GoRouter', (WidgetTester tester) async { - final GoRouterPopSpy router = GoRouterPopSpy(routes: routes); + final router = GoRouterPopSpy(routes: routes); addTearDown(router.dispose); await tester.pumpWidget( MaterialApp.router(routerConfig: router, title: 'GoRouter Example'), @@ -4144,7 +4144,7 @@ void main() { testWidgets('calls [pop] on closest GoRouter with result', ( WidgetTester tester, ) async { - final GoRouterPopSpy router = GoRouterPopSpy(routes: routes); + final router = GoRouterPopSpy(routes: routes); addTearDown(router.dispose); await tester.pumpWidget( MaterialApp.router(routerConfig: router, title: 'GoRouter Example'), @@ -4157,7 +4157,7 @@ void main() { group('ShellRoute', () { testWidgets('defaultRoute', (WidgetTester tester) async { - final List routes = [ + final routes = [ ShellRoute( builder: (BuildContext context, GoRouterState state, Widget child) { return Scaffold(body: child); @@ -4185,7 +4185,7 @@ void main() { testWidgets('can complete leaf route', (WidgetTester tester) async { Future? routeFuture; - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) { @@ -4229,7 +4229,7 @@ void main() { testWidgets( 'Pops from the correct Navigator when the Android back button is pressed', (WidgetTester tester) async { - final List routes = [ + final routes = [ ShellRoute( builder: (BuildContext context, GoRouterState state, Widget child) { return Scaffold( @@ -4276,12 +4276,12 @@ void main() { testWidgets('Pops from the correct navigator when a sub-route is placed on ' 'the root Navigator', (WidgetTester tester) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey shellNavigatorKey = + final shellNavigatorKey = GlobalKey(); - final List routes = [ + final routes = [ ShellRoute( navigatorKey: shellNavigatorKey, builder: (BuildContext context, GoRouterState state, Widget child) { @@ -4333,10 +4333,10 @@ void main() { }); testWidgets('Builds StatefulShellRoute', (WidgetTester tester) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( builder: ( @@ -4385,10 +4385,10 @@ void main() { testWidgets('Builds StatefulShellRoute as a sub-route', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final List routes = [ + final routes = [ GoRoute( path: '/root', builder: (BuildContext context, GoRouterState state) => @@ -4444,13 +4444,13 @@ void main() { testWidgets( 'Navigation with goBranch is correctly handled in StatefulShellRoute', (WidgetTester tester) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey statefulWidgetKey = + final statefulWidgetKey = GlobalKey(); StatefulNavigationShell? routeState; - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( builder: ( @@ -4546,13 +4546,13 @@ void main() { 'Navigates to correct nested navigation tree in StatefulShellRoute ' 'and maintains state', (WidgetTester tester) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey statefulWidgetKey = + final statefulWidgetKey = GlobalKey(); StatefulNavigationShell? routeState; - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( builder: ( @@ -4635,7 +4635,7 @@ void main() { (WidgetTester tester) async { StatefulNavigationShell? routeState; - final List routes = [ + final routes = [ GoRoute( path: '/:id', builder: (_, __) => const Placeholder(), @@ -4687,14 +4687,14 @@ void main() { testWidgets('Maintains state for nested StatefulShellRoute', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey statefulWidgetKey = + final statefulWidgetKey = GlobalKey(); StatefulNavigationShell? routeState1; StatefulNavigationShell? routeState2; - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( builder: ( @@ -4815,15 +4815,15 @@ void main() { 'Pops from the correct Navigator in a StatefulShellRoute when the ' 'Android back button is pressed', (WidgetTester tester) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey sectionANavigatorKey = + final sectionANavigatorKey = GlobalKey(); - final GlobalKey sectionBNavigatorKey = + final sectionBNavigatorKey = GlobalKey(); StatefulNavigationShell? routeState; - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( builder: ( @@ -4914,11 +4914,11 @@ void main() { testWidgets('Maintains extra navigation information when navigating ' 'between branches in StatefulShellRoute', (WidgetTester tester) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); StatefulNavigationShell? routeState; - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( builder: ( @@ -4980,11 +4980,11 @@ void main() { 'navigating between branches in StatefulShellRoute', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); StatefulNavigationShell? routeState; - final List routes = [ + final routes = [ GoRoute( path: '/common', builder: (BuildContext context, GoRouterState state) => @@ -5056,20 +5056,20 @@ void main() { testWidgets('Preloads routes correctly in a StatefulShellRoute', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey statefulWidgetKeyA = + final statefulWidgetKeyA = GlobalKey(debugLabel: 'A'); - final GlobalKey statefulWidgetKeyB = + final statefulWidgetKeyB = GlobalKey(debugLabel: 'B'); - final GlobalKey statefulWidgetKeyC = + final statefulWidgetKeyC = GlobalKey(debugLabel: 'C'); - final GlobalKey statefulWidgetKeyD = + final statefulWidgetKeyD = GlobalKey(debugLabel: 'D'); - final GlobalKey statefulWidgetKeyE = + final statefulWidgetKeyE = GlobalKey(debugLabel: 'E'); - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( builder: mockStackedShellBuilder, branches: [ @@ -5159,18 +5159,18 @@ void main() { testWidgets('Preloads nested routes correctly in a StatefulShellRoute', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey statefulWidgetKeyA = + final statefulWidgetKeyA = GlobalKey(debugLabel: 'A'); - final GlobalKey statefulWidgetKeyB = + final statefulWidgetKeyB = GlobalKey(debugLabel: 'B'); - final GlobalKey statefulWidgetKeyC = + final statefulWidgetKeyC = GlobalKey(debugLabel: 'C'); - final GlobalKey statefulWidgetKeyD = + final statefulWidgetKeyD = GlobalKey(debugLabel: 'D'); - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( builder: mockStackedShellBuilder, branches: [ @@ -5243,11 +5243,11 @@ void main() { testWidgets('Redirects are correctly handled when switching branch in a ' 'StatefulShellRoute', (WidgetTester tester) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); StatefulNavigationShell? routeState; - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( builder: ( @@ -5308,7 +5308,7 @@ void main() { ), ]; - String redirectDestinationBranchB = '/b/details1'; + var redirectDestinationBranchB = '/b/details1'; await createRouter( routes, tester, @@ -5346,13 +5346,13 @@ void main() { testWidgets( 'Pushed top-level route is correctly handled by StatefulShellRoute', (WidgetTester tester) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey nestedNavigatorKey = + final nestedNavigatorKey = GlobalKey(); StatefulNavigationShell? routeState; - final List routes = [ + final routes = [ // First level shell StatefulShellRoute.indexedStack( builder: @@ -5481,9 +5481,9 @@ void main() { // TODO(tolo): Temporarily skipped due to a bug that causes test to faiL skip: true, (WidgetTester tester) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(debugLabel: 'root'); - final GlobalKey statefulShellKey = + final statefulShellKey = GlobalKey(debugLabel: 'shell'); StatefulNavigationShell? routeState; StatefulShellBranch makeBranch(String name) => StatefulShellBranch( @@ -5519,7 +5519,7 @@ void main() { ), ]; - final ValueNotifier config = + final config = ValueNotifier( RoutingConfig(routes: createRoutes(true)), ); @@ -5556,9 +5556,9 @@ void main() { testWidgets( 'It should return false if Navigator.canPop() returns false.', (WidgetTester tester) async { - final GlobalKey navigatorKey = + final navigatorKey = GlobalKey(); - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/', navigatorKey: navigatorKey, routes: [ @@ -5612,9 +5612,9 @@ void main() { testWidgets('It checks if ShellRoute navigators can pop', ( WidgetTester tester, ) async { - final GlobalKey shellNavigatorKey = + final shellNavigatorKey = GlobalKey(); - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/a', routes: [ ShellRoute( @@ -5678,9 +5678,9 @@ void main() { testWidgets('It checks if StatefulShellRoute navigators can pop', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GoRouter router = GoRouter( + final router = GoRouter( navigatorKey: rootNavigatorKey, initialLocation: '/a', routes: [ @@ -5749,14 +5749,14 @@ void main() { testWidgets('Pageless route should include in can pop', ( WidgetTester tester, ) async { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey shell = GlobalKey( + final shell = GlobalKey( debugLabel: 'shell', ); - final GoRouter router = GoRouter( + final router = GoRouter( navigatorKey: root, routes: [ ShellRoute( @@ -5801,14 +5801,14 @@ void main() { testWidgets( 'Should pop from the correct navigator when parentNavigatorKey is set', (WidgetTester tester) async { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey shell = GlobalKey( + final shell = GlobalKey( debugLabel: 'shell', ); - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/a/b', navigatorKey: root, routes: [ @@ -5885,14 +5885,14 @@ void main() { testWidgets('Should pop dialog if it is present', ( WidgetTester tester, ) async { - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); - final GlobalKey shell = GlobalKey( + final shell = GlobalKey( debugLabel: 'shell', ); - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/a', navigatorKey: root, routes: [ @@ -5960,10 +5960,10 @@ void main() { testWidgets('Triggers a Hero inside a ShellRoute', ( WidgetTester tester, ) async { - final UniqueKey heroKey = UniqueKey(); - const String kHeroTag = 'hero'; + final heroKey = UniqueKey(); + const kHeroTag = 'hero'; - final List routes = [ + final routes = [ ShellRoute( builder: (BuildContext context, GoRouterState state, Widget child) { return child; @@ -6016,8 +6016,8 @@ void main() { testWidgets('It should return the go router instance of the widget tree', ( WidgetTester tester, ) async { - const Key key = Key('key'); - final List routes = [ + const key = Key('key'); + final routes = [ GoRoute( path: '/', builder: (_, __) => const SizedBox(key: key), @@ -6033,7 +6033,7 @@ void main() { testWidgets('It should throw if there is no go router in the widget tree', ( WidgetTester tester, ) async { - const Key key = Key('key'); + const key = Key('key'); await tester.pumpWidget(const SizedBox(key: key)); final Element context = tester.element(find.byKey(key)); @@ -6045,8 +6045,8 @@ void main() { testWidgets('It should return the go router instance of the widget tree', ( WidgetTester tester, ) async { - const Key key = Key('key'); - final List routes = [ + const key = Key('key'); + final routes = [ GoRoute( path: '/', builder: (_, __) => const SizedBox(key: key), @@ -6062,7 +6062,7 @@ void main() { testWidgets( 'It should return null if there is no go router in the widget tree', (WidgetTester tester) async { - const Key key = Key('key'); + const key = Key('key'); await tester.pumpWidget(const SizedBox(key: key)); final Element context = tester.element(find.byKey(key)); @@ -6073,10 +6073,10 @@ void main() { group('state restoration', () { testWidgets('Restores state correctly', (WidgetTester tester) async { - final GlobalKey statefulWidgetKeyA = + final statefulWidgetKeyA = GlobalKey(); - final List routes = [ + final routes = [ GoRoute( path: '/a', pageBuilder: createPageBuilder( @@ -6124,17 +6124,17 @@ void main() { testWidgets('Restores state of branches in StatefulShellRoute correctly', ( WidgetTester tester, ) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey statefulWidgetKeyA = + final statefulWidgetKeyA = GlobalKey(); - final GlobalKey statefulWidgetKeyB = + final statefulWidgetKeyB = GlobalKey(); - final GlobalKey statefulWidgetKeyC = + final statefulWidgetKeyC = GlobalKey(); StatefulNavigationShell? routeState; - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( restorationScopeId: 'shell', pageBuilder: @@ -6286,16 +6286,16 @@ void main() { testWidgets( 'Restores state of imperative routes in StatefulShellRoute correctly', (WidgetTester tester) async { - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(); - final GlobalKey statefulWidgetKeyA = + final statefulWidgetKeyA = GlobalKey(); - final GlobalKey statefulWidgetKeyB = + final statefulWidgetKeyB = GlobalKey(); StatefulNavigationShell? routeStateRoot; StatefulNavigationShell? routeStateNested; - final List routes = [ + final routes = [ StatefulShellRoute.indexedStack( restorationScopeId: 'shell', pageBuilder: @@ -6487,10 +6487,10 @@ void main() { '/some-route'; final String platformRoute = WidgetsBinding.instance.platformDispatcher.defaultRouteName; - const String expectedInitialRoute = '/kyc'; + const expectedInitialRoute = '/kyc'; expect(platformRoute != expectedInitialRoute, isTrue); - final List routes = [ + final routes = [ GoRoute( path: '/abc', builder: (BuildContext context, GoRouterState state) => @@ -6519,7 +6519,7 @@ void main() { testWidgets( 'test the pathParameters in redirect when the Router is recreated', (WidgetTester tester) async { - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/foo', routes: [ GoRoute( @@ -6553,7 +6553,7 @@ void main() { testWidgets( 'should return the current GoRouterState when router.currentState is called', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( name: 'home', path: '/', @@ -6629,7 +6629,7 @@ void main() { testWidgets('should allow route paths without leading /', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', // root cannot be empty (existing assert) builder: (BuildContext context, GoRouterState state) => @@ -6677,7 +6677,7 @@ void main() { testWidgets('should allow route paths with leading /', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -6749,7 +6749,7 @@ class IsRouteUpdateCall extends Matcher { if (item.arguments is! Map) { return false; } - final Map arguments = + final arguments = item.arguments as Map; // TODO(chunhtai): update this when minimum flutter version includes // https://github.com/flutter/flutter/pull/119968. diff --git a/packages/go_router/test/helpers/error_screen_helpers.dart b/packages/go_router/test/helpers/error_screen_helpers.dart index 1ac2752ef72..4cdbed8e835 100644 --- a/packages/go_router/test/helpers/error_screen_helpers.dart +++ b/packages/go_router/test/helpers/error_screen_helpers.dart @@ -32,7 +32,7 @@ WidgetTesterCallback testClickingTheButtonRedirectsToRoot({ Widget Function(GoRouter router) appRouterBuilder = materialAppRouterBuilder, }) { return (WidgetTester tester) async { - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/error', routes: [ GoRoute(path: '/', builder: (_, __) => const DummyStatefulWidget()), diff --git a/packages/go_router/test/imperative_api_test.dart b/packages/go_router/test/imperative_api_test.dart index de3cbda0cf0..b56d0eefa56 100644 --- a/packages/go_router/test/imperative_api_test.dart +++ b/packages/go_router/test/imperative_api_test.dart @@ -11,9 +11,9 @@ import 'test_helpers.dart'; void main() { testWidgets('replace inside shell route', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/134524. - final UniqueKey a = UniqueKey(); - final UniqueKey b = UniqueKey(); - final List routes = [ + final a = UniqueKey(); + final b = UniqueKey(); + final routes = [ ShellRoute( builder: (_, __, Widget child) { return Scaffold( @@ -51,9 +51,9 @@ void main() { testWidgets('push from outside of shell route', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/130406. - final UniqueKey a = UniqueKey(); - final UniqueKey b = UniqueKey(); - final List routes = [ + final a = UniqueKey(); + final b = UniqueKey(); + final routes = [ GoRoute( path: '/a', builder: (_, __) => DummyScreen(key: a), @@ -93,9 +93,9 @@ void main() { WidgetTester tester, ) async { // Regression test for https://github.com/flutter/flutter/issues/125752. - final UniqueKey home = UniqueKey(); - final UniqueKey a = UniqueKey(); - final List routes = [ + final home = UniqueKey(); + final a = UniqueKey(); + final routes = [ ShellRoute( builder: (_, GoRouterState state, Widget child) { return Scaffold( @@ -143,9 +143,9 @@ void main() { WidgetTester tester, ) async { // Regression test for https://github.com/flutter/flutter/issues/120791. - final UniqueKey b = UniqueKey(); - final UniqueKey a = UniqueKey(); - final List routes = [ + final b = UniqueKey(); + final a = UniqueKey(); + final routes = [ ShellRoute( builder: (_, __, Widget child) { return Scaffold( @@ -196,9 +196,9 @@ void main() { WidgetTester tester, ) async { // Regression test for https://github.com/flutter/flutter/issues/120665. - final UniqueKey inside = UniqueKey(); - final UniqueKey outside = UniqueKey(); - final List routes = [ + final inside = UniqueKey(); + final outside = UniqueKey(); + final routes = [ ShellRoute( builder: (_, __, Widget child) { return Scaffold( @@ -242,12 +242,12 @@ void main() { testWidgets('complex case 1', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/113001. - final UniqueKey a = UniqueKey(); - final UniqueKey b = UniqueKey(); - final UniqueKey c = UniqueKey(); - final UniqueKey d = UniqueKey(); - final UniqueKey e = UniqueKey(); - final List routes = [ + final a = UniqueKey(); + final b = UniqueKey(); + final c = UniqueKey(); + final d = UniqueKey(); + final e = UniqueKey(); + final routes = [ ShellRoute( builder: (_, __, Widget child) { return Scaffold( diff --git a/packages/go_router/test/information_provider_test.dart b/packages/go_router/test/information_provider_test.dart index ddc96236ad2..93674fcbfd9 100644 --- a/packages/go_router/test/information_provider_test.dart +++ b/packages/go_router/test/information_provider_test.dart @@ -15,7 +15,7 @@ void main() { testWidgets('notifies its listeners when set by the app', ( WidgetTester tester, ) async { - late final GoRouteInformationProvider provider = + late final provider = GoRouteInformationProvider( initialLocation: initialRoute, initialExtra: null, @@ -28,7 +28,7 @@ void main() { testWidgets('notifies its listeners when set by the platform', ( WidgetTester tester, ) async { - late final GoRouteInformationProvider provider = + late final provider = GoRouteInformationProvider( initialLocation: initialRoute, initialExtra: null, @@ -43,12 +43,12 @@ void main() { testWidgets('didPushRouteInformation maintains uri scheme and host', ( WidgetTester tester, ) async { - const String expectedScheme = 'https'; - const String expectedHost = 'www.example.com'; - const String expectedPath = '/some/path'; - const String expectedUriString = + const expectedScheme = 'https'; + const expectedHost = 'www.example.com'; + const expectedPath = '/some/path'; + const expectedUriString = '$expectedScheme://$expectedHost$expectedPath'; - late final GoRouteInformationProvider provider = + late final provider = GoRouteInformationProvider( initialLocation: initialRoute, initialExtra: null, @@ -67,12 +67,12 @@ void main() { testWidgets('didPushRoute maintains uri scheme and host', ( WidgetTester tester, ) async { - const String expectedScheme = 'https'; - const String expectedHost = 'www.example.com'; - const String expectedPath = '/some/path'; - const String expectedUriString = + const expectedScheme = 'https'; + const expectedHost = 'www.example.com'; + const expectedPath = '/some/path'; + const expectedUriString = '$expectedScheme://$expectedHost$expectedPath'; - late final GoRouteInformationProvider provider = + late final provider = GoRouteInformationProvider( initialLocation: initialRoute, initialExtra: null, @@ -91,9 +91,9 @@ void main() { testWidgets('Route is correctly neglected when routerNeglect is true', ( WidgetTester tester, ) async { - final _SystemChannelsNavigationMock systemChannelsMock = + final systemChannelsMock = _SystemChannelsNavigationMock(); - late final GoRouteInformationProvider provider = + late final provider = GoRouteInformationProvider( initialLocation: initialRoute, initialExtra: null, @@ -112,9 +112,9 @@ void main() { testWidgets('Route is NOT neglected when routerNeglect is false', ( WidgetTester tester, ) async { - final _SystemChannelsNavigationMock systemChannelsMock = + final systemChannelsMock = _SystemChannelsNavigationMock(); - late final GoRouteInformationProvider provider = + late final provider = GoRouteInformationProvider( initialLocation: initialRoute, initialExtra: null, @@ -139,7 +139,7 @@ class _SystemChannelsNavigationMock { ) async { if (methodCall.method == 'routeInformationUpdated' && methodCall.arguments is Map) { - final Map args = + final args = methodCall.arguments as Map; final String? uri = args['location'] as String? ?? args['uri'] as String?; diff --git a/packages/go_router/test/inherited_test.dart b/packages/go_router/test/inherited_test.dart index 995fc669c41..73d669275b3 100644 --- a/packages/go_router/test/inherited_test.dart +++ b/packages/go_router/test/inherited_test.dart @@ -12,7 +12,7 @@ import 'test_helpers.dart'; void main() { group('updateShouldNotify', () { test('does not update when goRouter does not change', () { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( routes: [ GoRoute(path: '/', builder: (_, __) => const Page1()), ], @@ -25,12 +25,12 @@ void main() { }); test('does not update even when goRouter changes', () { - final GoRouter oldGoRouter = GoRouter( + final oldGoRouter = GoRouter( routes: [ GoRoute(path: '/', builder: (_, __) => const Page1()), ], ); - final GoRouter newGoRouter = GoRouter( + final newGoRouter = GoRouter( routes: [ GoRoute(path: '/', builder: (_, __) => const Page2()), ], @@ -44,14 +44,14 @@ void main() { }); test('adds [goRouter] as a diagnostics property', () { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( routes: [GoRoute(path: '/', builder: (_, __) => const Page1())], ); - final InheritedGoRouter inheritedGoRouter = InheritedGoRouter( + final inheritedGoRouter = InheritedGoRouter( goRouter: goRouter, child: Container(), ); - final DiagnosticPropertiesBuilder properties = + final properties = DiagnosticPropertiesBuilder(); inheritedGoRouter.debugFillProperties(properties); expect(properties.properties.length, 1); @@ -62,7 +62,7 @@ void main() { testWidgets("mediates Widget's access to GoRouter.", ( WidgetTester tester, ) async { - final MockGoRouter router = MockGoRouter(); + final router = MockGoRouter(); await tester.pumpWidget( MaterialApp( home: InheritedGoRouter(goRouter: router, child: const _MyWidget()), @@ -75,7 +75,7 @@ void main() { testWidgets('builder can access GoRouter', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/110512. late final GoRouter buildContextRouter; - final GoRouter router = GoRouter( + final router = GoRouter( initialLocation: '/', routes: [ GoRoute( @@ -106,11 +106,11 @@ bool setupInheritedGoRouterChange({ required GoRouter oldGoRouter, required GoRouter newGoRouter, }) { - final InheritedGoRouter oldInheritedGoRouter = InheritedGoRouter( + final oldInheritedGoRouter = InheritedGoRouter( goRouter: oldGoRouter, child: Container(), ); - final InheritedGoRouter newInheritedGoRouter = InheritedGoRouter( + final newInheritedGoRouter = InheritedGoRouter( goRouter: newGoRouter, child: Container(), ); diff --git a/packages/go_router/test/logging_test.dart b/packages/go_router/test/logging_test.dart index a2af20467e5..6d8098aa105 100644 --- a/packages/go_router/test/logging_test.dart +++ b/packages/go_router/test/logging_test.dart @@ -56,7 +56,7 @@ void main() { count: 2, reason: 'Go router should log the 2 events', ); - final List logs = []; + final logs = []; Logger.root.onRecord.listen((LogRecord event) => logs.add(event.message)); GoRouter( debugLogDiagnostics: true, @@ -85,7 +85,7 @@ void main() { ); hierarchicalLoggingEnabled = true; - final List logs = []; + final logs = []; Logger.root.onRecord.listen((LogRecord event) => logs.add(event.message)); GoRouter( debugLogDiagnostics: true, diff --git a/packages/go_router/test/match_test.dart b/packages/go_router/test/match_test.dart index becaadaa540..1b12d2e71d7 100644 --- a/packages/go_router/test/match_test.dart +++ b/packages/go_router/test/match_test.dart @@ -11,8 +11,8 @@ import 'package:go_router/go_router.dart'; void main() { group('RouteMatch', () { test('simple', () { - final GoRoute route = GoRoute(path: '/users/:userId', builder: _builder); - final Map pathParameters = {}; + final route = GoRoute(path: '/users/:userId', builder: _builder); + final pathParameters = {}; final List matches = RouteMatchBase.match( route: route, pathParameters: pathParameters, @@ -28,11 +28,11 @@ void main() { }); test('ShellRoute has a unique pageKey', () { - final ShellRoute route = ShellRoute( + final route = ShellRoute( builder: _shellBuilder, routes: [GoRoute(path: '/users/:userId', builder: _builder)], ); - final Map pathParameters = {}; + final pathParameters = {}; final List matches = RouteMatchBase.match( route: route, uri: Uri.parse('/users/123'), @@ -44,11 +44,11 @@ void main() { }); test('ShellRoute Match has stable unique key', () { - final ShellRoute route = ShellRoute( + final route = ShellRoute( builder: _shellBuilder, routes: [GoRoute(path: '/users/:userId', builder: _builder)], ); - final Map pathParameters = {}; + final pathParameters = {}; final List matches1 = RouteMatchBase.match( route: route, pathParameters: pathParameters, @@ -67,8 +67,8 @@ void main() { }); test('GoRoute Match has stable unique key', () { - final GoRoute route = GoRoute(path: '/users/:userId', builder: _builder); - final Map pathParameters = {}; + final route = GoRoute(path: '/users/:userId', builder: _builder); + final pathParameters = {}; final List matches1 = RouteMatchBase.match( route: route, uri: Uri.parse('/users/123'), @@ -89,10 +89,10 @@ void main() { }); test('complex parentNavigatorKey works', () { - final GlobalKey root = GlobalKey(); - final GlobalKey shell1 = GlobalKey(); - final GlobalKey shell2 = GlobalKey(); - final GoRoute route = GoRoute( + final root = GlobalKey(); + final shell1 = GlobalKey(); + final shell2 = GlobalKey(); + final route = GoRoute( path: '/', builder: _builder, routes: [ @@ -134,7 +134,7 @@ void main() { ), ], ); - final Map pathParameters = {}; + final pathParameters = {}; final List matches = RouteMatchBase.match( route: route, pathParameters: pathParameters, @@ -165,7 +165,7 @@ void main() { }); group('ImperativeRouteMatch', () { - final RouteMatchList matchList1 = RouteMatchList( + final matchList1 = RouteMatchList( matches: [ RouteMatch( route: GoRoute(path: '/', builder: (_, __) => const Text('hi')), @@ -177,7 +177,7 @@ void main() { pathParameters: const {}, ); - final RouteMatchList matchList2 = RouteMatchList( + final matchList2 = RouteMatchList( matches: [ RouteMatch( route: GoRoute(path: '/a', builder: (_, __) => const Text('a')), @@ -189,19 +189,19 @@ void main() { pathParameters: const {}, ); - const ValueKey key1 = ValueKey('key1'); - const ValueKey key2 = ValueKey('key2'); + const key1 = ValueKey('key1'); + const key2 = ValueKey('key2'); - final Completer completer1 = Completer(); - final Completer completer2 = Completer(); + final completer1 = Completer(); + final completer2 = Completer(); test('can equal and has', () async { - ImperativeRouteMatch match1 = ImperativeRouteMatch( + var match1 = ImperativeRouteMatch( pageKey: key1, matches: matchList1, completer: completer1, ); - ImperativeRouteMatch match2 = ImperativeRouteMatch( + var match2 = ImperativeRouteMatch( pageKey: key1, matches: matchList1, completer: completer1, diff --git a/packages/go_router/test/matching_test.dart b/packages/go_router/test/matching_test.dart index e195d182d85..23d21793561 100644 --- a/packages/go_router/test/matching_test.dart +++ b/packages/go_router/test/matching_test.dart @@ -15,7 +15,7 @@ void main() { testWidgets('RouteMatchList toString prints the fullPath', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/page-0', builder: (BuildContext context, GoRouterState state) => @@ -34,12 +34,12 @@ void main() { }); test('RouteMatchList compares', () async { - final GoRoute route = GoRoute( + final route = GoRoute( path: '/page-0', builder: (BuildContext context, GoRouterState state) => const Placeholder(), ); - final Map params1 = {}; + final params1 = {}; final List match1 = RouteMatchBase.match( route: route, uri: Uri.parse('/page-0'), @@ -47,7 +47,7 @@ void main() { pathParameters: params1, ); - final Map params2 = {}; + final params2 = {}; final List match2 = RouteMatchBase.match( route: route, uri: Uri.parse('/page-0'), @@ -55,19 +55,19 @@ void main() { pathParameters: params2, ); - final RouteMatchList matches1 = RouteMatchList( + final matches1 = RouteMatchList( matches: match1, uri: Uri.parse(''), pathParameters: params1, ); - final RouteMatchList matches2 = RouteMatchList( + final matches2 = RouteMatchList( matches: match2, uri: Uri.parse(''), pathParameters: params2, ); - final RouteMatchList matches3 = RouteMatchList( + final matches3 = RouteMatchList( matches: match2, uri: Uri.parse('/page-0'), pathParameters: params2, @@ -95,7 +95,7 @@ void main() { navigatorKey: GlobalKey(), topRedirect: (_, __) => null, ); - final RouteMatchListCodec codec = RouteMatchListCodec(configuration); + final codec = RouteMatchListCodec(configuration); final RouteMatchList list1 = configuration.findMatch(Uri.parse('/a')); final RouteMatchList list2 = configuration.findMatch(Uri.parse('/b')); diff --git a/packages/go_router/test/material_test.dart b/packages/go_router/test/material_test.dart index 5c9b5737526..25c22e88355 100644 --- a/packages/go_router/test/material_test.dart +++ b/packages/go_router/test/material_test.dart @@ -14,7 +14,7 @@ void main() { testWidgets('returns [true] when MaterialApp is present', ( WidgetTester tester, ) async { - final GlobalKey<_DummyStatefulWidgetState> key = + final key = GlobalKey<_DummyStatefulWidgetState>(); await tester.pumpWidget(MaterialApp(home: DummyStatefulWidget(key: key))); final bool isMaterial = isMaterialApp(key.currentContext! as Element); @@ -24,7 +24,7 @@ void main() { testWidgets('returns [false] when CupertinoApp is present', ( WidgetTester tester, ) async { - final GlobalKey<_DummyStatefulWidgetState> key = + final key = GlobalKey<_DummyStatefulWidgetState>(); await tester.pumpWidget( CupertinoApp(home: DummyStatefulWidget(key: key)), @@ -35,11 +35,11 @@ void main() { }); test('pageBuilderForMaterialApp creates a [MaterialPage] accordingly', () { - final UniqueKey key = UniqueKey(); - const String name = 'name'; - const String arguments = 'arguments'; - const String restorationId = 'restorationId'; - const DummyStatefulWidget child = DummyStatefulWidget(); + final key = UniqueKey(); + const name = 'name'; + const arguments = 'arguments'; + const restorationId = 'restorationId'; + const child = DummyStatefulWidget(); final MaterialPage page = pageBuilderForMaterialApp( key: key, name: name, @@ -62,7 +62,7 @@ void main() { ), ); - final Exception exception = Exception('Something went wrong!'); + final exception = Exception('Something went wrong!'); testWidgets( 'shows the exception message when provided', testPageShowsExceptionMessage( diff --git a/packages/go_router/test/name_case_test.dart b/packages/go_router/test/name_case_test.dart index b70b0b0d928..672cdefdd2c 100644 --- a/packages/go_router/test/name_case_test.dart +++ b/packages/go_router/test/name_case_test.dart @@ -9,7 +9,7 @@ import 'package:go_router/go_router.dart'; void main() { testWidgets('Route names are case sensitive', (WidgetTester tester) async { // config router with 2 routes with the same name but different case (Name, name) - final GoRouter router = GoRouter( + final router = GoRouter( routes: [ GoRoute(path: '/', name: 'Name', builder: (_, __) => const ScreenA()), GoRoute( diff --git a/packages/go_router/test/on_enter_test.dart b/packages/go_router/test/on_enter_test.dart index 310780e9715..d063136de97 100644 --- a/packages/go_router/test/on_enter_test.dart +++ b/packages/go_router/test/on_enter_test.dart @@ -23,7 +23,7 @@ void main() { ) async { GoRouterState? capturedCurrentState; GoRouterState? capturedNextState; - int onEnterCallCount = 0; + var onEnterCallCount = 0; router = GoRouter( initialLocation: '/', @@ -61,8 +61,8 @@ void main() { testWidgets('Should block navigation when onEnter returns false', ( WidgetTester tester, ) async { - final List navigationAttempts = []; - String currentPath = '/'; + final navigationAttempts = []; + var currentPath = '/'; router = GoRouter( initialLocation: '/', @@ -134,7 +134,7 @@ void main() { testWidgets('Should allow navigation when onEnter returns true', ( WidgetTester tester, ) async { - int onEnterCallCount = 0; + var onEnterCallCount = 0; router = GoRouter( initialLocation: '/home', @@ -192,7 +192,7 @@ void main() { testWidgets( 'Should trigger onException when the redirection limit is exceeded', (WidgetTester tester) async { - final Completer completer = Completer(); + final completer = Completer(); Object? capturedError; router = GoRouter( @@ -254,12 +254,12 @@ void main() { testWidgets('Should handle `go` usage in onEnter', ( WidgetTester tester, ) async { - bool isAuthenticatedResult = false; + var isAuthenticatedResult = false; Future isAuthenticated() => Future.value(isAuthenticatedResult); - final StreamController<({String current, String next})> paramsSink = + final paramsSink = StreamController<({String current, String next})>(); final Stream<({String current, String next})> paramsStream = paramsSink .stream @@ -337,7 +337,7 @@ void main() { testWidgets('Should handle `goNamed` usage in onEnter', ( WidgetTester tester, ) async { - final List navigationAttempts = []; + final navigationAttempts = []; router = GoRouter( initialLocation: '/home', @@ -411,12 +411,12 @@ void main() { testWidgets('Should handle `push` usage in onEnter', ( WidgetTester tester, ) async { - const bool isAuthenticatedResult = false; + const isAuthenticatedResult = false; Future isAuthenticated() => Future.value(isAuthenticatedResult); - final StreamController<({String current, String next})> paramsSink = + final paramsSink = StreamController<({String current, String next})>(); final Stream<({String current, String next})> paramsStream = paramsSink .stream @@ -500,7 +500,7 @@ void main() { testWidgets('Should handle `replace` usage in onEnter', ( WidgetTester tester, ) async { - final List navigationHistory = []; + final navigationHistory = []; router = GoRouter( initialLocation: '/home', @@ -560,7 +560,7 @@ void main() { testWidgets('Should handle `pushReplacement` usage in onEnter', ( WidgetTester tester, ) async { - final List navigationLog = []; + final navigationLog = []; router = GoRouter( initialLocation: '/home', @@ -636,12 +636,12 @@ void main() { 'onEnter should handle protected route redirection with query parameters', (WidgetTester tester) async { // Test setup - bool isAuthenticatedResult = false; + var isAuthenticatedResult = false; Future isAuthenticated() => Future.value(isAuthenticatedResult); // Stream to capture onEnter calls - final StreamController<({String current, String next})> paramsSink = + final paramsSink = StreamController<({String current, String next})>(); // Use broadcast stream for potentially multiple listeners/expects if needed, // although expectLater handles one listener well. @@ -678,7 +678,7 @@ void main() { next: next.uri.toString(), )); - final bool isNavigatingToProtected = + final isNavigatingToProtected = next.uri.path == '/protected'; // Allow navigation if not going to the protected route @@ -814,8 +814,8 @@ void main() { testWidgets('Should handle sequential navigation steps in onEnter', ( WidgetTester tester, ) async { - final List navigationChain = []; - final Completer navigationComplete = Completer(); + final navigationChain = []; + final navigationComplete = Completer(); router = GoRouter( initialLocation: '/start', @@ -905,7 +905,7 @@ void main() { testWidgets('Should call onException when exceptions thrown in onEnter callback', ( WidgetTester tester, ) async { - final Completer completer = Completer(); + final completer = Completer(); Object? capturedError; // Set up the router. Note that we short-circuit onEnter for '/fallback' @@ -966,9 +966,9 @@ void main() { testWidgets('onEnter has priority over deprecated redirect', ( WidgetTester tester, ) async { - int redirectCallCount = 0; - int onEnterCallCount = 0; - bool lastOnEnterBlocked = false; + var redirectCallCount = 0; + var onEnterCallCount = 0; + var lastOnEnterBlocked = false; router = GoRouter( initialLocation: '/start', @@ -997,8 +997,8 @@ void main() { await tester.pumpAndSettle(); // Record initial counts - final int initialRedirectCount = redirectCallCount; - final int initialOnEnterCount = onEnterCallCount; + final initialRedirectCount = redirectCallCount; + final initialOnEnterCount = onEnterCallCount; // Test blocked route router.go('/blocked'); @@ -1013,7 +1013,7 @@ void main() { expect(lastOnEnterBlocked, isTrue); // Test allowed route - final int beforeAllowedRedirectCount = redirectCallCount; + final beforeAllowedRedirectCount = redirectCallCount; router.go('/allowed'); await tester.pumpAndSettle(); @@ -1077,7 +1077,7 @@ void main() { testWidgets('pop does not call onEnter but restore does', ( WidgetTester tester, ) async { - int onEnterCount = 0; + var onEnterCount = 0; router = GoRouter( initialLocation: '/a', @@ -1121,8 +1121,8 @@ void main() { testWidgets('restore navigation calls onEnter for re-validation', ( WidgetTester tester, ) async { - int onEnterCount = 0; - bool allowNavigation = true; + var onEnterCount = 0; + var allowNavigation = true; router = GoRouter( initialLocation: '/home', @@ -1278,7 +1278,7 @@ void main() { testWidgets('route-level redirect still runs after onEnter allows', ( WidgetTester tester, ) async { - final List seenNextPaths = []; + final seenNextPaths = []; router = GoRouter( initialLocation: '/', @@ -1385,8 +1385,8 @@ void main() { // With redirectLimit=1: // - Block.stop() resets history so repeated attempts don't hit the limit. // - Block.then(() => go(...)) keeps history and will exceed the limit. - int onExceptionCalls = 0; - final Completer exceededCompleter = Completer(); + var onExceptionCalls = 0; + final exceededCompleter = Completer(); router = GoRouter( initialLocation: '/start', @@ -1455,7 +1455,7 @@ void main() { testWidgets('restore runs onEnter -> legacy -> route-level redirect', ( WidgetTester tester, ) async { - final List calls = []; + final calls = []; router = GoRouter( initialLocation: '/home', diff --git a/packages/go_router/test/on_exit_test.dart b/packages/go_router/test/on_exit_test.dart index 07f5be7e4bf..2b1d0873cb9 100644 --- a/packages/go_router/test/on_exit_test.dart +++ b/packages/go_router/test/on_exit_test.dart @@ -12,10 +12,10 @@ import 'test_helpers.dart'; void main() { testWidgets('back button works synchronously', (WidgetTester tester) async { - bool allow = false; - final UniqueKey home = UniqueKey(); - final UniqueKey page1 = UniqueKey(); - final List routes = [ + var allow = false; + final home = UniqueKey(); + final page1 = UniqueKey(); + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -51,10 +51,10 @@ void main() { }); testWidgets('context.go works synchronously', (WidgetTester tester) async { - bool allow = false; - final UniqueKey home = UniqueKey(); - final UniqueKey page1 = UniqueKey(); - final List routes = [ + var allow = false; + final home = UniqueKey(); + final page1 = UniqueKey(); + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -88,10 +88,10 @@ void main() { }); testWidgets('back button works asynchronously', (WidgetTester tester) async { - Completer allow = Completer(); - final UniqueKey home = UniqueKey(); - final UniqueKey page1 = UniqueKey(); - final List routes = [ + var allow = Completer(); + final home = UniqueKey(); + final page1 = UniqueKey(); + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -135,10 +135,10 @@ void main() { }); testWidgets('context.go works asynchronously', (WidgetTester tester) async { - Completer allow = Completer(); - final UniqueKey home = UniqueKey(); - final UniqueKey page1 = UniqueKey(); - final List routes = [ + var allow = Completer(); + final home = UniqueKey(); + final page1 = UniqueKey(); + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -182,9 +182,9 @@ void main() { testWidgets('android back button respects the last route.', ( WidgetTester tester, ) async { - bool allow = false; - final UniqueKey home = UniqueKey(); - final List routes = [ + var allow = false; + final home = UniqueKey(); + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -208,9 +208,9 @@ void main() { testWidgets('android back button respects the last route. async', ( WidgetTester tester, ) async { - bool allow = false; - final UniqueKey home = UniqueKey(); - final List routes = [ + var allow = false; + final home = UniqueKey(); + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -234,9 +234,9 @@ void main() { testWidgets('android back button respects the last route with shell route.', ( WidgetTester tester, ) async { - bool allow = false; - final UniqueKey home = UniqueKey(); - final List routes = [ + var allow = false; + final home = UniqueKey(); + final routes = [ ShellRoute( builder: (_, __, Widget child) => child, routes: [ @@ -265,14 +265,14 @@ void main() { testWidgets('It should provide the correct uri to the onExit callback', ( WidgetTester tester, ) async { - final UniqueKey home = UniqueKey(); - final UniqueKey page1 = UniqueKey(); - final UniqueKey page2 = UniqueKey(); - final UniqueKey page3 = UniqueKey(); + final home = UniqueKey(); + final page1 = UniqueKey(); + final page2 = UniqueKey(); + final page3 = UniqueKey(); late final GoRouterState onExitState1; late final GoRouterState onExitState2; late final GoRouterState onExitState3; - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => @@ -340,14 +340,14 @@ void main() { testWidgets( 'It should provide the correct path parameters to the onExit callback', (WidgetTester tester) async { - final UniqueKey page0 = UniqueKey(); - final UniqueKey page1 = UniqueKey(); - final UniqueKey page2 = UniqueKey(); - final UniqueKey page3 = UniqueKey(); + final page0 = UniqueKey(); + final page1 = UniqueKey(); + final page2 = UniqueKey(); + final page3 = UniqueKey(); late final GoRouterState onExitState1; late final GoRouterState onExitState2; late final GoRouterState onExitState3; - final List routes = [ + final routes = [ GoRoute( path: '/route-0/:id0', builder: (BuildContext context, GoRouterState state) => @@ -421,14 +421,14 @@ void main() { testWidgets( 'It should provide the correct path parameters to the onExit callback during a go', (WidgetTester tester) async { - final UniqueKey page0 = UniqueKey(); - final UniqueKey page1 = UniqueKey(); - final UniqueKey page2 = UniqueKey(); - final UniqueKey page3 = UniqueKey(); + final page0 = UniqueKey(); + final page1 = UniqueKey(); + final page2 = UniqueKey(); + final page3 = UniqueKey(); late final GoRouterState onExitState0; late final GoRouterState onExitState1; late final GoRouterState onExitState2; - final List routes = [ + final routes = [ GoRoute( path: '/route-0/:id0', builder: (BuildContext context, GoRouterState state) => diff --git a/packages/go_router/test/parser_test.dart b/packages/go_router/test/parser_test.dart index 9520336768d..3859f272f8f 100644 --- a/packages/go_router/test/parser_test.dart +++ b/packages/go_router/test/parser_test.dart @@ -22,7 +22,7 @@ void main() { int redirectLimit = 5, GoRouterRedirect? redirect, }) async { - final GoRouter router = GoRouter( + final router = GoRouter( routes: routes, redirectLimit: redirectLimit, redirect: redirect, @@ -35,7 +35,7 @@ void main() { testWidgets('GoRouteInformationParser can parse route', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -65,7 +65,7 @@ void main() { expect(matches[0].matchedLocation, '/'); expect(matches[0].route, routes[0]); - final Object extra = Object(); + final extra = Object(); matchesObj = await parser.parseRouteInformationWithDependencies( createRouteInformation('/abc?def=ghi', extra), context, @@ -84,7 +84,7 @@ void main() { testWidgets( 'GoRouteInformationParser can handle empty path for non http uri', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -116,7 +116,7 @@ void main() { testWidgets('GoRouteInformationParser cleans up uri', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -147,13 +147,13 @@ void main() { testWidgets( "GoRouteInformationParser can parse deeplink root route and maintain uri's scheme, host, query and fragment", (WidgetTester tester) async { - const String expectedScheme = 'https'; - const String expectedHost = 'www.example.com'; - const String expectedQuery = 'abc=def'; - const String expectedFragment = 'abc'; - const String expectedUriString = + const expectedScheme = 'https'; + const expectedHost = 'www.example.com'; + const expectedQuery = 'abc=def'; + const expectedFragment = 'abc'; + const expectedUriString = '$expectedScheme://$expectedHost/?$expectedQuery#$expectedFragment'; - final List routes = [ + final routes = [ GoRoute(path: '/', builder: (_, __) => const Placeholder()), ]; final GoRouteInformationParser parser = await createParser( @@ -186,14 +186,14 @@ void main() { testWidgets( "GoRouteInformationParser can parse deeplink route with a path and maintain uri's scheme, host, query and fragment", (WidgetTester tester) async { - const String expectedScheme = 'https'; - const String expectedHost = 'www.example.com'; - const String expectedPath = '/abc'; - const String expectedQuery = 'abc=def'; - const String expectedFragment = 'abc'; - const String expectedUriString = + const expectedScheme = 'https'; + const expectedHost = 'www.example.com'; + const expectedPath = '/abc'; + const expectedQuery = 'abc=def'; + const expectedFragment = 'abc'; + const expectedUriString = '$expectedScheme://$expectedHost$expectedPath?$expectedQuery#$expectedFragment'; - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -236,8 +236,8 @@ void main() { testWidgets( 'GoRouteInformationParser can restore full route matches if optionURLReflectsImperativeAPIs is true', (WidgetTester tester) async { - final GlobalKey navKey = GlobalKey(); - final List routes = [ + final navKey = GlobalKey(); + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -283,7 +283,7 @@ void main() { ); test('GoRouteInformationParser can retrieve route by name', () async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -339,7 +339,7 @@ void main() { test( 'GoRouteInformationParser can retrieve route by name with query parameters', () async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -376,7 +376,7 @@ void main() { testWidgets('GoRouteInformationParser returns error when unknown route', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -413,7 +413,7 @@ void main() { 'GoRouteInformationParser calls redirector with correct uri when unknown route', (WidgetTester tester) async { String? lastRedirectLocation; - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -444,7 +444,7 @@ void main() { testWidgets('GoRouteInformationParser can work with route parameters', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -485,7 +485,7 @@ void main() { testWidgets( 'GoRouteInformationParser processes top level redirect when there is no match', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -528,7 +528,7 @@ void main() { testWidgets( 'GoRouteInformationParser can do route level redirect when there is a match', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (_, __) => const Placeholder(), @@ -571,7 +571,7 @@ void main() { testWidgets( 'GoRouteInformationParser throws an exception when route is malformed', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute(path: '/abc', builder: (_, __) => const Placeholder()), ]; final GoRouteInformationParser parser = await createParser( @@ -594,7 +594,7 @@ void main() { testWidgets( 'GoRouteInformationParser returns an error if a redirect is detected.', (WidgetTester tester) async { - final List routes = [ + final routes = [ GoRoute( path: '/abc', builder: (_, __) => const Placeholder(), @@ -622,7 +622,7 @@ void main() { ); testWidgets('Creates a match for ShellRoute', (WidgetTester tester) async { - final List routes = [ + final routes = [ ShellRoute( builder: (BuildContext context, GoRouterState state, Widget child) { return Scaffold(body: child); @@ -658,7 +658,7 @@ void main() { final List matches = matchesObj.matches; expect(matches, hasLength(1)); - final ShellRouteMatch match = matches.first as ShellRouteMatch; + final match = matches.first as ShellRouteMatch; expect(match.matches, hasLength(1)); expect(matchesObj.error, isNull); }); diff --git a/packages/go_router/test/path_utils_test.dart b/packages/go_router/test/path_utils_test.dart index 32218ffcd47..6dbf9110267 100644 --- a/packages/go_router/test/path_utils_test.dart +++ b/packages/go_router/test/path_utils_test.dart @@ -7,8 +7,8 @@ import 'package:go_router/src/path_utils.dart'; void main() { test('patternToRegExp without path parameter', () async { - const String pattern = '/settings/detail'; - final List pathParameter = []; + const pattern = '/settings/detail'; + final pathParameter = []; final RegExp regex = patternToRegExp( pattern, pathParameter, @@ -24,8 +24,8 @@ void main() { }); test('patternToRegExp with path parameter', () async { - const String pattern = '/user/:id/book/:bookId'; - final List pathParameter = []; + const pattern = '/user/:id/book/:bookId'; + final pathParameter = []; final RegExp regex = patternToRegExp( pattern, pathParameter, @@ -52,15 +52,15 @@ void main() { }); test('patternToPath without path parameter', () async { - const String pattern = '/settings/detail'; - final List pathParameter = []; + const pattern = '/settings/detail'; + final pathParameter = []; final RegExp regex = patternToRegExp( pattern, pathParameter, caseSensitive: true, ); - const String url = '/settings/detail'; + const url = '/settings/detail'; final RegExpMatch? match = regex.firstMatch(url); expect(match, isNotNull); @@ -74,15 +74,15 @@ void main() { }); test('patternToPath with path parameter', () async { - const String pattern = '/user/:id/book/:bookId'; - final List pathParameter = []; + const pattern = '/user/:id/book/:bookId'; + final pathParameter = []; final RegExp regex = patternToRegExp( pattern, pathParameter, caseSensitive: true, ); - const String url = '/user/123/book/456'; + const url = '/user/123/book/456'; final RegExpMatch? match = regex.firstMatch(url); expect(match, isNotNull); @@ -111,7 +111,7 @@ void main() { test('concatenateUris', () { void verify(String pathA, String pathB, String expected) { - final String result = concatenateUris( + final result = concatenateUris( Uri.parse(pathA), Uri.parse(pathB), ).toString(); diff --git a/packages/go_router/test/rebuild_test.dart b/packages/go_router/test/rebuild_test.dart index 5f0141fb9c7..b0379459c8d 100644 --- a/packages/go_router/test/rebuild_test.dart +++ b/packages/go_router/test/rebuild_test.dart @@ -12,7 +12,7 @@ void main() { testWidgets('GoRouter.push does not trigger unnecessary rebuilds', ( WidgetTester tester, ) async { - final List routes = [ + final routes = [ GoRoute( path: '/', builder: (BuildContext context, __) => const HomePage(), diff --git a/packages/go_router/test/request_focus.dart b/packages/go_router/test/request_focus.dart index 1385349b5c3..f17cd2d25ce 100644 --- a/packages/go_router/test/request_focus.dart +++ b/packages/go_router/test/request_focus.dart @@ -11,8 +11,8 @@ void main() { WidgetTester tester, ) async { final GlobalKey innerKey = GlobalKey(); - final FocusScopeNode focusNode = FocusScopeNode(); - final GoRouter router = GoRouter( + final focusNode = FocusScopeNode(); + final router = GoRouter( initialLocation: '/', routes: [ GoRoute(path: '/', name: 'home', builder: (_, __) => const Text('A')), diff --git a/packages/go_router/test/route_data_test.dart b/packages/go_router/test/route_data_test.dart index 61726de2649..a9075e338f4 100644 --- a/packages/go_router/test/route_data_test.dart +++ b/packages/go_router/test/route_data_test.dart @@ -264,7 +264,7 @@ void main() { testWidgets('It should build the page from the overridden build method', ( WidgetTester tester, ) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/build', routes: _routes, ); @@ -277,7 +277,7 @@ void main() { testWidgets( 'It should build the page from the overridden buildPage method', (WidgetTester tester) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/build-page', routes: _routes, ); @@ -316,12 +316,12 @@ void main() { testWidgets('It should throw because there is no code generated', ( WidgetTester tester, ) async { - final List errors = []; + final errors = []; FlutterError.onError = (FlutterErrorDetails details) => errors.add(details); - const String errorText = 'Should be generated'; + const errorText = 'Should be generated'; Future expectUnimplementedError( void Function(BuildContext) onTap, @@ -372,7 +372,7 @@ void main() { testWidgets('It should build the page from the overridden build method', ( WidgetTester tester, ) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/build', routes: _relativeRoutes, ); @@ -385,7 +385,7 @@ void main() { testWidgets( 'It should build the page from the overridden buildPage method', (WidgetTester tester) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/build-page', routes: _relativeRoutes, ); @@ -428,12 +428,12 @@ void main() { testWidgets('It should throw because there is no code generated', ( WidgetTester tester, ) async { - final List errors = []; + final errors = []; FlutterError.onError = (FlutterErrorDetails details) => errors.add(details); - const String errorText = 'Should be generated'; + const errorText = 'Should be generated'; Future expectUnimplementedError( void Function(BuildContext) onTap, @@ -488,7 +488,7 @@ void main() { testWidgets('It should build the page from the overridden build method', ( WidgetTester tester, ) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/child', routes: [_shellRouteDataBuilder], ); @@ -501,9 +501,9 @@ void main() { testWidgets('It should build the page from the overridden build method', ( WidgetTester tester, ) async { - final GlobalKey root = GlobalKey(); - final GlobalKey inner = GlobalKey(); - final GoRouter goRouter = GoRouter( + final root = GlobalKey(); + final inner = GlobalKey(); + final goRouter = GoRouter( navigatorKey: root, initialLocation: '/child/test', routes: [ @@ -557,7 +557,7 @@ void main() { testWidgets( 'It should build the page from the overridden buildPage method', (WidgetTester tester) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/child', routes: [_shellRouteDataPageBuilder], ); @@ -571,7 +571,7 @@ void main() { testWidgets('It should redirect using the overridden redirect method', ( WidgetTester tester, ) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/child', routes: [_goRouteDataBuildPage, _shellRouteDataRedirect], ); @@ -586,7 +586,7 @@ void main() { testWidgets('It should build the page from the overridden build method', ( WidgetTester tester, ) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/child', routes: [_statefulShellRouteDataBuilder], ); @@ -599,7 +599,7 @@ void main() { testWidgets( 'It should build the page from the overridden buildPage method', (WidgetTester tester) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/child', routes: [_statefulShellRouteDataPageBuilder], ); @@ -611,7 +611,7 @@ void main() { ); test('Can assign parent navigator key', () { - final GlobalKey key = GlobalKey(); + final key = GlobalKey(); final StatefulShellRoute route = StatefulShellRouteData.$route( parentNavigatorKey: key, factory: (GoRouterState state) => @@ -649,7 +649,7 @@ void main() { testWidgets('It should redirect using the overridden redirect method', ( WidgetTester tester, ) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/redirect', routes: _routes, ); @@ -662,7 +662,7 @@ void main() { testWidgets( 'It should redirect using the overridden StatefulShellRoute redirect method', (WidgetTester tester) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/child', routes: [ _goRouteDataBuildPage, @@ -692,7 +692,7 @@ void main() { testWidgets('It should redirect using the overridden redirect method', ( WidgetTester tester, ) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/redirect-with-state', routes: _routes, ); @@ -702,7 +702,7 @@ void main() { expect(find.byKey(const Key('buildPage')), findsNothing); }); test('TypedGoRoute with default parameters', () { - const TypedGoRoute typedGoRoute = TypedGoRoute( + const typedGoRoute = TypedGoRoute( path: '/path', ); @@ -713,7 +713,7 @@ void main() { }); test('TypedGoRoute with provided parameters', () { - const TypedGoRoute typedGoRoute = TypedGoRoute( + const typedGoRoute = TypedGoRoute( path: '/path', name: 'name', caseSensitive: false, @@ -752,7 +752,7 @@ void main() { }); test('CustomParameterCodec with required parameters', () { - const CustomParameterCodec customParameterCodec = CustomParameterCodec( + const customParameterCodec = CustomParameterCodec( encode: toBase64, decode: fromBase64, ); @@ -762,7 +762,7 @@ void main() { }); test('TypedRelativeGoRoute with default parameters', () { - const TypedRelativeGoRoute typedGoRoute = + const typedGoRoute = TypedRelativeGoRoute(path: 'path'); expect(typedGoRoute.path, 'path'); @@ -771,7 +771,7 @@ void main() { }); test('TypedRelativeGoRoute with provided parameters', () { - const TypedRelativeGoRoute typedGoRoute = + const typedGoRoute = TypedRelativeGoRoute( path: 'path', caseSensitive: false, diff --git a/packages/go_router/test/routing_config_test.dart b/packages/go_router/test/routing_config_test.dart index 01eb5330c7d..d29ee09e918 100644 --- a/packages/go_router/test/routing_config_test.dart +++ b/packages/go_router/test/routing_config_test.dart @@ -11,7 +11,7 @@ import 'test_helpers.dart'; void main() { testWidgets('routing config works', (WidgetTester tester) async { - final ValueNotifier config = ValueNotifier( + final config = ValueNotifier( RoutingConfig( routes: [ GoRoute(path: '/', builder: (_, __) => const Text('home')), @@ -31,7 +31,7 @@ void main() { testWidgets('routing config works after builder changes', ( WidgetTester tester, ) async { - final ValueNotifier config = ValueNotifier( + final config = ValueNotifier( RoutingConfig( routes: [ GoRoute(path: '/', builder: (_, __) => const Text('home')), @@ -54,7 +54,7 @@ void main() { testWidgets('routing config works after routing changes', ( WidgetTester tester, ) async { - final ValueNotifier config = ValueNotifier( + final config = ValueNotifier( RoutingConfig( routes: [ GoRoute(path: '/', builder: (_, __) => const Text('home')), @@ -86,7 +86,7 @@ void main() { testWidgets('routing config works after routing changes case 2', ( WidgetTester tester, ) async { - final ValueNotifier config = ValueNotifier( + final config = ValueNotifier( RoutingConfig( routes: [ GoRoute(path: '/', builder: (_, __) => const Text('home')), @@ -118,13 +118,13 @@ void main() { testWidgets('routing config works after routing changes case 3', ( WidgetTester tester, ) async { - final GlobalKey<_StatefulTestState> key = GlobalKey<_StatefulTestState>( + final key = GlobalKey<_StatefulTestState>( debugLabel: 'testState', ); - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(debugLabel: 'root'); - final ValueNotifier config = ValueNotifier( + final config = ValueNotifier( RoutingConfig( routes: [ GoRoute( @@ -163,15 +163,15 @@ void main() { // TODO(tolo): Temporarily skipped due to a bug that causes test to faiL skip: true, (WidgetTester tester) async { - final GlobalKey<_StatefulTestState> key = GlobalKey<_StatefulTestState>( + final key = GlobalKey<_StatefulTestState>( debugLabel: 'testState', ); - final GlobalKey rootNavigatorKey = + final rootNavigatorKey = GlobalKey(debugLabel: 'root'); - final GlobalKey shellNavigatorKey = + final shellNavigatorKey = GlobalKey(debugLabel: 'shell'); - final ValueNotifier config = ValueNotifier( + final config = ValueNotifier( RoutingConfig( routes: [ ShellRoute( @@ -217,7 +217,7 @@ void main() { testWidgets('routing config works with named route', ( WidgetTester tester, ) async { - final ValueNotifier config = ValueNotifier( + final config = ValueNotifier( RoutingConfig( routes: [ GoRoute(path: '/', builder: (_, __) => const Text('home')), diff --git a/packages/go_router/test/shell_route_observers_test.dart b/packages/go_router/test/shell_route_observers_test.dart index 8f803602670..c6b4f87d322 100644 --- a/packages/go_router/test/shell_route_observers_test.dart +++ b/packages/go_router/test/shell_route_observers_test.dart @@ -10,7 +10,7 @@ import 'test_helpers.dart'; void main() { test('ShellRoute observers test', () { - final ShellRoute shell = ShellRoute( + final shell = ShellRoute( observers: [HeroController()], builder: (BuildContext context, GoRouterState state, Widget child) { return SafeArea(child: child); @@ -31,9 +31,9 @@ void main() { testWidgets( 'GoRouter observers should be notified when navigating within ShellRoute', (WidgetTester tester) async { - final MockObserver observer = MockObserver(); + final observer = MockObserver(); - final GlobalKey root = GlobalKey( + final root = GlobalKey( debugLabel: 'root', ); await createRouter( diff --git a/packages/go_router/test/test_helpers.dart b/packages/go_router/test/test_helpers.dart index 4f30e8e107c..6a0b8496015 100644 --- a/packages/go_router/test/test_helpers.dart +++ b/packages/go_router/test/test_helpers.dart @@ -13,7 +13,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:go_router/go_router.dart'; Future createGoRouter(WidgetTester tester) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( initialLocation: '/', routes: [ GoRoute(path: '/', builder: (_, __) => const DummyStatefulWidget()), @@ -178,7 +178,7 @@ Future createRouter( bool overridePlatformDefaultLocation = false, List? observers, }) async { - final GoRouter goRouter = GoRouter( + final goRouter = GoRouter( routes: routes, redirect: redirect, extraCodec: extraCodec, @@ -217,7 +217,7 @@ Future createRouterWithRoutingConfig( bool requestFocus = true, bool overridePlatformDefaultLocation = false, }) async { - final GoRouter goRouter = GoRouter.routingConfig( + final goRouter = GoRouter.routingConfig( routingConfig: config, initialLocation: initialLocation, onException: onException, diff --git a/packages/go_router/tool/run_tests.dart b/packages/go_router/tool/run_tests.dart index 6fa363072dd..bb4ae2c88fd 100644 --- a/packages/go_router/tool/run_tests.dart +++ b/packages/go_router/tool/run_tests.dart @@ -63,7 +63,7 @@ Future _prepareTemplate({ required Directory testTempDir, }) async { // The src test_fixes directory. - final Directory testFixesSrcDir = Directory( + final testFixesSrcDir = Directory( p.join(packageRoot.path, 'test_fixes'), ); @@ -71,9 +71,9 @@ Future _prepareTemplate({ await io.copyPath(testFixesSrcDir.path, testTempDir.path); // The pubspec.yaml file to create. - final File targetPubspecFile = File(p.join(testTempDir.path, 'pubspec.yaml')); + final targetPubspecFile = File(p.join(testTempDir.path, 'pubspec.yaml')); - final String targetYaml = + final targetYaml = ''' name: test_fixes publish_to: "none" diff --git a/packages/go_router_builder/example/lib/main.dart b/packages/go_router_builder/example/lib/main.dart index a4ce0d9cca2..ca39237097d 100644 --- a/packages/go_router_builder/example/lib/main.dart +++ b/packages/go_router_builder/example/lib/main.dart @@ -42,7 +42,7 @@ class App extends StatelessWidget { // check just the matchedLocation in case there are query parameters final String loginLoc = const LoginRoute().location; - final bool goingToLogin = state.matchedLocation == loginLoc; + final goingToLogin = state.matchedLocation == loginLoc; // the user is not logged in and not headed to /login, they need to login if (!loggedIn && !goingToLogin) { diff --git a/packages/go_router_builder/example/lib/readme_excerpts.dart b/packages/go_router_builder/example/lib/readme_excerpts.dart index bbb1d5b5525..97c74ed3f50 100644 --- a/packages/go_router_builder/example/lib/readme_excerpts.dart +++ b/packages/go_router_builder/example/lib/readme_excerpts.dart @@ -30,11 +30,11 @@ void otherDoc(BuildContext context) { // #enddocregion GoWrong // #docregion GoRouter - final GoRouter router = GoRouter(routes: $appRoutes); + final router = GoRouter(routes: $appRoutes); // #enddocregion GoRouter // #docregion routerWithErrorBuilder - final GoRouter routerWithErrorBuilder = GoRouter( + final routerWithErrorBuilder = GoRouter( routes: $appRoutes, errorBuilder: (BuildContext context, GoRouterState state) { return ErrorRoute(error: state.error!).build(context, state); @@ -61,14 +61,14 @@ void otherDoc(BuildContext context) { void onTapRelative() => const DetailsRoute().goRelative(context); // #enddocregion goRelative - final LoginInfo loginInfo = LoginInfo(); + final loginInfo = LoginInfo(); - final GoRouter routerWithRedirect = GoRouter( + final routerWithRedirect = GoRouter( routes: $appRoutes, // #docregion redirect redirect: (BuildContext context, GoRouterState state) { final bool loggedIn = loginInfo.loggedIn; - final bool loggingIn = state.matchedLocation == LoginRoute().location; + final loggingIn = state.matchedLocation == LoginRoute().location; if (!loggedIn && !loggingIn) { return LoginRoute(from: state.matchedLocation).location; } diff --git a/packages/go_router_builder/example/test/all_types_test.dart b/packages/go_router_builder/example/test/all_types_test.dart index e99f014cf2c..31da7b49504 100644 --- a/packages/go_router_builder/example/test/all_types_test.dart +++ b/packages/go_router_builder/example/test/all_types_test.dart @@ -35,8 +35,8 @@ void main() { expect(find.text('Query param: true'), findsOneWidget); expect(find.text('Query param with default value: true'), findsOneWidget); - final DateTime param = DateTime.now(); - final DateTime query = DateTime(2017, 9, 7, 17, 30); + final param = DateTime.now(); + final query = DateTime(2017, 9, 7, 17, 30); DateTimeRoute( requiredDateTimeField: param, dateTimeField: query, diff --git a/packages/go_router_builder/example/test/location_test.dart b/packages/go_router_builder/example/test/location_test.dart index a83f93413eb..29a691cfb5c 100644 --- a/packages/go_router_builder/example/test/location_test.dart +++ b/packages/go_router_builder/example/test/location_test.dart @@ -14,7 +14,7 @@ void main() { // Needs to not be a const to test // https://github.com/flutter/flutter/issues/127825. - final Set doubleSetField = {}; + final doubleSetField = {}; expect( IterableRouteWithDefaultValues(doubleSetField: doubleSetField).location, '/iterable-route-with-default-values', @@ -29,7 +29,7 @@ void main() { // Needs to not be a const to test // https://github.com/flutter/flutter/issues/127825. - final Set intSetField = {0, 1}; + final intSetField = {0, 1}; expect( IterableRouteWithDefaultValues(intSetField: intSetField).location, '/iterable-route-with-default-values', diff --git a/packages/go_router_builder/lib/src/go_router_generator.dart b/packages/go_router_builder/lib/src/go_router_generator.dart index 0ca99e60025..fcbd5a81a94 100644 --- a/packages/go_router_builder/lib/src/go_router_generator.dart +++ b/packages/go_router_builder/lib/src/go_router_generator.dart @@ -35,8 +35,8 @@ class GoRouterGenerator extends Generator { @override FutureOr generate(LibraryReader library, BuildStep buildStep) async { - final Set values = {}; - final Set getters = {}; + final values = {}; + final getters = {}; generateForAnnotation(library, values, getters); @@ -94,7 +94,7 @@ ${getters.map((String e) => "$e,").join('\n')} ); } - final TypeChecker dataChecker = TypeChecker.fromUrl( + final dataChecker = TypeChecker.fromUrl( '$_routeDataUrl#$routeData', ); if (!element.allSupertypes.any( diff --git a/packages/go_router_builder/lib/src/path_utils.dart b/packages/go_router_builder/lib/src/path_utils.dart index 8133f5df4b3..607f9faf2a2 100644 --- a/packages/go_router_builder/lib/src/path_utils.dart +++ b/packages/go_router_builder/lib/src/path_utils.dart @@ -28,8 +28,8 @@ Set pathParametersFromPattern(String pattern) => { /// final path = patternToPath(pattern, {'id': 'family-id'}); // '/family/family-id' /// ``` String patternToPath(String pattern, Map pathParameters) { - final StringBuffer buffer = StringBuffer(); - int start = 0; + final buffer = StringBuffer(); + var start = 0; for (final RegExpMatch match in _parameterRegExp.allMatches(pattern)) { if (match.start > start) { buffer.write(pattern.substring(start, match.start)); diff --git a/packages/go_router_builder/lib/src/route_config.dart b/packages/go_router_builder/lib/src/route_config.dart index 5dae9473a2d..b4289ec71e9 100644 --- a/packages/go_router_builder/lib/src/route_config.dart +++ b/packages/go_router_builder/lib/src/route_config.dart @@ -197,13 +197,13 @@ mixin _GoRouteMixin on RouteBaseConfig { // construct path bits using parent bits // if there are any queryParam objects, add in the `queryParam` bits String get _locationArgs { - final Map pathParameters = Map.fromEntries( + final pathParameters = Map.fromEntries( _pathParams.map((String pathParameter) { // Enum types are encoded using a map, so we need a nullability check // here to ensure it matches Uri.encodeComponent nullability final DartType? type = _field(pathParameter)?.returnType; - final StringBuffer valueBuffer = StringBuffer(); + final valueBuffer = StringBuffer(); valueBuffer.write(r'${Uri.encodeComponent('); valueBuffer.write(_encodeFor(pathParameter)); @@ -232,7 +232,7 @@ mixin _GoRouteMixin on RouteBaseConfig { ); String get _fromStateConstructor { - final StringBuffer buffer = StringBuffer('=>'); + final buffer = StringBuffer('=>'); if (_ctor.isConst && _ctorParams.isEmpty && _ctorQueryParams.isEmpty && @@ -241,7 +241,7 @@ mixin _GoRouteMixin on RouteBaseConfig { } buffer.writeln('$_className('); - for (final FormalParameterElement param in [ + for (final param in [ ..._ctorParams, ..._ctorQueryParams, if (_extraParam != null) _extraParam!, @@ -314,12 +314,12 @@ mixin _GoRouteMixin on RouteBaseConfig { return ''; } - final StringBuffer buffer = StringBuffer('queryParams: {\n'); + final buffer = StringBuffer('queryParams: {\n'); for (final FormalParameterElement param in _ctorQueryParams) { final String parameterName = param.displayName; - final List conditions = []; + final conditions = []; if (param.hasDefaultValue) { if (param.type.isNullableType) { throw NullableDefaultValueError(param); @@ -330,7 +330,7 @@ mixin _GoRouteMixin on RouteBaseConfig { } else if (param.type.isNullableType) { conditions.add('$selfFieldName.$parameterName != null'); } - String line = ''; + var line = ''; if (conditions.isNotEmpty) { line = 'if (${conditions.join(' && ')}) '; } @@ -384,9 +384,9 @@ mixin _GoRouteMixin on RouteBaseConfig { /// Returns code representing the constant maps that contain the `enum` to /// [String] mapping for each referenced enum. Iterable _enumDeclarations() { - final Set enumParamTypes = {}; + final enumParamTypes = {}; - for (final FormalParameterElement ctorParam in [ + for (final ctorParam in [ ..._ctorParams, ..._ctorQueryParams, ]) { @@ -441,7 +441,7 @@ class GoRouteConfig extends RouteBaseConfig with _GoRouteMixin { final String? parentNavigatorKey; String get _rawJoinedPath { - final List pathSegments = []; + final pathSegments = []; RouteBaseConfig? config = this; while (config != null) { @@ -598,7 +598,7 @@ abstract class RouteBaseConfig { ConstantReader reader, InterfaceElement2 element, ) { - final RouteBaseConfig definition = RouteBaseConfig._fromAnnotation( + final definition = RouteBaseConfig._fromAnnotation( reader, element, null, @@ -622,7 +622,7 @@ abstract class RouteBaseConfig { bool isAncestorRelative = false, }) { assert(!reader.isNull, 'reader should not be null'); - final InterfaceType type = reader.objectValue.type! as InterfaceType; + final type = reader.objectValue.type! as InterfaceType; final String typeName = type.element.displayName; if (isAncestorRelative && typeName == 'TypedGoRoute') { @@ -850,7 +850,7 @@ abstract class RouteBaseConfig { ); Iterable _generateMembers() sync* { - final List items = [_rootDefinition()]; + final items = [_rootDefinition()]; for (final RouteBaseConfig def in _flatten()) { items.addAll(def.classDeclarations()); @@ -893,7 +893,7 @@ RouteBase get $_routeGetterName => ${_invokesRouteConstructor()}; String get _extensionName => '\$${_className}Extension'; String _invokesRouteConstructor() { - final String routesBit = _children.isEmpty + final routesBit = _children.isEmpty ? '' : ''' ${_generateChildrenGetterName(routeDataClassName)}: [${_children.map((RouteBaseConfig e) => '${e._invokesRouteConstructor()},').join()}], @@ -939,7 +939,7 @@ String _enumMapConst(InterfaceType type) { final String enumName = type.element.displayName; - final StringBuffer buffer = StringBuffer('const ${enumMapName(type)} = {'); + final buffer = StringBuffer('const ${enumMapName(type)} = {'); // ignore: experimental_member_use for (final FieldElement2 enumField in type.element3.fields2.where( diff --git a/packages/go_router_builder/lib/src/type_helpers.dart b/packages/go_router_builder/lib/src/type_helpers.dart index 5c4a4d230ad..cffec763c01 100644 --- a/packages/go_router_builder/lib/src/type_helpers.dart +++ b/packages/go_router_builder/lib/src/type_helpers.dart @@ -188,7 +188,7 @@ T? getNodeDeclaration(InterfaceElement2 element) { return null; } - final ParsedLibraryResult parsedLibrary = + final parsedLibrary = // ignore: experimental_member_use session.getParsedLibraryByElement2(element.library2) as ParsedLibraryResult; @@ -240,7 +240,7 @@ String _stateValueAccess( } late String access; - final String suffix = !element.type.isNullableType && !element.hasDefaultValue + final suffix = !element.type.isNullableType && !element.hasDefaultValue ? '!' : ''; if (pathParameters.contains(element.displayName)) { @@ -420,7 +420,7 @@ class _TypeHelperExtensionType extends _TypeHelper { throw NullableDefaultValueError(parameterElement); } - final String stateValue = + final stateValue = 'state.${_stateValueAccess(parameterElement, pathParameters)}'; final String castType; if (paramType.isNullableType || parameterElement.hasDefaultValue) { @@ -595,8 +595,8 @@ class _TypeHelperIterable extends _TypeHelperWithHelper { (parameterElement.type as ParameterizedType).typeArguments.first; // get a type converter for values in iterable - String entriesTypeDecoder = '(e) => e'; - String convertToNotNull = ''; + var entriesTypeDecoder = '(e) => e'; + var convertToNotNull = ''; for (final _TypeHelper helper in _helpers) { if (helper._matchesType(iterableType) && @@ -613,8 +613,8 @@ class _TypeHelperIterable extends _TypeHelperWithHelper { } // get correct type for iterable - String iterableCaster = ''; - String fallBack = ''; + var iterableCaster = ''; + var fallBack = ''; if (const TypeChecker.typeNamed( List, inSdk: true, @@ -646,12 +646,12 @@ state.uri.queryParametersAll[${escapeDartString(parameterElement.displayName.keb @override String _encode(String fieldName, DartType type, String? customEncoder) { - final String nullAwareAccess = type.isNullableType ? '?' : ''; + final nullAwareAccess = type.isNullableType ? '?' : ''; if (type is ParameterizedType) { final DartType iterableType = type.typeArguments.first; // get a type encoder for values in iterable - String entriesTypeEncoder = ''; + var entriesTypeEncoder = ''; for (final _TypeHelper helper in _helpers) { if (helper._matchesType(iterableType)) { entriesTypeEncoder = ''' @@ -738,8 +738,8 @@ class _TypeHelperJson extends _TypeHelperWithHelper { } String _helperNameN(DartType paramType, int index) { - final String mainType = index == 0 ? 'String' : 'Object?'; - final String mainDecoder = index == 0 + final mainType = index == 0 ? 'String' : 'Object?'; + final mainDecoder = index == 0 ? 'jsonDecode(json$index) as Map' : 'json$index as Map'; if (_isNestedTemplate(paramType as InterfaceType)) { @@ -794,7 +794,7 @@ class _TypeHelperJson extends _TypeHelperWithHelper { return false; } - final FunctionType functionType = secondParam.type as FunctionType; + final functionType = secondParam.type as FunctionType; // ignore: experimental_member_use if (functionType.formalParameters.length != 1 || functionType.returnType.getDisplayString() != @@ -834,7 +834,7 @@ abstract class _TypeHelperWithHelper extends _TypeHelper { 'state.uri.queryParameters, ' '${helperName(paramType)})'; } - final String nullableSuffix = + final nullableSuffix = paramType.isNullableType || (paramType.isEnum && !paramType.isNullableType) ? '!' diff --git a/packages/go_router_builder/tool/run_tests.dart b/packages/go_router_builder/tool/run_tests.dart index 40e629e7b37..4ddb1de7db2 100644 --- a/packages/go_router_builder/tool/run_tests.dart +++ b/packages/go_router_builder/tool/run_tests.dart @@ -19,18 +19,18 @@ import 'package:test/test.dart'; const GoRouterGenerator generator = GoRouterGenerator(); Future main() async { - final dart_style.DartFormatter formatter = dart_style.DartFormatter( + final formatter = dart_style.DartFormatter( languageVersion: await _packageVersion(), ); - final Directory dir = Directory('test_inputs'); + final dir = Directory('test_inputs'); final List testFiles = dir .listSync() .whereType() .where((File f) => f.path.endsWith('.dart')) .toList(); - for (final File file in testFiles) { + for (final file in testFiles) { final String fileName = file.path.split('/').last; - final File expectFile = File(p.join('${file.path}.expect')); + final expectFile = File(p.join('${file.path}.expect')); if (!expectFile.existsSync()) { throw Exception( 'A text input must have a .expect file. ' @@ -41,17 +41,17 @@ Future main() async { test('verify $fileName', () async { // Normalize path separators for cross-platform compatibility final String path = file.path.replaceAll(r'\', '/'); - final String targetLibraryAssetId = '__test__|$path'; + final targetLibraryAssetId = '__test__|$path'; final LibraryElement2 element = await resolveSources( {targetLibraryAssetId: file.readAsStringSync()}, (Resolver resolver) async { - final AssetId assetId = AssetId.parse(targetLibraryAssetId); + final assetId = AssetId.parse(targetLibraryAssetId); return resolver.libraryFor(assetId); }, readAllSourcesFromFilesystem: true, ); - final LibraryReader reader = LibraryReader(element); - final Set results = {}; + final reader = LibraryReader(element); + final results = {}; try { generator.generateForAnnotation(reader, results, {}); } on InvalidGenerationSourceError catch (e) { diff --git a/packages/google_adsense/example/integration_test/core_test.dart b/packages/google_adsense/example/integration_test/core_test.dart index 55404f5526e..0e41a9891fe 100644 --- a/packages/google_adsense/example/integration_test/core_test.dart +++ b/packages/google_adsense/example/integration_test/core_test.dart @@ -36,7 +36,7 @@ void main() async { await adSense.initialize(testClient, jsLoaderTarget: target); - final web.HTMLScriptElement? injected = + final injected = target.lastElementChild as web.HTMLScriptElement?; expect(injected, isNotNull); @@ -65,7 +65,7 @@ void main() async { ), ); - final web.HTMLScriptElement injected = + final injected = target.lastElementChild! as web.HTMLScriptElement; expect(injected.dataset['adHost'], 'test-adHost'); @@ -90,7 +90,7 @@ void main() async { testWidgets('Skips initialization if script is already present.', ( WidgetTester _, ) async { - final web.HTMLScriptElement script = web.HTMLScriptElement() + final script = web.HTMLScriptElement() ..id = 'previously-injected' ..src = testScriptUrl; final web.HTMLElement target = web.HTMLDivElement()..appendChild(script); diff --git a/packages/google_adsense/example/integration_test/experimental_ad_unit_widget_test.dart b/packages/google_adsense/example/integration_test/experimental_ad_unit_widget_test.dart index df751abd1e4..935d01877e9 100644 --- a/packages/google_adsense/example/integration_test/experimental_ad_unit_widget_test.dart +++ b/packages/google_adsense/example/integration_test/experimental_ad_unit_widget_test.dart @@ -55,7 +55,7 @@ void main() async { await adSense.initialize(testClient); - final CallbackTracker tracker = CallbackTracker(); + final tracker = CallbackTracker(); final Widget adUnitWidget = AdUnitWidget( configuration: AdUnitConfiguration.displayAdUnit( adSlot: testSlot, @@ -80,14 +80,14 @@ void main() async { 'Fixed size (without adFormat) ad units respect flutter constraints', (WidgetTester tester) async { const double maxHeight = 100; - const BoxConstraints constraints = BoxConstraints(maxHeight: maxHeight); + const constraints = BoxConstraints(maxHeight: maxHeight); // When mockAdsByGoogle(mockAd(size: const Size(320, 157))); await adSense.initialize(testClient); - final CallbackTracker tracker = CallbackTracker(); + final tracker = CallbackTracker(); final Widget adUnitWidget = AdUnitWidget( configuration: AdUnitConfiguration.displayAdUnit(adSlot: testSlot), adClient: adSense.adClient, @@ -119,7 +119,7 @@ void main() async { await adSense.initialize(testClient); - final CallbackTracker tracker = CallbackTracker(); + final tracker = CallbackTracker(); final Widget adUnitWidget = AdUnitWidget( configuration: AdUnitConfiguration.displayAdUnit(adSlot: testSlot), adClient: adSense.adClient, @@ -154,7 +154,7 @@ void main() async { await adSense.initialize(testClient); - final CallbackTracker tracker = CallbackTracker(); + final tracker = CallbackTracker(); final Widget bunchOfAds = Column( children: [ AdUnitWidget( @@ -231,7 +231,7 @@ Future pumpAdWidget( ), ); - final Stopwatch timer = Stopwatch()..start(); + final timer = Stopwatch()..start(); while (!tracker.allCalled) { if (timer.elapsedMilliseconds > 1000) { fail('timeout while waiting for ad widget to be injected'); diff --git a/packages/google_adsense/example/integration_test/h5_test.dart b/packages/google_adsense/example/integration_test/h5_test.dart index a8ad8c7f1e0..698461aaad9 100644 --- a/packages/google_adsense/example/integration_test/h5_test.dart +++ b/packages/google_adsense/example/integration_test/h5_test.dart @@ -28,7 +28,7 @@ void main() { mockAdsByGoogle(mockAdBreak()); await adSense.initialize('_'); - final AdBreakPlacement adBreakPlacement = AdBreakPlacement( + final adBreakPlacement = AdBreakPlacement( type: BreakType.reward, ); @@ -61,7 +61,7 @@ void main() { ); await adSense.initialize('_'); - final AdBreakPlacement adBreakPlacement = AdBreakPlacement( + final adBreakPlacement = AdBreakPlacement( type: BreakType.reward, adBreakDone: adBreakDoneCallback, ); @@ -81,7 +81,7 @@ void main() { mockAdsByGoogle(mockAdBreak()); await adSense.initialize('_'); - final AdBreakPlacement adBreakPlacement = AdBreakPlacement( + final adBreakPlacement = AdBreakPlacement( type: BreakType.reward, name: 'my-test-break', ); @@ -99,7 +99,7 @@ void main() { group('h5GamesAds.adConfig', () { testWidgets('can set up configuration', (WidgetTester tester) async { - bool called = false; + var called = false; void onReadyCallback() { called = true; } diff --git a/packages/google_adsense/example/integration_test/js_interop_mocks/adsense_test_js_interop.dart b/packages/google_adsense/example/integration_test/js_interop_mocks/adsense_test_js_interop.dart index 7ad3ddeb08d..4d9483ea82b 100644 --- a/packages/google_adsense/example/integration_test/js_interop_mocks/adsense_test_js_interop.dart +++ b/packages/google_adsense/example/integration_test/js_interop_mocks/adsense_test_js_interop.dart @@ -28,7 +28,7 @@ PushFn mockAds(List adConfigs) { .querySelectorAll('div[id^=adUnit] ins') .toList; - for (int i = 0; i < foundTargets.length; i++) { + for (var i = 0; i < foundTargets.length; i++) { final web.HTMLElement adTarget = foundTargets[i]; if (adTarget.children.length > 0) { continue; @@ -54,8 +54,8 @@ PushFn mockAds(List adConfigs) { extension on web.NodeList { List get toList { - final List result = []; - for (int i = 0; i < length; i++) { + final result = []; + for (var i = 0; i < length; i++) { final web.Node? node = item(i); if (node != null && node.isA()) { result.add(node as web.HTMLElement); diff --git a/packages/google_adsense/example/integration_test/script_tag_test.dart b/packages/google_adsense/example/integration_test/script_tag_test.dart index f2c150b1e9f..7daa95e4c3a 100644 --- a/packages/google_adsense/example/integration_test/script_tag_test.dart +++ b/packages/google_adsense/example/integration_test/script_tag_test.dart @@ -18,14 +18,14 @@ void main() async { group('JS initialization', () { testWidgets('Initialization adds AdSense snippet.', (WidgetTester _) async { // Given - const String expectedScriptUrl = + const expectedScriptUrl = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-$testClient'; // When (using the singleton adSense from the plugin) await adSense.initialize(testClient); // Then - final web.HTMLScriptElement? injected = + final injected = web.document.head?.lastElementChild as web.HTMLScriptElement?; expect(injected, isNotNull); diff --git a/packages/google_adsense/example/lib/h5.dart b/packages/google_adsense/example/lib/h5.dart index 3e2ac65dd21..fe2cab820ed 100644 --- a/packages/google_adsense/example/lib/h5.dart +++ b/packages/google_adsense/example/lib/h5.dart @@ -151,7 +151,7 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { - final bool adBreakAvailable = _showAdFn != null; + final adBreakAvailable = _showAdFn != null; return Scaffold( appBar: AppBar( backgroundColor: Theme.of(context).colorScheme.inversePrimary, diff --git a/packages/google_adsense/lib/src/adsense/ad_unit_widget.dart b/packages/google_adsense/lib/src/adsense/ad_unit_widget.dart index 1f06d326a3e..bb9cabbef2d 100644 --- a/packages/google_adsense/lib/src/adsense/ad_unit_widget.dart +++ b/packages/google_adsense/lib/src/adsense/ad_unit_widget.dart @@ -105,7 +105,7 @@ class _AdUnitWidgetWebState extends State void _onElementCreated(Object element) { // Create the `ins` element that is going to contain the actual ad. - final web.HTMLElement insElement = + final insElement = (web.document.createElement('ins') as web.HTMLElement) ..className = 'adsbygoogle' ..style.width = '100%' @@ -121,7 +121,7 @@ class _AdUnitWidgetWebState extends State }); // Adding ins inside of the adUnit - final web.HTMLDivElement adUnitDiv = element as web.HTMLDivElement + final adUnitDiv = element as web.HTMLDivElement ..id = 'adUnit${_adUnitCounter++}' ..append(insElement); @@ -132,7 +132,7 @@ class _AdUnitWidgetWebState extends State web.MutationObserver( (JSArray entries, web.MutationObserver observer) { for (final JSObject entry in entries.toDart) { - final web.HTMLElement target = + final target = (entry as web.MutationRecord).target as web.HTMLElement; if (_isLoaded(target)) { if (_isFilled(target)) { diff --git a/packages/google_adsense/lib/src/core/js_interop/js_loader.dart b/packages/google_adsense/lib/src/core/js_interop/js_loader.dart index aea3577e0c8..f570abc8ffc 100644 --- a/packages/google_adsense/lib/src/core/js_interop/js_loader.dart +++ b/packages/google_adsense/lib/src/core/js_interop/js_loader.dart @@ -31,14 +31,14 @@ Future loadJsSdk( return; } - final String scriptUrl = '$_URL?client=ca-pub-$adClient'; + final scriptUrl = '$_URL?client=ca-pub-$adClient'; - final web.HTMLScriptElement script = web.HTMLScriptElement() + final script = web.HTMLScriptElement() ..async = true ..crossOrigin = 'anonymous'; if (web.window.nullableTrustedTypes != null) { - final String trustedTypePolicyName = 'adsense-dart-$adClient'; + final trustedTypePolicyName = 'adsense-dart-$adClient'; try { final web.TrustedTypePolicy policy = web.window.trustedTypes.createPolicy( trustedTypePolicyName, @@ -75,7 +75,7 @@ void _applyDataAttributes( // [target] can be used to specify a different injection target than // `window.document.head`, and is normally used for tests. bool _sdkAlreadyLoaded(String adClient, web.HTMLElement? target) { - final String selector = 'script[src*=ca-pub-$adClient]'; + final selector = 'script[src*=ca-pub-$adClient]'; return adsbygooglePresent || web.document.querySelector(selector) != null || target?.querySelector(selector) != null; diff --git a/packages/google_adsense/lib/src/h5/enums.dart b/packages/google_adsense/lib/src/h5/enums.dart index 757595a7ba1..0b78e64b870 100644 --- a/packages/google_adsense/lib/src/h5/enums.dart +++ b/packages/google_adsense/lib/src/h5/enums.dart @@ -7,7 +7,7 @@ extension MaybeEnum on List { /// Attempts to retrieve an enum of type T by its [name]. T? maybe(String? name) { - for (final T value in this) { + for (final value in this) { if (value.name == name) { return value; } diff --git a/packages/google_fonts/example/lib/readme_excerpts.dart b/packages/google_fonts/example/lib/readme_excerpts.dart index 0beab3ac726..9d718982671 100644 --- a/packages/google_fonts/example/lib/readme_excerpts.dart +++ b/packages/google_fonts/example/lib/readme_excerpts.dart @@ -86,7 +86,7 @@ class MyApp extends StatelessWidget { } ThemeData _buildTheme(Brightness brightness) { - final ThemeData baseTheme = ThemeData(brightness: brightness); + final baseTheme = ThemeData(brightness: brightness); return baseTheme.copyWith( textTheme: GoogleFonts.latoTextTheme(baseTheme.textTheme), diff --git a/packages/google_fonts/example/test/widget_test.dart b/packages/google_fonts/example/test/widget_test.dart index e3c2578cae6..3f0a4886142 100644 --- a/packages/google_fonts/example/test/widget_test.dart +++ b/packages/google_fonts/example/test/widget_test.dart @@ -15,7 +15,7 @@ void main() { }); testWidgets('Can specify text theme', (WidgetTester tester) async { - final ThemeData baseTheme = ThemeData.dark(); + final baseTheme = ThemeData.dark(); await tester.pumpWidget( MaterialApp( diff --git a/packages/google_fonts/generator/generator.dart b/packages/google_fonts/generator/generator.dart index e6b7cba183f..db95b07a17b 100644 --- a/packages/google_fonts/generator/generator.dart +++ b/packages/google_fonts/generator/generator.dart @@ -30,7 +30,7 @@ Future main() async { print(_success); print('\nDetermining font families delta...'); - final _FamiliesDelta familiesDelta = _FamiliesDelta(fontDirectory); + final familiesDelta = _FamiliesDelta(fontDirectory); print(_success); print('\nGenerating $_familiesSupportedPath & $_familiesDiffPath ...'); @@ -61,7 +61,7 @@ const String _success = 'Success!'; /// that's okay for now, because the generator is only executed in trusted /// environments by individual developers. Future _getProtoUrl({int initialVersion = 7}) async { - int directoryVersion = initialVersion; + var directoryVersion = initialVersion; Uri url(int directoryVersion) { final String paddedVersion = directoryVersion.toString().padLeft(3, '0'); @@ -70,8 +70,8 @@ Future _getProtoUrl({int initialVersion = 7}) async { ); } - bool didReachLatestUrl = false; - final http.Client httpClient = http.Client(); + var didReachLatestUrl = false; + final httpClient = http.Client(); while (!didReachLatestUrl) { final http.Response response = await httpClient.get(url(directoryVersion)); if (response.statusCode == 200) { @@ -93,11 +93,11 @@ Future _verifyUrls(Directory fontDirectory) async { .map((FontFamily f) => f.fonts.length) .reduce((int a, int b) => a + b); - final http.Client client = http.Client(); - int i = 1; + final client = http.Client(); + var i = 1; for (final FontFamily family in fontDirectory.family) { for (final Font font in family.fonts) { - final String urlString = + final urlString = 'https://fonts.gstatic.com/s/a/${_hashToString(font.file.hash)}.ttf'; final Uri url = Uri.parse(urlString); await _tryUrl(client, url, font); @@ -112,7 +112,7 @@ Future _tryUrl(http.Client client, Uri url, Font font) async { try { final http.Response fileContents = await client.get(url); final int actualFileLength = fileContents.bodyBytes.length; - final String actualFileHash = sha256 + final actualFileHash = sha256 .convert(fileContents.bodyBytes) .toString(); if (font.file.fileSize != actualFileLength || @@ -126,8 +126,8 @@ Future _tryUrl(http.Client client, Uri url, Font font) async { } String _hashToString(List bytes) { - String fileName = ''; - for (final int byte in bytes) { + var fileName = ''; + for (final byte in bytes) { final String convertedByte = byte.toRadixString(16).padLeft(2, '0'); fileName += convertedByte; } @@ -148,7 +148,7 @@ class _FamiliesDelta { void _init(Directory fontDirectory) { // Currently supported families. - final Set familiesSupported = Set.from( + final familiesSupported = Set.from( File(_familiesSupportedPath).readAsLinesSync(), ); @@ -174,7 +174,7 @@ class _FamiliesDelta { (String family) => ' - Removed `$family`', ); - String diff = ''; + var diff = ''; if (removedPrintable.isNotEmpty) { diff += removedPrintable.join('\n'); diff += '\n'; @@ -189,7 +189,7 @@ class _FamiliesDelta { } void _generateDartCode(Directory fontDirectory) { - final List> methods = >[]; + final methods = >[]; for (final FontFamily item in fontDirectory.family) { final String family = item.name; @@ -197,7 +197,7 @@ void _generateDartCode(Directory fontDirectory) { final String familyWithPlusSigns = family.replaceAll(' ', '+'); final String methodName = _familyToMethodName(family); - const List themeParams = [ + const themeParams = [ 'displayLarge', 'displayMedium', 'displaySmall', @@ -240,12 +240,12 @@ void _generateDartCode(Directory fontDirectory) { } // Part font methods by first letter. - final Map>> methodsByLetter = + final methodsByLetter = >>{}; - final List> allParts = >[]; + final allParts = >[]; - for (final Map map in methods) { - final String methodName = map['methodName'] as String; + for (final map in methods) { + final methodName = map['methodName'] as String; final String firstLetter = methodName[0]; if (!methodsByLetter.containsKey(firstLetter)) { allParts.add({ @@ -260,7 +260,7 @@ void _generateDartCode(Directory fontDirectory) { } // Generate part files. - final Template partTemplate = Template( + final partTemplate = Template( File('generator/google_fonts_part.tmpl').readAsStringSync(), htmlEscapeValues: false, ); @@ -276,7 +276,7 @@ void _generateDartCode(Directory fontDirectory) { }); // Generate main file. - final Template template = Template( + final template = Template( File('generator/google_fonts.tmpl').readAsStringSync(), htmlEscapeValues: false, ); @@ -295,10 +295,10 @@ void _writeDartFile(String path, String content) { String _familyToMethodName(String family) { final List words = family.split(' '); - for (int i = 0; i < words.length; i++) { + for (var i = 0; i < words.length; i++) { final String word = words[i]; - final bool isFirst = i == 0; - final bool isUpperCase = word == word.toUpperCase(); + final isFirst = i == 0; + final isUpperCase = word == word.toUpperCase(); words[i] = (isFirst ? word[0].toLowerCase() : word[0].toUpperCase()) + (isUpperCase ? word.substring(1).toLowerCase() : word.substring(1)); diff --git a/packages/google_fonts/lib/src/google_fonts_base.dart b/packages/google_fonts/lib/src/google_fonts_base.dart index 14744275195..47cbfa9b059 100755 --- a/packages/google_fonts/lib/src/google_fonts_base.dart +++ b/packages/google_fonts/lib/src/google_fonts_base.dart @@ -92,18 +92,18 @@ TextStyle googleFontsTextStyle({ decorationThickness: decorationThickness, ); - final GoogleFontsVariant variant = GoogleFontsVariant( + final variant = GoogleFontsVariant( fontWeight: textStyle.fontWeight ?? FontWeight.w400, fontStyle: textStyle.fontStyle ?? FontStyle.normal, ); final GoogleFontsVariant matchedVariant = _closestMatch(variant, fonts.keys); - final GoogleFontsFamilyWithVariant familyWithVariant = + final familyWithVariant = GoogleFontsFamilyWithVariant( family: fontFamily, googleFontsVariant: matchedVariant, ); - final GoogleFontsDescriptor descriptor = GoogleFontsDescriptor( + final descriptor = GoogleFontsDescriptor( familyWithVariant: familyWithVariant, file: fonts[matchedVariant]!, ); @@ -129,7 +129,7 @@ TextStyle googleFontsTextStyle({ /// the [fontUrl] and stored on device. In all cases, the returned future /// completes once the font is loaded into the [FontLoader]. Future loadFontIfNecessary(GoogleFontsDescriptor descriptor) async { - final String familyWithVariantString = descriptor.familyWithVariant + final familyWithVariantString = descriptor.familyWithVariant .toString(); final String fontName = descriptor.familyWithVariant.toApiFilenamePrefix(); final String fileHash = descriptor.file.expectedFileHash; @@ -223,7 +223,7 @@ Future loadFontByteData( return; } - final FontLoader fontLoader = FontLoader(familyWithVariantString); + final fontLoader = FontLoader(familyWithVariantString); fontLoader.addFont(Future.value(fontData)); await fontLoader.load(); } @@ -240,7 +240,7 @@ GoogleFontsVariant _closestMatch( ) { int? bestScore; late GoogleFontsVariant bestMatch; - for (final GoogleFontsVariant variantToCompare in variantsToCompare) { + for (final variantToCompare in variantsToCompare) { final int score = _computeMatch(sourceVariant, variantToCompare); if (bestScore == null || score < bestScore) { bestScore = score; @@ -337,7 +337,7 @@ String? _findFamilyWithVariantAssetPath( bool _isFileSecure(GoogleFontsFile file, Uint8List bytes) { final int actualFileLength = bytes.length; - final String actualFileHash = sha256.convert(bytes).toString(); + final actualFileHash = sha256.convert(bytes).toString(); return file.expectedLength == actualFileLength && file.expectedFileHash == actualFileHash; } diff --git a/packages/google_fonts/lib/src/google_fonts_variant.dart b/packages/google_fonts/lib/src/google_fonts_variant.dart index a5081f3c93d..65792e142d0 100644 --- a/packages/google_fonts/lib/src/google_fonts_variant.dart +++ b/packages/google_fonts/lib/src/google_fonts_variant.dart @@ -115,7 +115,7 @@ class GoogleFontsVariant { final String weightPrefix = _fontWeightToFilenameWeightParts[fontWeight] ?? _fontWeightToFilenameWeightParts[FontWeight.w400]!; - final String italicSuffix = fontStyle == FontStyle.italic ? 'Italic' : ''; + final italicSuffix = fontStyle == FontStyle.italic ? 'Italic' : ''; if (weightPrefix == 'Regular') { return italicSuffix == '' ? weightPrefix : italicSuffix; } diff --git a/packages/google_fonts/test/generated_font_methods_test.dart b/packages/google_fonts/test/generated_font_methods_test.dart index f6d9c40fe09..2a484a809f5 100644 --- a/packages/google_fonts/test/generated_font_methods_test.dart +++ b/packages/google_fonts/test/generated_font_methods_test.dart @@ -29,7 +29,7 @@ void main() { testWidgets('Text style with a direct match is used', ( WidgetTester tester, ) async { - const TextStyle inputTextStyle = TextStyle( + const inputTextStyle = TextStyle( fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ); @@ -44,7 +44,7 @@ void main() { testWidgets('Text style with an italics direct match is used', ( WidgetTester tester, ) async { - const TextStyle inputTextStyle = TextStyle( + const inputTextStyle = TextStyle( fontWeight: FontWeight.w400, fontStyle: FontStyle.italic, ); @@ -59,7 +59,7 @@ void main() { testWidgets( 'Text style with no direct match picks closest font weight match', (WidgetTester tester) async { - const TextStyle inputTextStyle = TextStyle( + const inputTextStyle = TextStyle( fontWeight: FontWeight.w600, fontStyle: FontStyle.normal, ); @@ -75,7 +75,7 @@ void main() { testWidgets('Italic text style with no direct match picks closest match', ( WidgetTester tester, ) async { - const TextStyle inputTextStyle = TextStyle( + const inputTextStyle = TextStyle( fontWeight: FontWeight.w600, fontStyle: FontStyle.italic, ); @@ -93,7 +93,7 @@ void main() { // Cardo has 400regular, 400italic, and 700 regular. Even though 700 is // closer in weight, when we ask for 600italic, it will give us 400 italic // font family. - const TextStyle inputTextStyle = TextStyle( + const inputTextStyle = TextStyle( fontWeight: FontWeight.w600, fontStyle: FontStyle.italic, ); @@ -131,7 +131,7 @@ void main() { testWidgets('color is honored when passed in via the TextStyle param', ( WidgetTester tester, ) async { - const TextStyle textStyle = TextStyle(color: Color(0xDEADBEEF)); + const textStyle = TextStyle(color: Color(0xDEADBEEF)); final TextStyle outputTextStyle = GoogleFonts.rancho(textStyle: textStyle); expect(outputTextStyle.color, equals(const Color(0xDEADBEEF))); @@ -149,7 +149,7 @@ void main() { testWidgets('color from the top-level param takes precedence over color ' 'from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(color: Color(0xDEADBEEF)); + const textStyle = TextStyle(color: Color(0xDEADBEEF)); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, color: const Color(0xFACEFEED), @@ -161,7 +161,7 @@ void main() { testWidgets( 'backgroundColor is honored when passed in via the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(backgroundColor: Color(0xDEADBEEF)); + const textStyle = TextStyle(backgroundColor: Color(0xDEADBEEF)); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, ); @@ -183,7 +183,7 @@ void main() { testWidgets('backgroundColor from the top-level param takes precedence over ' 'backgroundColor from TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(backgroundColor: Color(0xDEADBEEF)); + const textStyle = TextStyle(backgroundColor: Color(0xDEADBEEF)); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, backgroundColor: const Color(0xFACEFEED), @@ -195,7 +195,7 @@ void main() { testWidgets('fontSize is honored when passed in via the TextStyle param', ( WidgetTester tester, ) async { - const TextStyle textStyle = TextStyle(fontSize: 37); + const textStyle = TextStyle(fontSize: 37); final TextStyle outputTextStyle = GoogleFonts.rancho(textStyle: textStyle); expect(outputTextStyle.fontSize, equals(37)); @@ -213,7 +213,7 @@ void main() { 'fontSize from the top-level param takes precedence over fontSize ' 'from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(fontSize: 37); + const textStyle = TextStyle(fontSize: 37); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, fontSize: 31, @@ -226,7 +226,7 @@ void main() { testWidgets('fontWeight is honored when passed in via the TextStyle param', ( WidgetTester tester, ) async { - const TextStyle textStyle = TextStyle(fontWeight: FontWeight.w800); + const textStyle = TextStyle(fontWeight: FontWeight.w800); final TextStyle outputTextStyle = GoogleFonts.rancho(textStyle: textStyle); expect(outputTextStyle.fontWeight, equals(FontWeight.w800)); @@ -246,7 +246,7 @@ void main() { 'fontWeight from the top-level param takes precedence over fontWeight ' 'from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(fontWeight: FontWeight.w800); + const textStyle = TextStyle(fontWeight: FontWeight.w800); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, fontWeight: FontWeight.w200, @@ -259,7 +259,7 @@ void main() { testWidgets('fontStyle is honored when passed in via the TextStyle param', ( WidgetTester tester, ) async { - const TextStyle textStyle = TextStyle(fontStyle: FontStyle.normal); + const textStyle = TextStyle(fontStyle: FontStyle.normal); final TextStyle outputTextStyle = GoogleFonts.rancho(textStyle: textStyle); expect(outputTextStyle.fontStyle, equals(FontStyle.normal)); @@ -279,7 +279,7 @@ void main() { 'fontStyle from the top-level param takes precedence over fontStyle ' 'from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(fontStyle: FontStyle.normal); + const textStyle = TextStyle(fontStyle: FontStyle.normal); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, fontStyle: FontStyle.italic, @@ -292,7 +292,7 @@ void main() { testWidgets( 'letterSpacing is honored when passed in via the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(letterSpacing: 0.4); + const textStyle = TextStyle(letterSpacing: 0.4); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, ); @@ -311,7 +311,7 @@ void main() { testWidgets('letterSpacing from the top-level param takes precedence over ' 'letterSpacing from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(letterSpacing: 0.4); + const textStyle = TextStyle(letterSpacing: 0.4); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, letterSpacing: 0.3, @@ -323,7 +323,7 @@ void main() { testWidgets('wordSpacing is honored when passed in via the TextStyle param', ( WidgetTester tester, ) async { - const TextStyle textStyle = TextStyle(wordSpacing: 0.4); + const textStyle = TextStyle(wordSpacing: 0.4); final TextStyle outputTextStyle = GoogleFonts.rancho(textStyle: textStyle); expect(outputTextStyle.wordSpacing, equals(0.4)); @@ -341,7 +341,7 @@ void main() { 'wordSpacing from the top-level param takes precedence over wordSpacing ' 'from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(wordSpacing: 0.4); + const textStyle = TextStyle(wordSpacing: 0.4); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, wordSpacing: 0.3, @@ -354,7 +354,7 @@ void main() { testWidgets( 'textBaseline is honored when passed in via the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle( + const textStyle = TextStyle( textBaseline: TextBaseline.ideographic, ); final TextStyle outputTextStyle = GoogleFonts.rancho( @@ -377,7 +377,7 @@ void main() { testWidgets('textBaseline from the top-level param takes precedence over ' 'textBaseline from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle( + const textStyle = TextStyle( textBaseline: TextBaseline.ideographic, ); final TextStyle outputTextStyle = GoogleFonts.rancho( @@ -391,7 +391,7 @@ void main() { testWidgets('height is honored when passed in via the TextStyle param', ( WidgetTester tester, ) async { - const TextStyle textStyle = TextStyle(height: 33); + const textStyle = TextStyle(height: 33); final TextStyle outputTextStyle = GoogleFonts.rancho(textStyle: textStyle); expect(outputTextStyle.height, equals(33)); @@ -407,7 +407,7 @@ void main() { testWidgets('height from the top-level param takes precedence over height ' 'from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(height: 33); + const textStyle = TextStyle(height: 33); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, height: 37, @@ -419,7 +419,7 @@ void main() { testWidgets('locale is honored when passed in via the TextStyle param', ( WidgetTester tester, ) async { - const TextStyle textStyle = TextStyle(locale: Locale('abc')); + const textStyle = TextStyle(locale: Locale('abc')); final TextStyle outputTextStyle = GoogleFonts.rancho(textStyle: textStyle); expect(outputTextStyle.locale, equals(const Locale('abc'))); @@ -437,7 +437,7 @@ void main() { testWidgets('locale from the top-level param takes precedence over locale ' 'from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(locale: Locale('abc')); + const textStyle = TextStyle(locale: Locale('abc')); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, locale: const Locale('xyz'), @@ -449,8 +449,8 @@ void main() { testWidgets('foreground is honored when passed in via the TextStyle param', ( WidgetTester tester, ) async { - final Paint paint = Paint()..color = const Color(0xDEADBEEF); - final TextStyle textStyle = TextStyle(foreground: paint); + final paint = Paint()..color = const Color(0xDEADBEEF); + final textStyle = TextStyle(foreground: paint); final TextStyle outputTextStyle = GoogleFonts.rancho(textStyle: textStyle); expect(outputTextStyle.foreground, equals(paint)); @@ -459,7 +459,7 @@ void main() { testWidgets('foreground is honored when passed in as a top-level param', ( WidgetTester tester, ) async { - final Paint paint = Paint()..color = const Color(0xFACEFEED); + final paint = Paint()..color = const Color(0xFACEFEED); final TextStyle outputTextStyle = GoogleFonts.rancho(foreground: paint); expect(outputTextStyle.foreground, equals(paint)); @@ -469,9 +469,9 @@ void main() { 'foreground from the top-level param takes precedence over foreground ' 'from the TextStyle param', (WidgetTester tester) async { - final Paint paint1 = Paint()..color = const Color(0xDEADBEEF); - final Paint paint2 = Paint()..color = const Color(0xFACEFEED); - final TextStyle textStyle = TextStyle(foreground: paint1); + final paint1 = Paint()..color = const Color(0xDEADBEEF); + final paint2 = Paint()..color = const Color(0xFACEFEED); + final textStyle = TextStyle(foreground: paint1); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, foreground: paint2, @@ -484,8 +484,8 @@ void main() { testWidgets('background is honored when passed in via the TextStyle param', ( WidgetTester tester, ) async { - final Paint paint = Paint()..color = const Color(0xDEADBEEF); - final TextStyle textStyle = TextStyle(background: paint); + final paint = Paint()..color = const Color(0xDEADBEEF); + final textStyle = TextStyle(background: paint); final TextStyle outputTextStyle = GoogleFonts.rancho(textStyle: textStyle); expect(outputTextStyle.background, equals(paint)); @@ -494,7 +494,7 @@ void main() { testWidgets('background is honored when passed in as a top-level param', ( WidgetTester tester, ) async { - final Paint paint = Paint()..color = const Color(0xFACEFEED); + final paint = Paint()..color = const Color(0xFACEFEED); final TextStyle outputTextStyle = GoogleFonts.rancho(background: paint); expect(outputTextStyle.background, equals(paint)); @@ -504,9 +504,9 @@ void main() { 'background from the top-level param takes precedence over background ' 'from the TextStyle param', (WidgetTester tester) async { - final Paint paint1 = Paint()..color = const Color(0xDEADBEEF); - final Paint paint2 = Paint()..color = const Color(0xFACEFEED); - final TextStyle textStyle = TextStyle(background: paint1); + final paint1 = Paint()..color = const Color(0xDEADBEEF); + final paint2 = Paint()..color = const Color(0xFACEFEED); + final textStyle = TextStyle(background: paint1); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, background: paint2, @@ -519,8 +519,8 @@ void main() { testWidgets('shadows is honored when passed in via the TextStyle param', ( WidgetTester tester, ) async { - const List shadows = [Shadow(blurRadius: 1)]; - const TextStyle textStyle = TextStyle(shadows: shadows); + const shadows = [Shadow(blurRadius: 1)]; + const textStyle = TextStyle(shadows: shadows); final TextStyle outputTextStyle = GoogleFonts.rancho(textStyle: textStyle); expect(outputTextStyle.shadows, equals(shadows)); @@ -529,7 +529,7 @@ void main() { testWidgets('shadows is honored when passed in as a top-level param', ( WidgetTester tester, ) async { - const List shadows = [Shadow(blurRadius: 2)]; + const shadows = [Shadow(blurRadius: 2)]; final TextStyle outputTextStyle = GoogleFonts.rancho(shadows: shadows); expect(outputTextStyle.shadows, equals(shadows)); @@ -537,9 +537,9 @@ void main() { testWidgets('shadows from the top-level param takes precedence over shadows ' 'from the TextStyle param', (WidgetTester tester) async { - const List shadows1 = [Shadow(blurRadius: 1)]; - const List shadows2 = [Shadow(blurRadius: 2)]; - const TextStyle textStyle = TextStyle(shadows: shadows1); + const shadows1 = [Shadow(blurRadius: 1)]; + const shadows2 = [Shadow(blurRadius: 2)]; + const textStyle = TextStyle(shadows: shadows1); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, shadows: shadows2, @@ -551,10 +551,10 @@ void main() { testWidgets( 'fontFeatures is honored when passed in via the TextStyle param', (WidgetTester tester) async { - const List fontFeatures = [ + const fontFeatures = [ FontFeature.slashedZero(), ]; - const TextStyle textStyle = TextStyle(fontFeatures: fontFeatures); + const textStyle = TextStyle(fontFeatures: fontFeatures); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, ); @@ -566,7 +566,7 @@ void main() { testWidgets('fontFeatures is honored when passed in as a top-level param', ( WidgetTester tester, ) async { - const List fontFeatures = [ + const fontFeatures = [ FontFeature.oldstyleFigures(), ]; final TextStyle outputTextStyle = GoogleFonts.rancho( @@ -578,13 +578,13 @@ void main() { testWidgets('fontFeatures from the top-level param takes precedence over ' 'fontFeatures from the TextStyle param', (WidgetTester tester) async { - const List fontFeatures1 = [ + const fontFeatures1 = [ FontFeature.slashedZero(), ]; - const List fontFeatures2 = [ + const fontFeatures2 = [ FontFeature.oldstyleFigures(), ]; - const TextStyle textStyle = TextStyle(fontFeatures: fontFeatures1); + const textStyle = TextStyle(fontFeatures: fontFeatures1); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, fontFeatures: fontFeatures2, @@ -597,7 +597,7 @@ void main() { WidgetTester tester, ) async { const TextDecoration decoration = TextDecoration.underline; - const TextStyle textStyle = TextStyle(decoration: decoration); + const textStyle = TextStyle(decoration: decoration); final TextStyle outputTextStyle = GoogleFonts.rancho(textStyle: textStyle); expect(outputTextStyle.decoration, equals(decoration)); @@ -618,7 +618,7 @@ void main() { 'decoration from the TextStyle param', (WidgetTester tester) async { const TextDecoration decoration1 = TextDecoration.underline; const TextDecoration decoration2 = TextDecoration.overline; - const TextStyle textStyle = TextStyle(decoration: decoration1); + const textStyle = TextStyle(decoration: decoration1); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, decoration: decoration2, @@ -630,7 +630,7 @@ void main() { testWidgets( 'decorationColor is honored when passed in via the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(decorationColor: Color(0xDEADBEEF)); + const textStyle = TextStyle(decorationColor: Color(0xDEADBEEF)); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, ); @@ -652,7 +652,7 @@ void main() { testWidgets('decorationColor from the top-level param takes precedence over ' 'decorationColor from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(decorationColor: Color(0xDEADBEEF)); + const textStyle = TextStyle(decorationColor: Color(0xDEADBEEF)); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, decorationColor: const Color(0xFACEFEED), @@ -664,7 +664,7 @@ void main() { testWidgets( 'decorationStyle is honored when passed in via the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle( + const textStyle = TextStyle( decorationStyle: TextDecorationStyle.dashed, ); final TextStyle outputTextStyle = GoogleFonts.rancho( @@ -691,7 +691,7 @@ void main() { testWidgets('decorationStyle from the top-level param takes precedence over ' 'decorationStyle from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle( + const textStyle = TextStyle( decorationStyle: TextDecorationStyle.dashed, ); final TextStyle outputTextStyle = GoogleFonts.rancho( @@ -705,7 +705,7 @@ void main() { testWidgets( 'decorationThickness is honored when passed in via the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(decorationThickness: 2); + const textStyle = TextStyle(decorationThickness: 2); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, ); @@ -729,7 +729,7 @@ void main() { 'decorationThickness from the top-level param takes precedence over ' 'decorationThickness from the TextStyle param', (WidgetTester tester) async { - const TextStyle textStyle = TextStyle(decorationThickness: 2); + const textStyle = TextStyle(decorationThickness: 2); final TextStyle outputTextStyle = GoogleFonts.rancho( textStyle: textStyle, decorationThickness: 3, @@ -747,7 +747,7 @@ void main() { WidgetTester tester, ) async { final TextTheme textTheme = GoogleFonts.oswaldTextTheme(); - const String expectedFamilyWithVariant = 'Oswald_regular'; + const expectedFamilyWithVariant = 'Oswald_regular'; expect( textTheme.displayLarge!.fontFamily, @@ -786,14 +786,14 @@ void main() { WidgetTester tester, ) async { // In app this is usually obtained by Theme.of(context).textTheme. - final TextTheme baseTextTheme = TextTheme( + final baseTextTheme = TextTheme( displaySmall: const TextStyle(fontWeight: FontWeight.w700), bodyMedium: GoogleFonts.acme(), titleSmall: const TextStyle(fontStyle: FontStyle.italic), ); final TextTheme textTheme = GoogleFonts.oswaldTextTheme(baseTextTheme); - const String expectedFamilyWithVariant = 'Oswald_regular'; + const expectedFamilyWithVariant = 'Oswald_regular'; // Default is preserved. expect( @@ -812,7 +812,7 @@ void main() { testWidgets('TextTheme equality when used in a ThemeData', ( WidgetTester tester, ) async { - final ThemeData myAppTheme = ThemeData( + final myAppTheme = ThemeData( textTheme: GoogleFonts.poppinsTextTheme(), ); @@ -828,7 +828,7 @@ void main() { ) async { final Iterable allFonts = GoogleFonts.asMap().keys; - for (final String fontFamily in allFonts) { + for (final fontFamily in allFonts) { final TextStyle dynamicFont = GoogleFonts.getFont(fontFamily); expect(dynamicFont.fontFamily, isNotNull); } @@ -848,7 +848,7 @@ void main() { ) async { final Iterable allFonts = GoogleFonts.asMap().keys; - for (final String fontFamily in allFonts) { + for (final fontFamily in allFonts) { final TextTheme dynamicFont = GoogleFonts.getTextTheme(fontFamily); expect(dynamicFont.bodyLarge!.fontFamily, isNotNull); } diff --git a/packages/google_fonts/test/google_fonts_family_with_variant_test.dart b/packages/google_fonts/test/google_fonts_family_with_variant_test.dart index d13213c88c1..4d79b4b1a00 100644 --- a/packages/google_fonts/test/google_fonts_family_with_variant_test.dart +++ b/packages/google_fonts/test/google_fonts_family_with_variant_test.dart @@ -9,7 +9,7 @@ import 'package:google_fonts/src/google_fonts_variant.dart'; void main() { testWidgets('toString() works for normal w400', (WidgetTester tester) async { - const GoogleFontsFamilyWithVariant familyWithVariant = + const familyWithVariant = GoogleFontsFamilyWithVariant( family: 'Foo', googleFontsVariant: GoogleFontsVariant( @@ -22,7 +22,7 @@ void main() { }); testWidgets('toString() works for italic w100', (WidgetTester tester) async { - const GoogleFontsFamilyWithVariant familyWithVariant = + const familyWithVariant = GoogleFontsFamilyWithVariant( family: 'Foo', googleFontsVariant: GoogleFontsVariant( @@ -37,7 +37,7 @@ void main() { testWidgets('toApiFilenamePrefix() works for italic w100', ( WidgetTester tester, ) async { - const GoogleFontsFamilyWithVariant familyWithVariant = + const familyWithVariant = GoogleFontsFamilyWithVariant( family: 'Foo', googleFontsVariant: GoogleFontsVariant( @@ -52,7 +52,7 @@ void main() { testWidgets('toApiFilenamePrefix() works for regular', ( WidgetTester tester, ) async { - const GoogleFontsFamilyWithVariant familyWithVariant = + const familyWithVariant = GoogleFontsFamilyWithVariant( family: 'Foo', googleFontsVariant: GoogleFontsVariant( diff --git a/packages/google_fonts/test/google_fonts_variant_test.dart b/packages/google_fonts/test/google_fonts_variant_test.dart index d447a1cd2b5..bbc1fb45857 100644 --- a/packages/google_fonts/test/google_fonts_variant_test.dart +++ b/packages/google_fonts/test/google_fonts_variant_test.dart @@ -8,7 +8,7 @@ import 'package:google_fonts/src/google_fonts_variant.dart'; void main() { testWidgets('toString() works for normal w400', (WidgetTester tester) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ); @@ -17,7 +17,7 @@ void main() { }); testWidgets('toString() works for italic w400', (WidgetTester tester) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w400, fontStyle: FontStyle.italic, ); @@ -26,7 +26,7 @@ void main() { }); testWidgets('toString() works for normal w500', (WidgetTester tester) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w500, fontStyle: FontStyle.normal, ); @@ -35,7 +35,7 @@ void main() { }); testWidgets('toString() works for italic w500', (WidgetTester tester) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w500, fontStyle: FontStyle.italic, ); @@ -44,7 +44,7 @@ void main() { }); testWidgets('fromString() works for regular', (WidgetTester tester) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ); @@ -53,7 +53,7 @@ void main() { }); testWidgets('fromString() works for italic', (WidgetTester tester) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w400, fontStyle: FontStyle.italic, ); @@ -62,7 +62,7 @@ void main() { }); testWidgets('fromString() works for 500', (WidgetTester tester) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w500, fontStyle: FontStyle.normal, ); @@ -71,7 +71,7 @@ void main() { }); testWidgets('fromString() works for 500italic', (WidgetTester tester) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w500, fontStyle: FontStyle.italic, ); @@ -422,21 +422,21 @@ void main() { testWidgets('== works for for identical variants', ( WidgetTester tester, ) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w500, fontStyle: FontStyle.italic, ); - const GoogleFontsVariant otherVariant = variant; + const otherVariant = variant; expect(variant == otherVariant, isTrue); }); testWidgets('== works for for clone variants', (WidgetTester tester) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w500, fontStyle: FontStyle.italic, ); - const GoogleFontsVariant otherVariant = GoogleFontsVariant( + const otherVariant = GoogleFontsVariant( fontWeight: FontWeight.w500, fontStyle: FontStyle.italic, ); @@ -446,11 +446,11 @@ void main() { testWidgets('== fails for different fontWeights', ( WidgetTester tester, ) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w500, fontStyle: FontStyle.italic, ); - const GoogleFontsVariant otherVariant = GoogleFontsVariant( + const otherVariant = GoogleFontsVariant( fontWeight: FontWeight.w900, fontStyle: FontStyle.italic, ); @@ -458,11 +458,11 @@ void main() { }); testWidgets('== fails for different fontStyles', (WidgetTester tester) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w500, fontStyle: FontStyle.italic, ); - const GoogleFontsVariant otherVariant = GoogleFontsVariant( + const otherVariant = GoogleFontsVariant( fontWeight: FontWeight.w500, fontStyle: FontStyle.normal, ); @@ -472,11 +472,11 @@ void main() { testWidgets('== fails for different fontWeights and different fontStyles', ( WidgetTester tester, ) async { - const GoogleFontsVariant variant = GoogleFontsVariant( + const variant = GoogleFontsVariant( fontWeight: FontWeight.w500, fontStyle: FontStyle.italic, ); - const GoogleFontsVariant otherVariant = GoogleFontsVariant( + const otherVariant = GoogleFontsVariant( fontWeight: FontWeight.w900, fontStyle: FontStyle.normal, ); diff --git a/packages/google_fonts/test/load_font_if_necessary_test.dart b/packages/google_fonts/test/load_font_if_necessary_test.dart index d3b64a69352..36d4946f142 100644 --- a/packages/google_fonts/test/load_font_if_necessary_test.dart +++ b/packages/google_fonts/test/load_font_if_necessary_test.dart @@ -102,7 +102,7 @@ final GoogleFontsDescriptor fakeDescriptorDifferentFile = GoogleFontsDescriptor( List printLog = []; void overridePrint(Future Function() testFn) => () { - final ZoneSpecification spec = ZoneSpecification( + final spec = ZoneSpecification( print: (_, __, ___, String msg) { // Add to log instead of printing to stdout printLog.add(msg); @@ -145,7 +145,7 @@ void main() { return http.Response('fake response body - failure', 300); }); - final GoogleFontsDescriptor descriptorInAssets = GoogleFontsDescriptor( + final descriptorInAssets = GoogleFontsDescriptor( familyWithVariant: const GoogleFontsFamilyWithVariant( family: 'Foo', googleFontsVariant: GoogleFontsVariant( @@ -168,7 +168,7 @@ void main() { }); test('does not call http if config is false', () async { - final GoogleFontsDescriptor fakeDescriptor = GoogleFontsDescriptor( + final fakeDescriptor = GoogleFontsDescriptor( familyWithVariant: const GoogleFontsFamilyWithVariant( family: 'Foo', googleFontsVariant: GoogleFontsVariant( @@ -202,7 +202,7 @@ void main() { test('loadFontIfNecessary method does not make http get request on ' 'subsequent calls', () async { - final GoogleFontsDescriptor fakeDescriptor = GoogleFontsDescriptor( + final fakeDescriptor = GoogleFontsDescriptor( familyWithVariant: const GoogleFontsFamilyWithVariant( family: 'Foo', googleFontsVariant: GoogleFontsVariant( @@ -228,7 +228,7 @@ void main() { test('loadFontIfNecessary does not make more than 1 http get request on ' 'parallel calls', () async { - final GoogleFontsDescriptor fakeDescriptor = GoogleFontsDescriptor( + final fakeDescriptor = GoogleFontsDescriptor( familyWithVariant: const GoogleFontsFamilyWithVariant( family: 'Foo', googleFontsVariant: GoogleFontsVariant( @@ -250,7 +250,7 @@ void main() { test( 'loadFontIfNecessary makes second attempt if the first attempt failed ', () async { - final GoogleFontsDescriptor fakeDescriptor = GoogleFontsDescriptor( + final fakeDescriptor = GoogleFontsDescriptor( familyWithVariant: const GoogleFontsFamilyWithVariant( family: 'Foo', googleFontsVariant: GoogleFontsVariant( @@ -298,7 +298,7 @@ void main() { final Directory directoryContents = await getApplicationSupportDirectory(); expect(directoryContents.listSync().isEmpty, isTrue); - final File cachedFile = File( + final cachedFile = File( '${directoryContents.path}/$expectedCachedFile', ); cachedFile.createSync(); @@ -319,7 +319,7 @@ void main() { final Directory directoryContents = await getApplicationSupportDirectory(); expect(directoryContents.listSync().isEmpty, isTrue); - final File cachedFile = File( + final cachedFile = File( '${directoryContents.path}/$expectedCachedFile', ); cachedFile.createSync(); @@ -351,7 +351,7 @@ void main() { when(mockHttpClient.gets(any)).thenAnswer((_) async { return http.Response('malicious intercepted response', 200); }); - final GoogleFontsDescriptor fakeDescriptor = GoogleFontsDescriptor( + final fakeDescriptor = GoogleFontsDescriptor( familyWithVariant: const GoogleFontsFamilyWithVariant( family: 'Foo', googleFontsVariant: GoogleFontsVariant( diff --git a/packages/google_fonts/test/load_font_if_necessary_with_local_fonts_test.dart b/packages/google_fonts/test/load_font_if_necessary_with_local_fonts_test.dart index df1abbe6128..f352c0bfc77 100644 --- a/packages/google_fonts/test/load_font_if_necessary_with_local_fonts_test.dart +++ b/packages/google_fonts/test/load_font_if_necessary_with_local_fonts_test.dart @@ -102,7 +102,7 @@ void main() { test('loadFontIfNecessary method does nothing if the font is in the ' 'Asset Manifest', () async { - final GoogleFontsDescriptor descriptorInAssets = GoogleFontsDescriptor( + final descriptorInAssets = GoogleFontsDescriptor( familyWithVariant: const GoogleFontsFamilyWithVariant( family: 'Foo', googleFontsVariant: GoogleFontsVariant( @@ -118,7 +118,7 @@ void main() { await loadFontIfNecessary(descriptorInAssets); verifyNever(mockHttpClient.gets(anything)); - final GoogleFontsDescriptor descriptorNotInAssets = GoogleFontsDescriptor( + final descriptorNotInAssets = GoogleFontsDescriptor( familyWithVariant: const GoogleFontsFamilyWithVariant( family: 'Bar', googleFontsVariant: GoogleFontsVariant( diff --git a/packages/google_identity_services_web/example/integration_test/js_interop_id_test.dart b/packages/google_identity_services_web/example/integration_test/js_interop_id_test.dart index 24e0b414ad4..1a12d0ab5ec 100644 --- a/packages/google_identity_services_web/example/integration_test/js_interop_id_test.dart +++ b/packages/google_identity_services_web/example/integration_test/js_interop_id_test.dart @@ -25,7 +25,7 @@ void main() async { group('renderButton', () { testWidgets('supports a js-interop target from any library', (_) async { - final web.HTMLDivElement target = + final target = web.document.createElement('div') as web.HTMLDivElement; id.renderButton(target); @@ -37,7 +37,7 @@ void main() async { group('IdConfig', () { testWidgets('passes values from Dart to JS', (_) async { - final IdConfiguration config = IdConfiguration( + final config = IdConfiguration( client_id: 'testing_1-2-3', auto_select: false, callback: (_) {}, @@ -93,7 +93,7 @@ void main() async { id.initialize(IdConfiguration(client_id: 'testing_1-2-3')); utils.setMockMomentNotification('skipped', 'user_cancel'); - final StreamController controller = + final controller = StreamController(); id.prompt(controller.add); @@ -112,7 +112,7 @@ void main() async { id.initialize(IdConfiguration(client_id: 'testing_1-2-3')); utils.setMockMomentNotification('skipped', 'random_invalid_reason'); - final StreamController controller = + final controller = StreamController(); id.prompt(controller.add); @@ -125,10 +125,10 @@ void main() async { ); testWidgets('calls config callback with credential response', (_) async { - const String expected = 'should_be_a_proper_jwt_token'; + const expected = 'should_be_a_proper_jwt_token'; utils.setMockCredentialResponse(expected); - final StreamController controller = + final controller = StreamController(); id.initialize( diff --git a/packages/google_identity_services_web/example/integration_test/js_interop_oauth_test.dart b/packages/google_identity_services_web/example/integration_test/js_interop_oauth_test.dart index f7bdbffcfff..b6017ce5596 100644 --- a/packages/google_identity_services_web/example/integration_test/js_interop_oauth_test.dart +++ b/packages/google_identity_services_web/example/integration_test/js_interop_oauth_test.dart @@ -24,7 +24,7 @@ void main() async { group('Config objects pass values from Dart to JS - ', () { testWidgets('TokenClientConfig', (_) async { - final TokenClientConfig config = TokenClientConfig( + final config = TokenClientConfig( client_id: 'testing_1-2-3', callback: (TokenResponse _) {}, scope: ['one', 'two', 'three'], @@ -53,7 +53,7 @@ void main() async { }); testWidgets('OverridableTokenClientConfig', (_) async { - final OverridableTokenClientConfig config = OverridableTokenClientConfig( + final config = OverridableTokenClientConfig( scope: ['one', 'two', 'three'], include_granted_scopes: true, prompt: 'some-prompt', @@ -74,7 +74,7 @@ void main() async { }); testWidgets('CodeClientConfig', (_) async { - final CodeClientConfig config = CodeClientConfig( + final config = CodeClientConfig( client_id: 'testing_1-2-3', scope: ['one', 'two', 'three'], include_granted_scopes: true, @@ -122,10 +122,10 @@ void main() async { group('requestAccessToken', () { testWidgets('passes through configuration', (_) async { - final StreamController controller = + final controller = StreamController(); - final List scopes = ['some_scope', 'another', 'more']; + final scopes = ['some_scope', 'another', 'more']; final TokenClient client = oauth2.initTokenClient( TokenClientConfig( @@ -147,10 +147,10 @@ void main() async { }); testWidgets('configuration can be overridden', (_) async { - final StreamController controller = + final controller = StreamController(); - final List scopes = ['some_scope', 'another', 'more']; + final scopes = ['some_scope', 'another', 'more']; final TokenClient client = oauth2.initTokenClient( TokenClientConfig( @@ -174,10 +174,10 @@ void main() async { group('hasGranted...Scopes', () { // mock-gis.js returns false for scopes that start with "not-granted-". - const String notGranted = 'not-granted-scope'; + const notGranted = 'not-granted-scope'; testWidgets('all scopes granted', (_) async { - final List scopes = ['some_scope', 'another', 'more']; + final scopes = ['some_scope', 'another', 'more']; final TokenResponse response = await utils.fakeAuthZWithScopes(scopes); @@ -189,7 +189,7 @@ void main() async { }); testWidgets('some scopes granted', (_) async { - final List scopes = ['some_scope', notGranted, 'more']; + final scopes = ['some_scope', notGranted, 'more']; final TokenResponse response = await utils.fakeAuthZWithScopes(scopes); @@ -201,7 +201,7 @@ void main() async { }); testWidgets('no scopes granted', (_) async { - final List scopes = [notGranted, '$notGranted-2']; + final scopes = [notGranted, '$notGranted-2']; final TokenResponse response = await utils.fakeAuthZWithScopes(scopes); diff --git a/packages/google_identity_services_web/example/integration_test/utils.dart b/packages/google_identity_services_web/example/integration_test/utils.dart index dfab149f73c..9b3e2c680db 100644 --- a/packages/google_identity_services_web/example/integration_test/utils.dart +++ b/packages/google_identity_services_web/example/integration_test/utils.dart @@ -53,9 +53,9 @@ Matcher isAJs(String thing) => isA().having( /// Installs mock-gis.js in the page. /// Returns a future that completes when the 'load' event of the script fires. Future installGisMock() { - final Completer completer = Completer(); + final completer = Completer(); - final web.HTMLScriptElement script = + final script = web.document.createElement('script') as web.HTMLScriptElement; script.src = 'mock-gis.js'; script.type = 'module'; @@ -72,7 +72,7 @@ Future installGisMock() { /// Fakes authorization with the given scopes. Future fakeAuthZWithScopes(List scopes) { - final StreamController controller = + final controller = StreamController(); final TokenClient client = oauth2.initTokenClient( TokenClientConfig( diff --git a/packages/google_identity_services_web/example/lib/main.dart b/packages/google_identity_services_web/example/lib/main.dart index 59aa5c05ab4..b1298028965 100644 --- a/packages/google_identity_services_web/example/lib/main.dart +++ b/packages/google_identity_services_web/example/lib/main.dart @@ -18,7 +18,7 @@ void main() async { // #enddocregion use-loader id.setLogLevel('debug'); - final IdConfiguration config = IdConfiguration( + final config = IdConfiguration( client_id: 'your-google-client-id-goes-here.apps.googleusercontent.com', callback: onCredentialResponse, use_fedcm_for_prompt: true, diff --git a/packages/google_identity_services_web/example/lib/main_oauth.dart b/packages/google_identity_services_web/example/lib/main_oauth.dart index bcfb38eaa29..135c52c1a41 100644 --- a/packages/google_identity_services_web/example/lib/main_oauth.dart +++ b/packages/google_identity_services_web/example/lib/main_oauth.dart @@ -35,14 +35,14 @@ void main() async { id.setLogLevel('debug'); - final TokenClientConfig config = TokenClientConfig( + final config = TokenClientConfig( client_id: 'your-google-client-id-goes-here.apps.googleusercontent.com', scope: scopes, callback: onTokenResponse, error_callback: onError, ); - final OverridableTokenClientConfig overridableCfg = + final overridableCfg = OverridableTokenClientConfig(scope: scopes + myConnectionsScopes); final TokenClient client = oauth2.initTokenClient(config); diff --git a/packages/google_identity_services_web/lib/src/js_interop/shared.dart b/packages/google_identity_services_web/lib/src/js_interop/shared.dart index 51aeb88e0d4..a1367f4c3eb 100644 --- a/packages/google_identity_services_web/lib/src/js_interop/shared.dart +++ b/packages/google_identity_services_web/lib/src/js_interop/shared.dart @@ -9,7 +9,7 @@ T? maybeEnum(String? needle, List haystack) { if (needle == null) { return null; } - for (final T value in haystack) { + for (final value in haystack) { if (value.name == needle) { return value; } diff --git a/packages/google_identity_services_web/lib/src/js_loader.dart b/packages/google_identity_services_web/lib/src/js_loader.dart index e1712ebd7db..04798d043ca 100644 --- a/packages/google_identity_services_web/lib/src/js_loader.dart +++ b/packages/google_identity_services_web/lib/src/js_loader.dart @@ -33,7 +33,7 @@ Future loadWebSdk({ String trustedTypePolicyName = _defaultTrustedPolicyName, String? nonce = _undefined, }) { - final Completer completer = Completer(); + final completer = Completer(); onGoogleLibraryLoad = () => completer.complete(); // If TrustedTypes are available, prepare a trusted URL. @@ -55,7 +55,7 @@ Future loadWebSdk({ } } - final web.HTMLScriptElement script = web.HTMLScriptElement() + final script = web.HTMLScriptElement() ..async = true ..defer = true; if (trustedUrl != null) { @@ -88,7 +88,7 @@ String? _getNonce({String? suppliedNonce, web.Window? window}) { 'script', ); - for (int i = 0; i < elements.length; i++) { + for (var i = 0; i < elements.length; i++) { if (elements.item(i) case final web.HTMLScriptElement element) { // Chrome may return an empty string instead of null. final String nonce = diff --git a/packages/google_identity_services_web/test/js_loader_test.dart b/packages/google_identity_services_web/test/js_loader_test.dart index 9dc836800c7..3bf8c2d1125 100644 --- a/packages/google_identity_services_web/test/js_loader_test.dart +++ b/packages/google_identity_services_web/test/js_loader_test.dart @@ -25,7 +25,7 @@ import 'package:web/web.dart' as web; void main() { group('loadWebSdk (no TrustedTypes)', () { - final web.HTMLDivElement target = web.HTMLDivElement(); + final target = web.HTMLDivElement(); tearDown(() { target.replaceChildren([].toJS); @@ -41,7 +41,7 @@ void main() { expect(injected, isNotNull); expect(injected, isA()); - final web.HTMLScriptElement script = injected! as web.HTMLScriptElement; + final script = injected! as web.HTMLScriptElement; expect(script.defer, isTrue); expect(script.async, isTrue); expect(script.src, 'https://accounts.google.com/gsi/client'); @@ -60,18 +60,18 @@ void main() { group('`nonce` parameter', () { test('can be set', () async { - const String expectedNonce = 'some-random-nonce'; + const expectedNonce = 'some-random-nonce'; unawaited(loadWebSdk(target: target, nonce: expectedNonce)); // Target now should have a child that is a script element - final web.HTMLScriptElement script = + final script = target.firstElementChild! as web.HTMLScriptElement; expect(script.nonce, expectedNonce); }); test('defaults to a nonce set in other script of the page', () async { - const String expectedNonce = 'another-random-nonce'; - final web.HTMLScriptElement otherScript = web.HTMLScriptElement() + const expectedNonce = 'another-random-nonce'; + final otherScript = web.HTMLScriptElement() ..nonce = expectedNonce; web.document.head?.appendChild(otherScript); @@ -80,7 +80,7 @@ void main() { unawaited(loadWebSdk(target: target)); // Target now should have a child that is a script element - final web.HTMLScriptElement script = + final script = target.firstElementChild! as web.HTMLScriptElement; expect(script.nonce, expectedNonce); @@ -88,8 +88,8 @@ void main() { }); test('when explicitly set overrides the default', () async { - const String expectedNonce = 'third-random-nonce'; - final web.HTMLScriptElement otherScript = web.HTMLScriptElement() + const expectedNonce = 'third-random-nonce'; + final otherScript = web.HTMLScriptElement() ..nonce = 'this-is-the-wrong-nonce'; web.document.head?.appendChild(otherScript); @@ -98,7 +98,7 @@ void main() { unawaited(loadWebSdk(target: target, nonce: expectedNonce)); // Target now should have a child that is a script element - final web.HTMLScriptElement script = + final script = target.firstElementChild! as web.HTMLScriptElement; expect(script.nonce, expectedNonce); @@ -106,7 +106,7 @@ void main() { }); test('when null disables the feature', () async { - final web.HTMLScriptElement otherScript = web.HTMLScriptElement() + final otherScript = web.HTMLScriptElement() ..nonce = 'this-is-the-wrong-nonce'; web.document.head?.appendChild(otherScript); @@ -115,7 +115,7 @@ void main() { unawaited(loadWebSdk(target: target, nonce: null)); // Target now should have a child that is a script element - final web.HTMLScriptElement script = + final script = target.firstElementChild! as web.HTMLScriptElement; expect(script.nonce, isEmpty); diff --git a/packages/google_identity_services_web/test/js_loader_tt_custom_test.dart b/packages/google_identity_services_web/test/js_loader_tt_custom_test.dart index d06041f1a1f..b1aaadb1183 100644 --- a/packages/google_identity_services_web/test/js_loader_tt_custom_test.dart +++ b/packages/google_identity_services_web/test/js_loader_tt_custom_test.dart @@ -23,7 +23,7 @@ import 'tools.dart'; void main() { group('loadWebSdk (TrustedTypes configured)', () { - final web.HTMLDivElement target = + final target = web.document.createElement('div') as web.HTMLDivElement; injectMetaTag({ 'http-equiv': 'Content-Security-Policy', diff --git a/packages/google_identity_services_web/test/js_loader_tt_forbidden_test.dart b/packages/google_identity_services_web/test/js_loader_tt_forbidden_test.dart index 9ba347dd6bc..9e942c48ec5 100644 --- a/packages/google_identity_services_web/test/js_loader_tt_forbidden_test.dart +++ b/packages/google_identity_services_web/test/js_loader_tt_forbidden_test.dart @@ -23,7 +23,7 @@ import 'tools.dart'; void main() { group('loadWebSdk (TrustedTypes forbidden)', () { - final web.HTMLDivElement target = + final target = web.document.createElement('div') as web.HTMLDivElement; injectMetaTag({ 'http-equiv': 'Content-Security-Policy', diff --git a/packages/google_identity_services_web/test/tools.dart b/packages/google_identity_services_web/test/tools.dart index fd7e61957f7..2a98c1b7ab2 100644 --- a/packages/google_identity_services_web/test/tools.dart +++ b/packages/google_identity_services_web/test/tools.dart @@ -6,7 +6,7 @@ import 'package:web/web.dart' as web; /// Injects a `` tag with the provided [attributes] into the [web.document]. void injectMetaTag(Map attributes) { - final web.HTMLMetaElement meta = + final meta = web.document.createElement('meta') as web.HTMLMetaElement; for (final MapEntry attribute in attributes.entries) { meta.setAttribute(attribute.key, attribute.value); diff --git a/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/maps_controller.dart b/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/maps_controller.dart index adaee6429af..d4d8f8f1faf 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/maps_controller.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/maps_controller.dart @@ -26,7 +26,7 @@ void runTests() { (WidgetTester tester) async { await tester.binding.setSurfaceSize(const Size(800, 600)); - final Completer mapControllerCompleter = + final mapControllerCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -88,12 +88,12 @@ void runTests() { 'testGetVisibleRegion', (WidgetTester tester) async { final Key key = GlobalKey(); - final LatLngBounds zeroLatLngBounds = LatLngBounds( + final zeroLatLngBounds = LatLngBounds( southwest: const LatLng(0, 0), northeast: const LatLng(0, 0), ); - final Completer mapControllerCompleter = + final mapControllerCompleter = Completer(); await pumpMap( @@ -123,15 +123,15 @@ void runTests() { // Making a new `LatLngBounds` about (10, 10) distance south west to the `firstVisibleRegion`. // The size of the `LatLngBounds` is 10 by 10. - final LatLng southWest = LatLng( + final southWest = LatLng( firstVisibleRegion.southwest.latitude - 20, firstVisibleRegion.southwest.longitude - 20, ); - final LatLng northEast = LatLng( + final northEast = LatLng( firstVisibleRegion.southwest.latitude - 10, firstVisibleRegion.southwest.longitude - 10, ); - final LatLng newCenter = LatLng( + final newCenter = LatLng( (northEast.latitude + southWest.latitude) / 2, (northEast.longitude + southWest.longitude) / 2, ); @@ -139,7 +139,7 @@ void runTests() { expect(firstVisibleRegion.contains(northEast), isFalse); expect(firstVisibleRegion.contains(southWest), isFalse); - final LatLngBounds latLngBounds = LatLngBounds( + final latLngBounds = LatLngBounds( southwest: southWest, northeast: northEast, ); @@ -166,7 +166,7 @@ void runTests() { testWidgets('testSetMapStyle valid Json String', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await pumpMap( @@ -181,7 +181,7 @@ void runTests() { ); final GoogleMapController controller = await controllerCompleter.future; - const String mapStyle = + const mapStyle = '[{"elementType":"geometry","stylers":[{"color":"#242f3e"}]}]'; // Intentionally testing the deprecated code path. // ignore: deprecated_member_use @@ -192,7 +192,7 @@ void runTests() { WidgetTester tester, ) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await pumpMap( @@ -219,7 +219,7 @@ void runTests() { testWidgets('testSetMapStyle null string', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await pumpMap( @@ -241,7 +241,7 @@ void runTests() { testWidgets('testGetLatLng', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await pumpMap( @@ -266,7 +266,7 @@ void runTests() { final LatLng topLeft = await controller.getLatLng( const ScreenCoordinate(x: 0, y: 0), ); - final LatLng northWest = LatLng( + final northWest = LatLng( visibleRegion.northeast.latitude, visibleRegion.southwest.longitude, ); @@ -278,7 +278,7 @@ void runTests() { 'testGetZoomLevel', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await pumpMap( @@ -315,7 +315,7 @@ void runTests() { 'testScreenCoordinate', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await pumpMap( @@ -337,7 +337,7 @@ void runTests() { await Future.delayed(const Duration(seconds: 1)); final LatLngBounds visibleRegion = await controller.getVisibleRegion(); - final LatLng northWest = LatLng( + final northWest = LatLng( visibleRegion.northeast.latitude, visibleRegion.southwest.longitude, ); @@ -351,7 +351,7 @@ void runTests() { ); testWidgets('testResizeWidget', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); await pumpMap( @@ -392,13 +392,13 @@ void runTests() { }); testWidgets('testToggleInfoWindow', (WidgetTester tester) async { - const Marker marker = Marker( + const marker = Marker( markerId: MarkerId('marker'), infoWindow: InfoWindow(title: 'InfoWindow'), ); - final Set markers = {marker}; + final markers = {marker}; - final Completer controllerCompleter = + final controllerCompleter = Completer(); await pumpMap( @@ -444,7 +444,7 @@ void runTests() { }); testWidgets('markerWithAssetMapBitmap', (WidgetTester tester) async { - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: AssetMapBitmap('assets/red_square.png', imagePixelRatio: 1.0), @@ -460,10 +460,10 @@ void runTests() { }); testWidgets('markerWithAssetMapBitmapCreate', (WidgetTester tester) async { - final ImageConfiguration imageConfiguration = ImageConfiguration( + final imageConfiguration = ImageConfiguration( devicePixelRatio: tester.view.devicePixelRatio, ); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: await AssetMapBitmap.create( @@ -483,7 +483,7 @@ void runTests() { testWidgets('markerWithBytesMapBitmap', (WidgetTester tester) async { final Uint8List bytes = const Base64Decoder().convert(iconImageBase64); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: BytesMapBitmap( @@ -503,11 +503,11 @@ void runTests() { testWidgets('markerWithLegacyAsset', (WidgetTester tester) async { tester.view.devicePixelRatio = 2.0; - final ImageConfiguration imageConfiguration = ImageConfiguration( + final imageConfiguration = ImageConfiguration( devicePixelRatio: tester.view.devicePixelRatio, size: const Size(100, 100), ); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), // Intentionally testing the deprecated code path. @@ -532,7 +532,7 @@ void runTests() { testWidgets('markerWithLegacyBytes', (WidgetTester tester) async { tester.view.devicePixelRatio = 2.0; final Uint8List bytes = const Base64Decoder().convert(iconImageBase64); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), // Intentionally testing the deprecated code path. @@ -554,7 +554,7 @@ void runTests() { testWidgets( 'testTakeSnapshot', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); await pumpMap( @@ -579,7 +579,7 @@ void runTests() { ); testWidgets('testCloudMapId', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); await pumpMap( @@ -601,7 +601,7 @@ void runTests() { testWidgets('getStyleError reports last error', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await pumpMap( @@ -638,7 +638,7 @@ Future waitForValueMatchingPredicate( bool Function(T) predicate, { int maxTries = 100, }) async { - for (int i = 0; i < maxTries; i++) { + for (var i = 0; i < maxTries; i++) { final T value = await getValue(); if (predicate(value)) { return value; diff --git a/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/maps_inspector.dart b/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/maps_inspector.dart index 501be0233b6..9d857adbdf2 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/maps_inspector.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/maps_inspector.dart @@ -43,7 +43,7 @@ void runTests() { testWidgets('testCompassToggle', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, GoogleMap( @@ -77,7 +77,7 @@ void runTests() { testWidgets('testMapToolbarToggle', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -122,11 +122,11 @@ void runTests() { // // Thus we test iOS and Android a little differently here. final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); - const MinMaxZoomPreference initialZoomLevel = MinMaxZoomPreference(4, 8); - const MinMaxZoomPreference finalZoomLevel = MinMaxZoomPreference(6, 10); + const initialZoomLevel = MinMaxZoomPreference(4, 8); + const finalZoomLevel = MinMaxZoomPreference(6, 10); await pumpMap( tester, @@ -189,7 +189,7 @@ void runTests() { testWidgets('testZoomGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -226,7 +226,7 @@ void runTests() { testWidgets('testZoomControlsEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -268,7 +268,7 @@ void runTests() { testWidgets('testLiteModeEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -303,7 +303,7 @@ void runTests() { testWidgets('testRotateGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -342,7 +342,7 @@ void runTests() { testWidgets('testTiltGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -379,7 +379,7 @@ void runTests() { testWidgets('testScrollGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -418,7 +418,7 @@ void runTests() { testWidgets('testTraffic', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -453,7 +453,7 @@ void runTests() { testWidgets('testBuildings', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -478,7 +478,7 @@ void runTests() { group('MyLocationButton', () { testWidgets('testMyLocationButtonToggle', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -519,7 +519,7 @@ void runTests() { WidgetTester tester, ) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -543,7 +543,7 @@ void runTests() { WidgetTester tester, ) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await pumpMap( tester, @@ -565,27 +565,27 @@ void runTests() { testWidgets('marker clustering', (WidgetTester tester) async { final Key key = GlobalKey(); - const int clusterManagersAmount = 2; - const int markersPerClusterManager = 5; - final Map markers = {}; - final Set clusterManagers = {}; + const clusterManagersAmount = 2; + const markersPerClusterManager = 5; + final markers = {}; + final clusterManagers = {}; - for (int i = 0; i < clusterManagersAmount; i++) { - final ClusterManagerId clusterManagerId = ClusterManagerId( + for (var i = 0; i < clusterManagersAmount; i++) { + final clusterManagerId = ClusterManagerId( 'cluster_manager_$i', ); - final ClusterManager clusterManager = ClusterManager( + final clusterManager = ClusterManager( clusterManagerId: clusterManagerId, ); clusterManagers.add(clusterManager); } - for (final ClusterManager cm in clusterManagers) { - for (int i = 0; i < markersPerClusterManager; i++) { - final MarkerId markerId = MarkerId( + for (final cm in clusterManagers) { + for (var i = 0; i < markersPerClusterManager; i++) { + final markerId = MarkerId( '${cm.clusterManagerId.value}_marker_$i', ); - final Marker marker = Marker( + final marker = Marker( markerId: markerId, clusterManagerId: cm.clusterManagerId, position: LatLng( @@ -597,7 +597,7 @@ void runTests() { } } - final Completer controllerCompleter = + final controllerCompleter = Completer(); await pumpMap( @@ -618,7 +618,7 @@ void runTests() { final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; - for (final ClusterManager cm in clusterManagers) { + for (final cm in clusterManagers) { final List clusters = await inspector.getClusters( mapId: controller.mapId, clusterManagerId: cm.clusterManagerId, @@ -644,7 +644,7 @@ void runTests() { ), ); - for (final ClusterManager cm in clusterManagers) { + for (final cm in clusterManagers) { final List clusters = await inspector.getClusters( mapId: controller.mapId, clusterManagerId: cm.clusterManagerId, @@ -657,7 +657,7 @@ void runTests() { 'testAnimateCameraWithoutDuration', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; @@ -762,7 +762,7 @@ void runTests() { 'testAnimateCameraWithDuration', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; @@ -770,8 +770,8 @@ void runTests() { /// Completer to track when the camera has come to rest. Completer? cameraIdleCompleter; - const int shortCameraAnimationDurationMS = 200; - const int longCameraAnimationDurationMS = 1000; + const shortCameraAnimationDurationMS = 200; + const longCameraAnimationDurationMS = 1000; /// Calculate the midpoint duration of the animation test, which will /// serve as a reference to verify that animations complete more quickly @@ -780,7 +780,7 @@ void runTests() { (shortCameraAnimationDurationMS + longCameraAnimationDurationMS) ~/ 2; // Stopwatch to measure the time taken for the animation to complete. - final Stopwatch stopwatch = Stopwatch(); + final stopwatch = Stopwatch(); await tester.pumpWidget( Directionality( @@ -980,7 +980,7 @@ Future _checkCameraUpdateByType( ) async { // As the target might differ a bit from the expected target, a threshold is // used. - const double latLngThreshold = 0.05; + const latLngThreshold = 0.05; switch (type) { case CameraUpdateType.newCameraPosition: diff --git a/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/tiles_inspector.dart b/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/tiles_inspector.dart index 079ac894192..c6641a806b2 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/tiles_inspector.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/integration_test/src/tiles_inspector.dart @@ -21,7 +21,7 @@ void main() { } void runTests() { - const double floatTolerance = 1e-6; + const floatTolerance = 1e-6; GoogleMapsFlutterPlatform.instance.enableDebugInspection(); @@ -30,15 +30,15 @@ void runTests() { group('Tiles', () { testWidgets('set tileOverlay correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); - final TileOverlay tileOverlay1 = TileOverlay( + final mapIdCompleter = Completer(); + final tileOverlay1 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 2, transparency: 0.2, ); - final TileOverlay tileOverlay2 = TileOverlay( + final tileOverlay2 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_2'), tileProvider: _DebugTileProvider(), zIndex: 1, @@ -89,16 +89,16 @@ void runTests() { }); testWidgets('update tileOverlays correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); - final TileOverlay tileOverlay1 = TileOverlay( + final tileOverlay1 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 2, transparency: 0.2, ); - final TileOverlay tileOverlay2 = TileOverlay( + final tileOverlay2 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_2'), tileProvider: _DebugTileProvider(), zIndex: 3, @@ -120,7 +120,7 @@ void runTests() { final int mapId = await mapIdCompleter.future; - final TileOverlay tileOverlay1New = TileOverlay( + final tileOverlay1New = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 1, @@ -166,9 +166,9 @@ void runTests() { }); testWidgets('remove tileOverlays correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); - final TileOverlay tileOverlay1 = TileOverlay( + final tileOverlay1 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 2, @@ -221,7 +221,7 @@ void runTests() { List data2, ) { expect(data1.length, data2.length); - for (int i = 0; i < data1.length; i++) { + for (var i = 0; i < data1.length; i++) { final WeightedLatLng wll1 = data1[i]; final WeightedLatLng wll2 = data2[i]; expect(wll1.weight, wll2.weight); @@ -242,7 +242,7 @@ void runTests() { expect(gradient2, isNotNull); expect(gradient1.colors.length, gradient2.colors.length); - for (int i = 0; i < gradient1.colors.length; i++) { + for (var i = 0; i < gradient1.colors.length; i++) { final HeatmapGradientColor color1 = gradient1.colors[i]; final HeatmapGradientColor color2 = gradient2.colors[i]; expect(color1.color, color2.color); @@ -288,7 +288,7 @@ void runTests() { } } - const Heatmap heatmap1 = Heatmap( + const heatmap1 = Heatmap( heatmapId: HeatmapId('heatmap_1'), data: [ WeightedLatLng(LatLng(37.782, -122.447)), @@ -322,8 +322,8 @@ void runTests() { ); testWidgets('set heatmap correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); - final Heatmap heatmap2 = Heatmap( + final mapIdCompleter = Completer(); + final heatmap2 = Heatmap( heatmapId: const HeatmapId('heatmap_2'), data: heatmap1.data, dissipating: heatmap1.dissipating, @@ -369,7 +369,7 @@ void runTests() { }); testWidgets('update heatmaps correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -429,7 +429,7 @@ void runTests() { }); testWidgets('remove heatmaps correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -478,12 +478,12 @@ void runTests() { }); group('GroundOverlay', () { - final LatLngBounds kGroundOverlayBounds = LatLngBounds( + final kGroundOverlayBounds = LatLngBounds( southwest: const LatLng(37.77483, -122.41942), northeast: const LatLng(37.78183, -122.39105), ); - final GroundOverlay groundOverlayBounds1 = GroundOverlay.fromBounds( + final groundOverlayBounds1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('bounds_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -496,7 +496,7 @@ void runTests() { zIndex: 10, ); - final GroundOverlay groundOverlayPosition1 = GroundOverlay.fromPosition( + final groundOverlayPosition1 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('position_1'), position: kGroundOverlayBounds.northeast, width: 100, @@ -573,8 +573,8 @@ void runTests() { } testWidgets('set ground overlays correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); - final GroundOverlay groundOverlayBounds2 = GroundOverlay.fromBounds( + final mapIdCompleter = Completer(); + final groundOverlayBounds2 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('bounds_2'), bounds: groundOverlayBounds1.bounds!, image: groundOverlayBounds1.image, @@ -636,7 +636,7 @@ void runTests() { testWidgets('update ground overlays correctly', ( WidgetTester tester, ) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -728,7 +728,7 @@ void runTests() { testWidgets('remove ground overlays correctly', ( WidgetTester tester, ) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -803,10 +803,10 @@ class _DebugTileProvider implements TileProvider { @override Future getTile(int x, int y, int? zoom) async { - final ui.PictureRecorder recorder = ui.PictureRecorder(); - final Canvas canvas = Canvas(recorder); - final TextSpan textSpan = TextSpan(text: '$x,$y', style: textStyle); - final TextPainter textPainter = TextPainter( + final recorder = ui.PictureRecorder(); + final canvas = Canvas(recorder); + final textSpan = TextSpan(text: '$x,$y', style: textStyle); + final textPainter = TextPainter( text: textSpan, textDirection: TextDirection.ltr, ); diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/clustering.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/clustering.dart index 0a22df4fdaa..75872debd1a 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/clustering.dart @@ -116,14 +116,14 @@ class ClusteringBodyState extends State { return; } - final String clusterManagerIdVal = + final clusterManagerIdVal = 'cluster_manager_id_$_clusterManagerIdCounter'; _clusterManagerIdCounter++; - final ClusterManagerId clusterManagerId = ClusterManagerId( + final clusterManagerId = ClusterManagerId( clusterManagerIdVal, ); - final ClusterManager clusterManager = ClusterManager( + final clusterManager = ClusterManager( clusterManagerId: clusterManagerId, onClusterTap: (Cluster cluster) => setState(() { lastCluster = cluster; @@ -149,11 +149,11 @@ class ClusteringBodyState extends State { } void _addMarkersToCluster(ClusterManager clusterManager) { - for (int i = 0; i < _markersToAddToClusterManagerCount; i++) { - final String markerIdVal = + for (var i = 0; i < _markersToAddToClusterManagerCount; i++) { + final markerIdVal = '${clusterManager.clusterManagerId.value}_marker_id_$_markerIdCounter'; _markerIdCounter++; - final MarkerId markerId = MarkerId(markerIdVal); + final markerId = MarkerId(markerIdVal); final int clusterManagerIndex = clusterManagers.values.toList().indexOf( clusterManager, @@ -164,7 +164,7 @@ class ClusteringBodyState extends State { final double clusterManagerLongitudeOffset = clusterManagerIndex * _clusterManagerLongitudeOffset; - final Marker marker = Marker( + final marker = Marker( clusterManagerId: clusterManager.clusterManagerId, markerId: markerId, position: LatLng( diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/custom_marker_icon.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/custom_marker_icon.dart index 6206787f347..548146c6206 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/custom_marker_icon.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/custom_marker_icon.dart @@ -9,9 +9,9 @@ import 'package:flutter/material.dart'; /// Returns a generated png image in [ByteData] format with the requested size. Future createCustomMarkerIconImage({required Size size}) async { - final ui.PictureRecorder recorder = ui.PictureRecorder(); - final Canvas canvas = Canvas(recorder); - final _MarkerPainter painter = _MarkerPainter(); + final recorder = ui.PictureRecorder(); + final canvas = Canvas(recorder); + final painter = _MarkerPainter(); painter.paint(canvas, size); @@ -30,7 +30,7 @@ class _MarkerPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { final Rect rect = Offset.zero & size; - const RadialGradient gradient = RadialGradient( + const gradient = RadialGradient( colors: [Colors.yellow, Colors.red], stops: [0.4, 1.0], ); diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/ground_overlay.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/ground_overlay.dart index 2b5772af8b8..986820a8de5 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/ground_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/ground_overlay.dart @@ -95,7 +95,7 @@ class GroundOverlayBodyState extends State { _groundOverlayIndex += 1; - final GroundOverlayId id = GroundOverlayId( + final id = GroundOverlayId( 'ground_overlay_$_groundOverlayIndex', ); @@ -146,7 +146,7 @@ class GroundOverlayBodyState extends State { void _changeTransparency() { assert(_groundOverlay != null); setState(() { - final double transparency = _groundOverlay!.transparency == 0.0 + final transparency = _groundOverlay!.transparency == 0.0 ? 0.5 : 0.0; _groundOverlay = _groundOverlay!.copyWith( @@ -242,7 +242,7 @@ class GroundOverlayBodyState extends State { @override Widget build(BuildContext context) { - final Set overlays = { + final overlays = { if (_groundOverlay != null) _groundOverlay!, }; return Column( diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart index 8b33fc9ddaf..bbb51991815 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart @@ -103,7 +103,7 @@ Future initializeMapRenderer() async { return _initializedRendererCompleter!.future; } - final Completer completer = + final completer = Completer(); _initializedRendererCompleter = completer; diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart index a426ec8bea2..b80c545b109 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart @@ -39,7 +39,7 @@ class _MapClickBodyState extends State<_MapClickBody> { @override Widget build(BuildContext context) { - final GoogleMap googleMap = GoogleMap( + final googleMap = GoogleMap( onMapCreated: onMapCreated, initialCameraPosition: _kInitialPosition, onTap: (LatLng pos) { @@ -54,7 +54,7 @@ class _MapClickBodyState extends State<_MapClickBody> { }, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( @@ -64,8 +64,8 @@ class _MapClickBodyState extends State<_MapClickBody> { ]; if (mapController != null) { - final String lastTap = 'Tap:\n${_lastTap ?? ""}\n'; - final String lastLongPress = 'Long press:\n${_lastLongPress ?? ""}'; + final lastTap = 'Tap:\n${_lastTap ?? ""}\n'; + final lastLongPress = 'Long press:\n${_lastLongPress ?? ""}'; columnChildren.add( Center(child: Text(lastTap, textAlign: TextAlign.center)), ); diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart index 2b20bbeda75..3a8d282c67a 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart @@ -41,7 +41,7 @@ class _MapCoordinatesBodyState extends State<_MapCoordinatesBody> { @override Widget build(BuildContext context) { - final GoogleMap googleMap = GoogleMap( + final googleMap = GoogleMap( onMapCreated: onMapCreated, initialCameraPosition: _kInitialPosition, onCameraIdle: diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart index d9befb15a88..16bb9f1a21a 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart @@ -74,7 +74,7 @@ class MapIdBodyState extends State { @override Widget build(BuildContext context) { - final GoogleMap googleMap = GoogleMap( + final googleMap = GoogleMap( onMapCreated: _onMapCreated, initialCameraPosition: const CameraPosition( target: _kMapCenter, @@ -84,7 +84,7 @@ class MapIdBodyState extends State { cloudMapId: _mapId, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart index 3afa4a596f4..d954ee7d3c7 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart @@ -325,7 +325,7 @@ class MapUiBodyState extends State { @override Widget build(BuildContext context) { - final GoogleMap googleMap = GoogleMap( + final googleMap = GoogleMap( webCameraControlEnabled: _webCameraControlEnabled, webCameraControlPosition: _webCameraControlPosition, onMapCreated: onMapCreated, @@ -348,7 +348,7 @@ class MapUiBodyState extends State { onCameraMove: _updateCameraPosition, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart index 303adcce686..2e239cc9903 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart @@ -209,7 +209,7 @@ class MarkerIconsBodyState extends State { } Marker _createAssetMarker(int index) { - final LatLng position = LatLng( + final position = LatLng( _kMapCenter.latitude - (index * 0.5), _kMapCenter.longitude - 1, ); @@ -222,7 +222,7 @@ class MarkerIconsBodyState extends State { } Marker _createBytesMarker(int index) { - final LatLng position = LatLng( + final position = LatLng( _kMapCenter.latitude - (index * 0.5), _kMapCenter.longitude + 1, ); @@ -235,8 +235,8 @@ class MarkerIconsBodyState extends State { } void _updateMarkers() { - final Set markers = {}; - for (int i = 0; i < _markersAmountPerType; i++) { + final markers = {}; + for (var i = 0; i < _markersAmountPerType; i++) { if (_markerIconAsset != null) { markers.add(_createAssetMarker(i)); } @@ -298,7 +298,7 @@ class MarkerIconsBodyState extends State { final double? imagePixelRatio = _scalingEnabled ? devicePixelRatio : null; // Create canvasSize with physical marker size - final Size canvasSize = Size( + final canvasSize = Size( bitmapLogicalSize.width * (imagePixelRatio ?? 1.0), bitmapLogicalSize.height * (imagePixelRatio ?? 1.0), ); @@ -313,7 +313,7 @@ class MarkerIconsBodyState extends State { ? _getCurrentMarkerSize() : (null, null); - final BytesMapBitmap bitmap = BytesMapBitmap( + final bitmap = BytesMapBitmap( bytes.buffer.asUint8List(), imagePixelRatio: imagePixelRatio, width: width, diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart index 65a98d6a775..c5d224144a5 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart @@ -34,7 +34,7 @@ class MarkerIconsBodyState extends State { @override Widget build(BuildContext context) { - final GoogleMap googleMap = GoogleMap( + final googleMap = GoogleMap( onMapCreated: _onMapCreated, initialCameraPosition: const CameraPosition( target: _kMapCenter, @@ -43,7 +43,7 @@ class MarkerIconsBodyState extends State { padding: _padding, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart index 44f3d23f28c..b8a6b88fefb 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart @@ -82,11 +82,11 @@ class PlaceCircleBodyState extends State { return; } - final String circleIdVal = 'circle_id_$_circleIdCounter'; + final circleIdVal = 'circle_id_$_circleIdCounter'; _circleIdCounter++; - final CircleId circleId = CircleId(circleIdVal); + final circleId = CircleId(circleIdVal); - final Circle circle = Circle( + final circle = Circle( circleId: circleId, consumeTapEvents: true, strokeColor: Colors.orange, diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart index 96ff31d0a3a..4c4b71ca175 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart @@ -122,11 +122,11 @@ class PlaceMarkerBodyState extends State { return; } - final String markerIdVal = 'marker_id_$_markerIdCounter'; + final markerIdVal = 'marker_id_$_markerIdCounter'; _markerIdCounter++; - final MarkerId markerId = MarkerId(markerIdVal); + final markerId = MarkerId(markerIdVal); - final Marker marker = Marker( + final marker = Marker( markerId: markerId, position: LatLng( center.latitude + sin(_markerIdCounter * pi / 6.0) / 20.0, @@ -154,7 +154,7 @@ class PlaceMarkerBodyState extends State { void _changePosition(MarkerId markerId) { final Marker marker = markers[markerId]!; final LatLng current = marker.position; - final Offset offset = Offset( + final offset = Offset( center.latitude - current.latitude, center.longitude - current.longitude, ); @@ -171,7 +171,7 @@ class PlaceMarkerBodyState extends State { void _changeAnchor(MarkerId markerId) { final Marker marker = markers[markerId]!; final Offset currentAnchor = marker.anchor; - final Offset newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); + final newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); setState(() { markers[markerId] = marker.copyWith(anchorParam: newAnchor); }); @@ -180,7 +180,7 @@ class PlaceMarkerBodyState extends State { Future _changeInfoAnchor(MarkerId markerId) async { final Marker marker = markers[markerId]!; final Offset currentAnchor = marker.infoWindow.anchor; - final Offset newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); + final newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); setState(() { markers[markerId] = marker.copyWith( infoWindowParam: marker.infoWindow.copyWith(anchorParam: newAnchor), @@ -204,7 +204,7 @@ class PlaceMarkerBodyState extends State { Future _changeInfo(MarkerId markerId) async { final Marker marker = markers[markerId]!; - final String newSnippet = '${marker.infoWindow.snippet!}*'; + final newSnippet = '${marker.infoWindow.snippet!}*'; setState(() { markers[markerId] = marker.copyWith( infoWindowParam: marker.infoWindow.copyWith(snippetParam: newSnippet), @@ -257,7 +257,7 @@ class PlaceMarkerBodyState extends State { } Future _getMarkerIcon(BuildContext context) async { - const Size canvasSize = Size(48, 48); + const canvasSize = Size(48, 48); final ByteData bytes = await createCustomMarkerIconImage(size: canvasSize); return BytesMapBitmap(bytes.buffer.asUint8List()); } diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart index e8cf201a41e..b70273179ee 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart @@ -81,10 +81,10 @@ class PlacePolygonBodyState extends State { return; } - final String polygonIdVal = 'polygon_id_$_polygonIdCounter'; - final PolygonId polygonId = PolygonId(polygonIdVal); + final polygonIdVal = 'polygon_id_$_polygonIdCounter'; + final polygonId = PolygonId(polygonIdVal); - final Polygon polygon = Polygon( + final polygon = Polygon( polygonId: polygonId, consumeTapEvents: true, strokeColor: Colors.orange, @@ -261,7 +261,7 @@ class PlacePolygonBodyState extends State { } List _createPoints() { - final List points = []; + final points = []; final double offset = _polygonIdCounter.ceilToDouble(); points.add(_createLatLng(51.2395 + offset, -3.4314)); points.add(_createLatLng(53.5234 + offset, -3.5314)); @@ -271,17 +271,17 @@ class PlacePolygonBodyState extends State { } List> _createHoles(PolygonId polygonId) { - final List> holes = >[]; + final holes = >[]; final double offset = polygonOffsets[polygonId]!; - final List hole1 = []; + final hole1 = []; hole1.add(_createLatLng(51.8395 + offset, -3.8814)); hole1.add(_createLatLng(52.0234 + offset, -3.9914)); hole1.add(_createLatLng(52.1351 + offset, -4.4435)); hole1.add(_createLatLng(52.0231 + offset, -4.5829)); holes.add(hole1); - final List hole2 = []; + final hole2 = []; hole2.add(_createLatLng(52.2395 + offset, -3.6814)); hole2.add(_createLatLng(52.4234 + offset, -3.7914)); hole2.add(_createLatLng(52.5351 + offset, -4.2435)); diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart index 083c575cc90..ce931ad2d5c 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart @@ -109,11 +109,11 @@ class PlacePolylineBodyState extends State { return; } - final String polylineIdVal = 'polyline_id_$_polylineIdCounter'; + final polylineIdVal = 'polyline_id_$_polylineIdCounter'; _polylineIdCounter++; - final PolylineId polylineId = PolylineId(polylineIdVal); + final polylineId = PolylineId(polylineIdVal); - final Polyline polyline = Polyline( + final polyline = Polyline( polylineId: polylineId, consumeTapEvents: true, color: Colors.orange, @@ -306,7 +306,7 @@ class PlacePolylineBodyState extends State { } List _createPoints() { - final List points = []; + final points = []; final double offset = _polylineIdCounter.ceilToDouble(); points.add(_createLatLng(51.4816 + offset, -3.1791)); points.add(_createLatLng(53.0430 + offset, -2.9925)); diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart index 9378cb091a3..e7fbfe5f49c 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart @@ -52,7 +52,7 @@ class TileOverlayBodyState extends State { } void _addTileOverlay() { - final TileOverlay tileOverlay = TileOverlay( + final tileOverlay = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), ); @@ -69,7 +69,7 @@ class TileOverlayBodyState extends State { @override Widget build(BuildContext context) { - final Set overlays = { + final overlays = { if (_tileOverlay != null) _tileOverlay!, }; return Column( @@ -123,10 +123,10 @@ class _DebugTileProvider implements TileProvider { @override Future getTile(int x, int y, int? zoom) async { - final ui.PictureRecorder recorder = ui.PictureRecorder(); - final Canvas canvas = Canvas(recorder); - final TextSpan textSpan = TextSpan(text: '$x,$y', style: textStyle); - final TextPainter textPainter = TextPainter( + final recorder = ui.PictureRecorder(); + final canvas = Canvas(recorder); + final textSpan = TextSpan(text: '$x,$y', style: textStyle); + final textPainter = TextPainter( text: textSpan, textDirection: TextDirection.ltr, ); diff --git a/packages/google_maps_flutter/google_maps_flutter/test/camera_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/camera_test.dart index 7db2374f90b..2951ea7cd10 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/camera_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/camera_test.dart @@ -20,7 +20,7 @@ void main() { }); testWidgets('Can animate camera with duration', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -42,7 +42,7 @@ void main() { final CameraUpdate newCameraUpdate = CameraUpdate.newLatLng( const LatLng(20.0, 25.0), ); - const Duration updateDuration = Duration(seconds: 10); + const updateDuration = Duration(seconds: 10); await controller.animateCamera(newCameraUpdate, duration: updateDuration); diff --git a/packages/google_maps_flutter/google_maps_flutter/test/circle_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/circle_updates_test.dart index 58f9b334a9c..b822f41a888 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/circle_updates_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/circle_updates_test.dart @@ -28,7 +28,7 @@ void main() { }); testWidgets('Initializing a circle', (WidgetTester tester) async { - const Circle c1 = Circle(circleId: CircleId('circle_1')); + const c1 = Circle(circleId: CircleId('circle_1')); await tester.pumpWidget(_mapWithCircles({c1})); final PlatformMapStateRecorder map = platform.lastCreatedMap; @@ -41,8 +41,8 @@ void main() { }); testWidgets('Adding a circle', (WidgetTester tester) async { - const Circle c1 = Circle(circleId: CircleId('circle_1')); - const Circle c2 = Circle(circleId: CircleId('circle_2')); + const c1 = Circle(circleId: CircleId('circle_1')); + const c2 = Circle(circleId: CircleId('circle_2')); await tester.pumpWidget(_mapWithCircles({c1})); await tester.pumpWidget(_mapWithCircles({c1, c2})); @@ -59,7 +59,7 @@ void main() { }); testWidgets('Removing a circle', (WidgetTester tester) async { - const Circle c1 = Circle(circleId: CircleId('circle_1')); + const c1 = Circle(circleId: CircleId('circle_1')); await tester.pumpWidget(_mapWithCircles({c1})); await tester.pumpWidget(_mapWithCircles({})); @@ -73,8 +73,8 @@ void main() { }); testWidgets('Updating a circle', (WidgetTester tester) async { - const Circle c1 = Circle(circleId: CircleId('circle_1')); - const Circle c2 = Circle(circleId: CircleId('circle_1'), radius: 10); + const c1 = Circle(circleId: CircleId('circle_1')); + const c2 = Circle(circleId: CircleId('circle_1'), radius: 10); await tester.pumpWidget(_mapWithCircles({c1})); await tester.pumpWidget(_mapWithCircles({c2})); @@ -88,8 +88,8 @@ void main() { }); testWidgets('Updating a circle', (WidgetTester tester) async { - const Circle c1 = Circle(circleId: CircleId('circle_1')); - const Circle c2 = Circle(circleId: CircleId('circle_1'), radius: 10); + const c1 = Circle(circleId: CircleId('circle_1')); + const c2 = Circle(circleId: CircleId('circle_1'), radius: 10); await tester.pumpWidget(_mapWithCircles({c1})); await tester.pumpWidget(_mapWithCircles({c2})); @@ -103,12 +103,12 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - Circle c1 = const Circle(circleId: CircleId('circle_1')); - Circle c2 = const Circle(circleId: CircleId('circle_2')); - final Set prev = {c1, c2}; + var c1 = const Circle(circleId: CircleId('circle_1')); + var c2 = const Circle(circleId: CircleId('circle_2')); + final prev = {c1, c2}; c1 = const Circle(circleId: CircleId('circle_1'), visible: false); c2 = const Circle(circleId: CircleId('circle_2'), radius: 10); - final Set cur = {c1, c2}; + final cur = {c1, c2}; await tester.pumpWidget(_mapWithCircles(prev)); await tester.pumpWidget(_mapWithCircles(cur)); @@ -121,14 +121,14 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - Circle c2 = const Circle(circleId: CircleId('circle_2')); - const Circle c3 = Circle(circleId: CircleId('circle_3')); - final Set prev = {c2, c3}; + var c2 = const Circle(circleId: CircleId('circle_2')); + const c3 = Circle(circleId: CircleId('circle_3')); + final prev = {c2, c3}; // c1 is added, c2 is updated, c3 is removed. - const Circle c1 = Circle(circleId: CircleId('circle_1')); + const c1 = Circle(circleId: CircleId('circle_1')); c2 = const Circle(circleId: CircleId('circle_2'), radius: 10); - final Set cur = {c1, c2}; + final cur = {c1, c2}; await tester.pumpWidget(_mapWithCircles(prev)); await tester.pumpWidget(_mapWithCircles(cur)); @@ -145,12 +145,12 @@ void main() { }); testWidgets('Partial Update', (WidgetTester tester) async { - const Circle c1 = Circle(circleId: CircleId('circle_1')); - const Circle c2 = Circle(circleId: CircleId('circle_2')); - Circle c3 = const Circle(circleId: CircleId('circle_3')); - final Set prev = {c1, c2, c3}; + const c1 = Circle(circleId: CircleId('circle_1')); + const c2 = Circle(circleId: CircleId('circle_2')); + var c3 = const Circle(circleId: CircleId('circle_3')); + final prev = {c1, c2, c3}; c3 = const Circle(circleId: CircleId('circle_3'), radius: 10); - final Set cur = {c1, c2, c3}; + final cur = {c1, c2, c3}; await tester.pumpWidget(_mapWithCircles(prev)); await tester.pumpWidget(_mapWithCircles(cur)); @@ -163,10 +163,10 @@ void main() { }); testWidgets('Update non platform related attr', (WidgetTester tester) async { - Circle c1 = const Circle(circleId: CircleId('circle_1')); - final Set prev = {c1}; + var c1 = const Circle(circleId: CircleId('circle_1')); + final prev = {c1}; c1 = Circle(circleId: const CircleId('circle_1'), onTap: () {}); - final Set cur = {c1}; + final cur = {c1}; await tester.pumpWidget(_mapWithCircles(prev)); await tester.pumpWidget(_mapWithCircles(cur)); @@ -181,10 +181,10 @@ void main() { testWidgets('multi-update with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Circle c1 = Circle(circleId: CircleId('circle_1')); - const Circle c2 = Circle(circleId: CircleId('circle_2')); - const Circle c3 = Circle(circleId: CircleId('circle_3'), radius: 1); - const Circle c3updated = Circle(circleId: CircleId('circle_3'), radius: 10); + const c1 = Circle(circleId: CircleId('circle_1')); + const c2 = Circle(circleId: CircleId('circle_2')); + const c3 = Circle(circleId: CircleId('circle_3'), radius: 1); + const c3updated = Circle(circleId: CircleId('circle_3'), radius: 10); // First remove one and add another, then update the new one. await tester.pumpWidget(_mapWithCircles({c1, c2})); diff --git a/packages/google_maps_flutter/google_maps_flutter/test/clustermanager_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/clustermanager_updates_test.dart index acecbf12698..8f6f10eb16b 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/clustermanager_updates_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/clustermanager_updates_test.dart @@ -28,7 +28,7 @@ void main() { }); testWidgets('Initializing a cluster manager', (WidgetTester tester) async { - const ClusterManager cm1 = ClusterManager( + const cm1 = ClusterManager( clusterManagerId: ClusterManagerId('cm_1'), ); await tester.pumpWidget(_mapWithClusterManagers({cm1})); @@ -50,10 +50,10 @@ void main() { }); testWidgets('Adding a cluster manager', (WidgetTester tester) async { - const ClusterManager cm1 = ClusterManager( + const cm1 = ClusterManager( clusterManagerId: ClusterManagerId('cm_1'), ); - const ClusterManager cm2 = ClusterManager( + const cm2 = ClusterManager( clusterManagerId: ClusterManagerId('cm_2'), ); @@ -81,7 +81,7 @@ void main() { }); testWidgets('Removing a cluster manager', (WidgetTester tester) async { - const ClusterManager cm1 = ClusterManager( + const cm1 = ClusterManager( clusterManagerId: ClusterManagerId('cm_1'), ); @@ -110,10 +110,10 @@ void main() { testWidgets('Updating a cluster manager with same data', ( WidgetTester tester, ) async { - const ClusterManager cm1 = ClusterManager( + const cm1 = ClusterManager( clusterManagerId: ClusterManagerId('cm_1'), ); - const ClusterManager cm2 = ClusterManager( + const cm2 = ClusterManager( clusterManagerId: ClusterManagerId('cm_1'), ); @@ -141,16 +141,16 @@ void main() { // are added to [ClusterManager] in the future, this test will need to be // updated accordingly to check that changes are triggered. testWidgets('Multi update with same data', (WidgetTester tester) async { - ClusterManager cm1 = const ClusterManager( + var cm1 = const ClusterManager( clusterManagerId: ClusterManagerId('cm_1'), ); - ClusterManager cm2 = const ClusterManager( + var cm2 = const ClusterManager( clusterManagerId: ClusterManagerId('cm_2'), ); - final Set prev = {cm1, cm2}; + final prev = {cm1, cm2}; cm1 = const ClusterManager(clusterManagerId: ClusterManagerId('cm_1')); cm2 = const ClusterManager(clusterManagerId: ClusterManagerId('cm_2')); - final Set cur = {cm1, cm2}; + final cur = {cm1, cm2}; await tester.pumpWidget(_mapWithClusterManagers(prev)); await tester.pumpWidget(_mapWithClusterManagers(cur)); @@ -173,18 +173,18 @@ void main() { // are added to [ClusterManager] in the future, this test will need to be // updated accordingly to check that changes are triggered. testWidgets('Partial update with same data', (WidgetTester tester) async { - const ClusterManager cm1 = ClusterManager( + const cm1 = ClusterManager( clusterManagerId: ClusterManagerId('heatmap_1'), ); - const ClusterManager cm2 = ClusterManager( + const cm2 = ClusterManager( clusterManagerId: ClusterManagerId('heatmap_2'), ); - ClusterManager cm3 = const ClusterManager( + var cm3 = const ClusterManager( clusterManagerId: ClusterManagerId('heatmap_3'), ); - final Set prev = {cm1, cm2, cm3}; + final prev = {cm1, cm2, cm3}; cm3 = const ClusterManager(clusterManagerId: ClusterManagerId('heatmap_3')); - final Set cur = {cm1, cm2, cm3}; + final cur = {cm1, cm2, cm3}; await tester.pumpWidget(_mapWithClusterManagers(prev)); await tester.pumpWidget(_mapWithClusterManagers(cur)); diff --git a/packages/google_maps_flutter/google_maps_flutter/test/controller_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/controller_test.dart index 7c27597c11a..ac8fcfbfa6f 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/controller_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/controller_test.dart @@ -17,15 +17,15 @@ void main() { testWidgets('Subscriptions are canceled on dispose', ( WidgetTester tester, ) async { - final FakeGoogleMapsFlutterPlatform platform = + final platform = FakeGoogleMapsFlutterPlatform(); GoogleMapsFlutterPlatform.instance = platform; - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final GoogleMap googleMap = GoogleMap( + final googleMap = GoogleMap( onMapCreated: (GoogleMapController controller) { controllerCompleter.complete(controller); }, diff --git a/packages/google_maps_flutter/google_maps_flutter/test/google_map_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/google_map_test.dart index e5a1fca9a30..4aedfdbb78f 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/google_map_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/google_map_test.dart @@ -574,7 +574,7 @@ void main() { }); testWidgets('Can update style', (WidgetTester tester) async { - const String initialStyle = '[]'; + const initialStyle = '[]'; await tester.pumpWidget( const Directionality( textDirection: TextDirection.ltr, diff --git a/packages/google_maps_flutter/google_maps_flutter/test/groundoverlay_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/groundoverlay_updates_test.dart index 9042c63bd59..b67118e81d3 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/groundoverlay_updates_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/groundoverlay_updates_test.dart @@ -20,7 +20,7 @@ Widget _mapWithMarkers(Set groundOverlays) { } void main() { - final LatLngBounds kGroundOverlayBounds = LatLngBounds( + final kGroundOverlayBounds = LatLngBounds( southwest: const LatLng(37.77483, -122.41942), northeast: const LatLng(37.78183, -122.39105), ); @@ -33,7 +33,7 @@ void main() { }); testWidgets('Initializing a groundOverlay', (WidgetTester tester) async { - final GroundOverlay go1 = GroundOverlay.fromBounds( + final go1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('go_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -46,7 +46,7 @@ void main() { zIndex: 10, ); - final GroundOverlay go2 = GroundOverlay.fromPosition( + final go2 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('go_2'), position: kGroundOverlayBounds.northeast, width: 100, @@ -81,7 +81,7 @@ void main() { }); testWidgets('Adding a groundOverlay', (WidgetTester tester) async { - final GroundOverlay go1 = GroundOverlay.fromBounds( + final go1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('go_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -94,7 +94,7 @@ void main() { zIndex: 10, ); - final GroundOverlay go2 = GroundOverlay.fromPosition( + final go2 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('go_2'), position: kGroundOverlayBounds.northeast, width: 100, @@ -130,7 +130,7 @@ void main() { }); testWidgets('Removing a groundOverlay', (WidgetTester tester) async { - final GroundOverlay go1 = GroundOverlay.fromBounds( + final go1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('go_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -158,7 +158,7 @@ void main() { }); testWidgets('Updating a groundOverlay', (WidgetTester tester) async { - final GroundOverlay go1 = GroundOverlay.fromBounds( + final go1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('go_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -191,7 +191,7 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - GroundOverlay go1 = GroundOverlay.fromBounds( + var go1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('go_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -204,7 +204,7 @@ void main() { zIndex: 10, ); - GroundOverlay go2 = GroundOverlay.fromPosition( + var go2 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('go_2'), position: kGroundOverlayBounds.northeast, width: 100, @@ -221,10 +221,10 @@ void main() { zoomLevel: 14.0, ); - final Set prev = {go1, go2}; + final prev = {go1, go2}; go1 = go1.copyWith(visibleParam: false); go2 = go2.copyWith(clickableParam: false); - final Set cur = {go1, go2}; + final cur = {go1, go2}; await tester.pumpWidget(_mapWithMarkers(prev)); await tester.pumpWidget(_mapWithMarkers(cur)); @@ -240,7 +240,7 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - final GroundOverlay go1 = GroundOverlay.fromBounds( + final go1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('go_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -253,7 +253,7 @@ void main() { zIndex: 10, ); - GroundOverlay go2 = GroundOverlay.fromPosition( + var go2 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('go_2'), position: kGroundOverlayBounds.northeast, width: 100, @@ -270,7 +270,7 @@ void main() { zoomLevel: 14.0, ); - final GroundOverlay go3 = GroundOverlay.fromPosition( + final go3 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('go_3'), position: kGroundOverlayBounds.southwest, width: 100, @@ -287,11 +287,11 @@ void main() { zoomLevel: 14.0, ); - final Set prev = {go2, go3}; + final prev = {go2, go3}; // go1 is added, go2 is updated, go3 is removed. go2 = go2.copyWith(clickableParam: false); - final Set cur = {go1, go2}; + final cur = {go1, go2}; await tester.pumpWidget(_mapWithMarkers(prev)); await tester.pumpWidget(_mapWithMarkers(cur)); @@ -317,7 +317,7 @@ void main() { }); testWidgets('Partial Update', (WidgetTester tester) async { - final GroundOverlay go1 = GroundOverlay.fromBounds( + final go1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('go_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -330,7 +330,7 @@ void main() { zIndex: 10, ); - final GroundOverlay go2 = GroundOverlay.fromPosition( + final go2 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('go_2'), position: kGroundOverlayBounds.northeast, width: 100, @@ -347,7 +347,7 @@ void main() { zoomLevel: 14.0, ); - GroundOverlay go3 = GroundOverlay.fromPosition( + var go3 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('go_3'), position: kGroundOverlayBounds.southwest, width: 100, @@ -363,9 +363,9 @@ void main() { zIndex: 10, zoomLevel: 14.0, ); - final Set prev = {go1, go2, go3}; + final prev = {go1, go2, go3}; go3 = go3.copyWith(visibleParam: false); - final Set cur = {go1, go2, go3}; + final cur = {go1, go2, go3}; await tester.pumpWidget(_mapWithMarkers(prev)); await tester.pumpWidget(_mapWithMarkers(cur)); @@ -384,7 +384,7 @@ void main() { }); testWidgets('Update non platform related attr', (WidgetTester tester) async { - GroundOverlay go1 = GroundOverlay.fromBounds( + var go1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('go_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -396,9 +396,9 @@ void main() { bearing: 10, zIndex: 10, ); - final Set prev = {go1}; + final prev = {go1}; go1 = go1.copyWith(onTapParam: () {}); - final Set cur = {go1}; + final cur = {go1}; await tester.pumpWidget(_mapWithMarkers(prev)); await tester.pumpWidget(_mapWithMarkers(cur)); @@ -416,7 +416,7 @@ void main() { testWidgets('multi-update with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - final GroundOverlay go1 = GroundOverlay.fromBounds( + final go1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('go_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -429,7 +429,7 @@ void main() { zIndex: 10, ); - final GroundOverlay go2 = GroundOverlay.fromPosition( + final go2 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('go_2'), position: kGroundOverlayBounds.northeast, width: 100, @@ -446,7 +446,7 @@ void main() { zoomLevel: 14.0, ); - final GroundOverlay go3 = GroundOverlay.fromPosition( + final go3 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('go_3'), position: kGroundOverlayBounds.southwest, width: 100, diff --git a/packages/google_maps_flutter/google_maps_flutter/test/heatmap_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/heatmap_updates_test.dart index ec01bb67114..891468ced66 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/heatmap_updates_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/heatmap_updates_test.dart @@ -45,7 +45,7 @@ void main() { }); testWidgets('Initializing a heatmap', (WidgetTester tester) async { - const Heatmap h1 = Heatmap( + const h1 = Heatmap( heatmapId: HeatmapId('heatmap_1'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), @@ -63,12 +63,12 @@ void main() { }); testWidgets('Adding a heatmap', (WidgetTester tester) async { - const Heatmap h1 = Heatmap( + const h1 = Heatmap( heatmapId: HeatmapId('heatmap_1'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), ); - const Heatmap h2 = Heatmap( + const h2 = Heatmap( heatmapId: HeatmapId('heatmap_2'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), @@ -89,7 +89,7 @@ void main() { }); testWidgets('Removing a heatmap', (WidgetTester tester) async { - const Heatmap h1 = Heatmap( + const h1 = Heatmap( heatmapId: HeatmapId('heatmap_1'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), @@ -110,12 +110,12 @@ void main() { }); testWidgets('Updating a heatmap', (WidgetTester tester) async { - const Heatmap h1 = Heatmap( + const h1 = Heatmap( heatmapId: HeatmapId('heatmap_1'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), ); - const Heatmap h2 = Heatmap( + const h2 = Heatmap( heatmapId: HeatmapId('heatmap_1'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(10), @@ -133,12 +133,12 @@ void main() { }); testWidgets('Updating a heatmap', (WidgetTester tester) async { - const Heatmap h1 = Heatmap( + const h1 = Heatmap( heatmapId: HeatmapId('heatmap_1'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), ); - const Heatmap h2 = Heatmap( + const h2 = Heatmap( heatmapId: HeatmapId('heatmap_1'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(10), @@ -156,17 +156,17 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - Heatmap h1 = const Heatmap( + var h1 = const Heatmap( heatmapId: HeatmapId('heatmap_1'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), ); - Heatmap h2 = const Heatmap( + var h2 = const Heatmap( heatmapId: HeatmapId('heatmap_2'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), ); - final Set prev = {h1, h2}; + final prev = {h1, h2}; h1 = const Heatmap( heatmapId: HeatmapId('heatmap_1'), data: _heatmapPoints, @@ -178,7 +178,7 @@ void main() { data: _heatmapPoints, radius: HeatmapRadius.fromPixels(10), ); - final Set cur = {h1, h2}; + final cur = {h1, h2}; await tester.pumpWidget(_mapWithHeatmaps(prev)); await tester.pumpWidget(_mapWithHeatmaps(cur)); @@ -191,20 +191,20 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - Heatmap h2 = const Heatmap( + var h2 = const Heatmap( heatmapId: HeatmapId('heatmap_2'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), ); - const Heatmap h3 = Heatmap( + const h3 = Heatmap( heatmapId: HeatmapId('heatmap_3'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), ); - final Set prev = {h2, h3}; + final prev = {h2, h3}; // h1 is added, h2 is updated, h3 is removed. - const Heatmap h1 = Heatmap( + const h1 = Heatmap( heatmapId: HeatmapId('heatmap_1'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), @@ -214,7 +214,7 @@ void main() { data: _heatmapPoints, radius: HeatmapRadius.fromPixels(10), ); - final Set cur = {h1, h2}; + final cur = {h1, h2}; await tester.pumpWidget(_mapWithHeatmaps(prev)); await tester.pumpWidget(_mapWithHeatmaps(cur)); @@ -234,28 +234,28 @@ void main() { }); testWidgets('Partial Update', (WidgetTester tester) async { - const Heatmap h1 = Heatmap( + const h1 = Heatmap( heatmapId: HeatmapId('heatmap_1'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), ); - const Heatmap h2 = Heatmap( + const h2 = Heatmap( heatmapId: HeatmapId('heatmap_2'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), ); - Heatmap h3 = const Heatmap( + var h3 = const Heatmap( heatmapId: HeatmapId('heatmap_3'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(20), ); - final Set prev = {h1, h2, h3}; + final prev = {h1, h2, h3}; h3 = const Heatmap( heatmapId: HeatmapId('heatmap_3'), data: _heatmapPoints, radius: HeatmapRadius.fromPixels(10), ); - final Set cur = {h1, h2, h3}; + final cur = {h1, h2, h3}; await tester.pumpWidget(_mapWithHeatmaps(prev)); await tester.pumpWidget(_mapWithHeatmaps(cur)); diff --git a/packages/google_maps_flutter/google_maps_flutter/test/marker_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/marker_updates_test.dart index ae87d1e7a3d..dcf58d4d2d6 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/marker_updates_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/marker_updates_test.dart @@ -28,7 +28,7 @@ void main() { }); testWidgets('Initializing a marker', (WidgetTester tester) async { - const Marker m1 = Marker(markerId: MarkerId('marker_1')); + const m1 = Marker(markerId: MarkerId('marker_1')); await tester.pumpWidget(_mapWithMarkers({m1})); final PlatformMapStateRecorder map = platform.lastCreatedMap; @@ -41,8 +41,8 @@ void main() { }); testWidgets('Adding a marker', (WidgetTester tester) async { - const Marker m1 = Marker(markerId: MarkerId('marker_1')); - const Marker m2 = Marker(markerId: MarkerId('marker_2')); + const m1 = Marker(markerId: MarkerId('marker_1')); + const m2 = Marker(markerId: MarkerId('marker_2')); await tester.pumpWidget(_mapWithMarkers({m1})); await tester.pumpWidget(_mapWithMarkers({m1, m2})); @@ -59,7 +59,7 @@ void main() { }); testWidgets('Removing a marker', (WidgetTester tester) async { - const Marker m1 = Marker(markerId: MarkerId('marker_1')); + const m1 = Marker(markerId: MarkerId('marker_1')); await tester.pumpWidget(_mapWithMarkers({m1})); await tester.pumpWidget(_mapWithMarkers({})); @@ -73,8 +73,8 @@ void main() { }); testWidgets('Updating a marker', (WidgetTester tester) async { - const Marker m1 = Marker(markerId: MarkerId('marker_1')); - const Marker m2 = Marker(markerId: MarkerId('marker_1'), alpha: 0.5); + const m1 = Marker(markerId: MarkerId('marker_1')); + const m2 = Marker(markerId: MarkerId('marker_1'), alpha: 0.5); await tester.pumpWidget(_mapWithMarkers({m1})); await tester.pumpWidget(_mapWithMarkers({m2})); @@ -88,8 +88,8 @@ void main() { }); testWidgets('Updating a marker', (WidgetTester tester) async { - const Marker m1 = Marker(markerId: MarkerId('marker_1')); - const Marker m2 = Marker( + const m1 = Marker(markerId: MarkerId('marker_1')); + const m2 = Marker( markerId: MarkerId('marker_1'), infoWindow: InfoWindow(snippet: 'changed'), ); @@ -106,12 +106,12 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - Marker m1 = const Marker(markerId: MarkerId('marker_1')); - Marker m2 = const Marker(markerId: MarkerId('marker_2')); - final Set prev = {m1, m2}; + var m1 = const Marker(markerId: MarkerId('marker_1')); + var m2 = const Marker(markerId: MarkerId('marker_2')); + final prev = {m1, m2}; m1 = const Marker(markerId: MarkerId('marker_1'), visible: false); m2 = const Marker(markerId: MarkerId('marker_2'), draggable: true); - final Set cur = {m1, m2}; + final cur = {m1, m2}; await tester.pumpWidget(_mapWithMarkers(prev)); await tester.pumpWidget(_mapWithMarkers(cur)); @@ -124,14 +124,14 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - Marker m2 = const Marker(markerId: MarkerId('marker_2')); - const Marker m3 = Marker(markerId: MarkerId('marker_3')); - final Set prev = {m2, m3}; + var m2 = const Marker(markerId: MarkerId('marker_2')); + const m3 = Marker(markerId: MarkerId('marker_3')); + final prev = {m2, m3}; // m1 is added, m2 is updated, m3 is removed. - const Marker m1 = Marker(markerId: MarkerId('marker_1')); + const m1 = Marker(markerId: MarkerId('marker_1')); m2 = const Marker(markerId: MarkerId('marker_2'), draggable: true); - final Set cur = {m1, m2}; + final cur = {m1, m2}; await tester.pumpWidget(_mapWithMarkers(prev)); await tester.pumpWidget(_mapWithMarkers(cur)); @@ -148,12 +148,12 @@ void main() { }); testWidgets('Partial Update', (WidgetTester tester) async { - const Marker m1 = Marker(markerId: MarkerId('marker_1')); - const Marker m2 = Marker(markerId: MarkerId('marker_2')); - Marker m3 = const Marker(markerId: MarkerId('marker_3')); - final Set prev = {m1, m2, m3}; + const m1 = Marker(markerId: MarkerId('marker_1')); + const m2 = Marker(markerId: MarkerId('marker_2')); + var m3 = const Marker(markerId: MarkerId('marker_3')); + final prev = {m1, m2, m3}; m3 = const Marker(markerId: MarkerId('marker_3'), draggable: true); - final Set cur = {m1, m2, m3}; + final cur = {m1, m2, m3}; await tester.pumpWidget(_mapWithMarkers(prev)); await tester.pumpWidget(_mapWithMarkers(cur)); @@ -166,14 +166,14 @@ void main() { }); testWidgets('Update non platform related attr', (WidgetTester tester) async { - Marker m1 = const Marker(markerId: MarkerId('marker_1')); - final Set prev = {m1}; + var m1 = const Marker(markerId: MarkerId('marker_1')); + final prev = {m1}; m1 = Marker( markerId: const MarkerId('marker_1'), onTap: () {}, onDragEnd: (LatLng latLng) {}, ); - final Set cur = {m1}; + final cur = {m1}; await tester.pumpWidget(_mapWithMarkers(prev)); await tester.pumpWidget(_mapWithMarkers(cur)); @@ -188,10 +188,10 @@ void main() { testWidgets('multi-update with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Marker m1 = Marker(markerId: MarkerId('marker_1')); - const Marker m2 = Marker(markerId: MarkerId('marker_2')); - const Marker m3 = Marker(markerId: MarkerId('marker_3')); - const Marker m3updated = Marker( + const m1 = Marker(markerId: MarkerId('marker_1')); + const m2 = Marker(markerId: MarkerId('marker_2')); + const m3 = Marker(markerId: MarkerId('marker_3')); + const m3updated = Marker( markerId: MarkerId('marker_3'), draggable: true, ); diff --git a/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart index 778a89e2d17..942a9c40a7b 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart @@ -51,7 +51,7 @@ void main() { }); testWidgets('Initializing a polygon', (WidgetTester tester) async { - const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1')); + const p1 = Polygon(polygonId: PolygonId('polygon_1')); await tester.pumpWidget(_mapWithPolygons({p1})); final PlatformMapStateRecorder map = platform.lastCreatedMap; @@ -65,8 +65,8 @@ void main() { }); testWidgets('Adding a polygon', (WidgetTester tester) async { - const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1')); - const Polygon p2 = Polygon(polygonId: PolygonId('polygon_2')); + const p1 = Polygon(polygonId: PolygonId('polygon_1')); + const p2 = Polygon(polygonId: PolygonId('polygon_2')); await tester.pumpWidget(_mapWithPolygons({p1})); await tester.pumpWidget(_mapWithPolygons({p1, p2})); @@ -83,7 +83,7 @@ void main() { }); testWidgets('Removing a polygon', (WidgetTester tester) async { - const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1')); + const p1 = Polygon(polygonId: PolygonId('polygon_1')); await tester.pumpWidget(_mapWithPolygons({p1})); await tester.pumpWidget(_mapWithPolygons({})); @@ -100,8 +100,8 @@ void main() { }); testWidgets('Updating a polygon', (WidgetTester tester) async { - const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1')); - const Polygon p2 = Polygon( + const p1 = Polygon(polygonId: PolygonId('polygon_1')); + const p2 = Polygon( polygonId: PolygonId('polygon_1'), geodesic: true, ); @@ -118,8 +118,8 @@ void main() { }); testWidgets('Mutate a polygon', (WidgetTester tester) async { - final List points = [const LatLng(0.0, 0.0)]; - final Polygon p1 = Polygon( + final points = [const LatLng(0.0, 0.0)]; + final p1 = Polygon( polygonId: const PolygonId('polygon_1'), points: points, ); @@ -137,12 +137,12 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - Polygon p1 = const Polygon(polygonId: PolygonId('polygon_1')); - Polygon p2 = const Polygon(polygonId: PolygonId('polygon_2')); - final Set prev = {p1, p2}; + var p1 = const Polygon(polygonId: PolygonId('polygon_1')); + var p2 = const Polygon(polygonId: PolygonId('polygon_2')); + final prev = {p1, p2}; p1 = const Polygon(polygonId: PolygonId('polygon_1'), visible: false); p2 = const Polygon(polygonId: PolygonId('polygon_2'), geodesic: true); - final Set cur = {p1, p2}; + final cur = {p1, p2}; await tester.pumpWidget(_mapWithPolygons(prev)); await tester.pumpWidget(_mapWithPolygons(cur)); @@ -155,14 +155,14 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - Polygon p2 = const Polygon(polygonId: PolygonId('polygon_2')); - const Polygon p3 = Polygon(polygonId: PolygonId('polygon_3')); - final Set prev = {p2, p3}; + var p2 = const Polygon(polygonId: PolygonId('polygon_2')); + const p3 = Polygon(polygonId: PolygonId('polygon_3')); + final prev = {p2, p3}; // p1 is added, p2 is updated, p3 is removed. - const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1')); + const p1 = Polygon(polygonId: PolygonId('polygon_1')); p2 = const Polygon(polygonId: PolygonId('polygon_2'), geodesic: true); - final Set cur = {p1, p2}; + final cur = {p1, p2}; await tester.pumpWidget(_mapWithPolygons(prev)); await tester.pumpWidget(_mapWithPolygons(cur)); @@ -182,12 +182,12 @@ void main() { }); testWidgets('Partial Update', (WidgetTester tester) async { - const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1')); - const Polygon p2 = Polygon(polygonId: PolygonId('polygon_2')); - Polygon p3 = const Polygon(polygonId: PolygonId('polygon_3')); - final Set prev = {p1, p2, p3}; + const p1 = Polygon(polygonId: PolygonId('polygon_1')); + const p2 = Polygon(polygonId: PolygonId('polygon_2')); + var p3 = const Polygon(polygonId: PolygonId('polygon_3')); + final prev = {p1, p2, p3}; p3 = const Polygon(polygonId: PolygonId('polygon_3'), geodesic: true); - final Set cur = {p1, p2, p3}; + final cur = {p1, p2, p3}; await tester.pumpWidget(_mapWithPolygons(prev)); await tester.pumpWidget(_mapWithPolygons(cur)); @@ -200,10 +200,10 @@ void main() { }); testWidgets('Update non platform related attr', (WidgetTester tester) async { - Polygon p1 = const Polygon(polygonId: PolygonId('polygon_1')); - final Set prev = {p1}; + var p1 = const Polygon(polygonId: PolygonId('polygon_1')); + final prev = {p1}; p1 = Polygon(polygonId: const PolygonId('polygon_1'), onTap: () {}); - final Set cur = {p1}; + final cur = {p1}; await tester.pumpWidget(_mapWithPolygons(prev)); await tester.pumpWidget(_mapWithPolygons(cur)); @@ -234,7 +234,7 @@ void main() { testWidgets('Adding a polygon with points and hole', ( WidgetTester tester, ) async { - const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1')); + const p1 = Polygon(polygonId: PolygonId('polygon_1')); final Polygon p2 = _polygonWithPointsAndHole(const PolygonId('polygon_2')); await tester.pumpWidget(_mapWithPolygons({p1})); @@ -273,7 +273,7 @@ void main() { testWidgets('Updating a polygon by adding points and hole', ( WidgetTester tester, ) async { - const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1')); + const p1 = Polygon(polygonId: PolygonId('polygon_1')); final Polygon p2 = _polygonWithPointsAndHole(const PolygonId('polygon_1')); await tester.pumpWidget(_mapWithPolygons({p1})); @@ -290,7 +290,7 @@ void main() { testWidgets('Mutate a polygon with points and holes', ( WidgetTester tester, ) async { - final Polygon p1 = Polygon( + final p1 = Polygon( polygonId: const PolygonId('polygon_1'), points: _rectPoints(size: 1), holes: >[_rectPoints(size: 0.5)], @@ -316,19 +316,19 @@ void main() { testWidgets('Multi Update polygons with points and hole', ( WidgetTester tester, ) async { - Polygon p1 = const Polygon(polygonId: PolygonId('polygon_1')); - Polygon p2 = Polygon( + var p1 = const Polygon(polygonId: PolygonId('polygon_1')); + var p2 = Polygon( polygonId: const PolygonId('polygon_2'), points: _rectPoints(size: 2), holes: >[_rectPoints(size: 1)], ); - final Set prev = {p1, p2}; + final prev = {p1, p2}; p1 = const Polygon(polygonId: PolygonId('polygon_1'), visible: false); p2 = p2.copyWith( pointsParam: _rectPoints(size: 5), holesParam: >[_rectPoints(size: 2)], ); - final Set cur = {p1, p2}; + final cur = {p1, p2}; await tester.pumpWidget(_mapWithPolygons(prev)); await tester.pumpWidget(_mapWithPolygons(cur)); @@ -343,13 +343,13 @@ void main() { testWidgets('Multi Update polygons with points and hole', ( WidgetTester tester, ) async { - Polygon p2 = Polygon( + var p2 = Polygon( polygonId: const PolygonId('polygon_2'), points: _rectPoints(size: 2), holes: >[_rectPoints(size: 1)], ); - const Polygon p3 = Polygon(polygonId: PolygonId('polygon_3')); - final Set prev = {p2, p3}; + const p3 = Polygon(polygonId: PolygonId('polygon_3')); + final prev = {p2, p3}; // p1 is added, p2 is updated, p3 is removed. final Polygon p1 = _polygonWithPointsAndHole(const PolygonId('polygon_1')); @@ -357,7 +357,7 @@ void main() { pointsParam: _rectPoints(size: 5), holesParam: >[_rectPoints(size: 3)], ); - final Set cur = {p1, p2}; + final cur = {p1, p2}; await tester.pumpWidget(_mapWithPolygons(prev)); await tester.pumpWidget(_mapWithPolygons(cur)); @@ -380,18 +380,18 @@ void main() { WidgetTester tester, ) async { final Polygon p1 = _polygonWithPointsAndHole(const PolygonId('polygon_1')); - const Polygon p2 = Polygon(polygonId: PolygonId('polygon_2')); - Polygon p3 = Polygon( + const p2 = Polygon(polygonId: PolygonId('polygon_2')); + var p3 = Polygon( polygonId: const PolygonId('polygon_3'), points: _rectPoints(size: 2), holes: >[_rectPoints(size: 1)], ); - final Set prev = {p1, p2, p3}; + final prev = {p1, p2, p3}; p3 = p3.copyWith( pointsParam: _rectPoints(size: 5), holesParam: >[_rectPoints(size: 3)], ); - final Set cur = {p1, p2, p3}; + final cur = {p1, p2, p3}; await tester.pumpWidget(_mapWithPolygons(prev)); await tester.pumpWidget(_mapWithPolygons(cur)); @@ -406,13 +406,13 @@ void main() { testWidgets('multi-update with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1')); - const Polygon p2 = Polygon(polygonId: PolygonId('polygon_2')); - const Polygon p3 = Polygon( + const p1 = Polygon(polygonId: PolygonId('polygon_1')); + const p2 = Polygon(polygonId: PolygonId('polygon_2')); + const p3 = Polygon( polygonId: PolygonId('polygon_3'), strokeWidth: 1, ); - const Polygon p3updated = Polygon( + const p3updated = Polygon( polygonId: PolygonId('polygon_3'), strokeWidth: 2, ); diff --git a/packages/google_maps_flutter/google_maps_flutter/test/polyline_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/polyline_updates_test.dart index 9c00e61e2e4..92d44cfce6f 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/polyline_updates_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/polyline_updates_test.dart @@ -28,7 +28,7 @@ void main() { }); testWidgets('Initializing a polyline', (WidgetTester tester) async { - const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1')); + const p1 = Polyline(polylineId: PolylineId('polyline_1')); await tester.pumpWidget(_mapWithPolylines({p1})); final PlatformMapStateRecorder map = platform.lastCreatedMap; @@ -42,8 +42,8 @@ void main() { }); testWidgets('Adding a polyline', (WidgetTester tester) async { - const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1')); - const Polyline p2 = Polyline(polylineId: PolylineId('polyline_2')); + const p1 = Polyline(polylineId: PolylineId('polyline_1')); + const p2 = Polyline(polylineId: PolylineId('polyline_2')); await tester.pumpWidget(_mapWithPolylines({p1})); await tester.pumpWidget(_mapWithPolylines({p1, p2})); @@ -61,7 +61,7 @@ void main() { }); testWidgets('Removing a polyline', (WidgetTester tester) async { - const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1')); + const p1 = Polyline(polylineId: PolylineId('polyline_1')); await tester.pumpWidget(_mapWithPolylines({p1})); await tester.pumpWidget(_mapWithPolylines({})); @@ -78,8 +78,8 @@ void main() { }); testWidgets('Updating a polyline', (WidgetTester tester) async { - const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1')); - const Polyline p2 = Polyline( + const p1 = Polyline(polylineId: PolylineId('polyline_1')); + const p2 = Polyline( polylineId: PolylineId('polyline_1'), geodesic: true, ); @@ -96,8 +96,8 @@ void main() { }); testWidgets('Updating a polyline', (WidgetTester tester) async { - const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1')); - const Polyline p2 = Polyline( + const p1 = Polyline(polylineId: PolylineId('polyline_1')); + const p2 = Polyline( polylineId: PolylineId('polyline_1'), geodesic: true, ); @@ -114,8 +114,8 @@ void main() { }); testWidgets('Mutate a polyline', (WidgetTester tester) async { - final List points = [const LatLng(0.0, 0.0)]; - final Polyline p1 = Polyline( + final points = [const LatLng(0.0, 0.0)]; + final p1 = Polyline( polylineId: const PolylineId('polyline_1'), points: points, ); @@ -133,12 +133,12 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - Polyline p1 = const Polyline(polylineId: PolylineId('polyline_1')); - Polyline p2 = const Polyline(polylineId: PolylineId('polyline_2')); - final Set prev = {p1, p2}; + var p1 = const Polyline(polylineId: PolylineId('polyline_1')); + var p2 = const Polyline(polylineId: PolylineId('polyline_2')); + final prev = {p1, p2}; p1 = const Polyline(polylineId: PolylineId('polyline_1'), visible: false); p2 = const Polyline(polylineId: PolylineId('polyline_2'), geodesic: true); - final Set cur = {p1, p2}; + final cur = {p1, p2}; await tester.pumpWidget(_mapWithPolylines(prev)); await tester.pumpWidget(_mapWithPolylines(cur)); @@ -151,14 +151,14 @@ void main() { }); testWidgets('Multi Update', (WidgetTester tester) async { - Polyline p2 = const Polyline(polylineId: PolylineId('polyline_2')); - const Polyline p3 = Polyline(polylineId: PolylineId('polyline_3')); - final Set prev = {p2, p3}; + var p2 = const Polyline(polylineId: PolylineId('polyline_2')); + const p3 = Polyline(polylineId: PolylineId('polyline_3')); + final prev = {p2, p3}; // p1 is added, p2 is updated, p3 is removed. - const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1')); + const p1 = Polyline(polylineId: PolylineId('polyline_1')); p2 = const Polyline(polylineId: PolylineId('polyline_2'), geodesic: true); - final Set cur = {p1, p2}; + final cur = {p1, p2}; await tester.pumpWidget(_mapWithPolylines(prev)); await tester.pumpWidget(_mapWithPolylines(cur)); @@ -178,12 +178,12 @@ void main() { }); testWidgets('Partial Update', (WidgetTester tester) async { - const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1')); - const Polyline p2 = Polyline(polylineId: PolylineId('polyline_2')); - Polyline p3 = const Polyline(polylineId: PolylineId('polyline_3')); - final Set prev = {p1, p2, p3}; + const p1 = Polyline(polylineId: PolylineId('polyline_1')); + const p2 = Polyline(polylineId: PolylineId('polyline_2')); + var p3 = const Polyline(polylineId: PolylineId('polyline_3')); + final prev = {p1, p2, p3}; p3 = const Polyline(polylineId: PolylineId('polyline_3'), geodesic: true); - final Set cur = {p1, p2, p3}; + final cur = {p1, p2, p3}; await tester.pumpWidget(_mapWithPolylines(prev)); await tester.pumpWidget(_mapWithPolylines(cur)); @@ -196,10 +196,10 @@ void main() { }); testWidgets('Update non platform related attr', (WidgetTester tester) async { - Polyline p1 = const Polyline(polylineId: PolylineId('polyline_1')); - final Set prev = {p1}; + var p1 = const Polyline(polylineId: PolylineId('polyline_1')); + final prev = {p1}; p1 = Polyline(polylineId: const PolylineId('polyline_1'), onTap: () {}); - final Set cur = {p1}; + final cur = {p1}; await tester.pumpWidget(_mapWithPolylines(prev)); await tester.pumpWidget(_mapWithPolylines(cur)); @@ -214,13 +214,13 @@ void main() { testWidgets('multi-update with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1')); - const Polyline p2 = Polyline(polylineId: PolylineId('polyline_2')); - const Polyline p3 = Polyline( + const p1 = Polyline(polylineId: PolylineId('polyline_1')); + const p2 = Polyline(polylineId: PolylineId('polyline_2')); + const p3 = Polyline( polylineId: PolylineId('polyline_3'), width: 1, ); - const Polyline p3updated = Polyline( + const p3updated = Polyline( polylineId: PolylineId('polyline_3'), width: 2, ); diff --git a/packages/google_maps_flutter/google_maps_flutter/test/tile_overlay_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/tile_overlay_updates_test.dart index 28b27345175..55108b3651b 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/tile_overlay_updates_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/tile_overlay_updates_test.dart @@ -28,7 +28,7 @@ void main() { }); testWidgets('Initializing a tile overlay', (WidgetTester tester) async { - const TileOverlay t1 = TileOverlay( + const t1 = TileOverlay( tileOverlayId: TileOverlayId('tile_overlay_1'), ); await tester.pumpWidget(_mapWithTileOverlays({t1})); @@ -38,10 +38,10 @@ void main() { }); testWidgets('Adding a tile overlay', (WidgetTester tester) async { - const TileOverlay t1 = TileOverlay( + const t1 = TileOverlay( tileOverlayId: TileOverlayId('tile_overlay_1'), ); - const TileOverlay t2 = TileOverlay( + const t2 = TileOverlay( tileOverlayId: TileOverlayId('tile_overlay_2'), ); @@ -53,7 +53,7 @@ void main() { }); testWidgets('Removing a tile overlay', (WidgetTester tester) async { - const TileOverlay t1 = TileOverlay( + const t1 = TileOverlay( tileOverlayId: TileOverlayId('tile_overlay_1'), ); @@ -65,10 +65,10 @@ void main() { }); testWidgets('Updating a tile overlay', (WidgetTester tester) async { - const TileOverlay t1 = TileOverlay( + const t1 = TileOverlay( tileOverlayId: TileOverlayId('tile_overlay_1'), ); - const TileOverlay t2 = TileOverlay( + const t2 = TileOverlay( tileOverlayId: TileOverlayId('tile_overlay_1'), zIndex: 10, ); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart index d421bcf9718..b47c5cb9d5e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart @@ -51,7 +51,7 @@ void main() { GoogleMapsFlutterPlatform.instance.enableDebugInspection(); setUpAll(() async { - final GoogleMapsFlutterAndroid instance = + final instance = GoogleMapsFlutterPlatform.instance as GoogleMapsFlutterAndroid; initializedRenderer = await instance.initializeWithRenderer( AndroidMapRenderer.latest, @@ -73,7 +73,7 @@ void main() { testWidgets('throws PlatformException on multiple renderer initializations', ( WidgetTester _, ) async { - final GoogleMapsFlutterAndroid instance = + final instance = GoogleMapsFlutterPlatform.instance as GoogleMapsFlutterAndroid; expect( () async => instance.initializeWithRenderer(AndroidMapRenderer.latest), @@ -102,7 +102,7 @@ void main() { bool Function(T) predicate, { int maxTries = 100, }) async { - for (int i = 0; i < maxTries; i++) { + for (var i = 0; i < maxTries; i++) { final T value = await getValue(); if (predicate(value)) { return value; @@ -113,14 +113,14 @@ void main() { } testWidgets('uses surface view', (WidgetTester tester) async { - final GoogleMapsFlutterAndroid instance = + final instance = GoogleMapsFlutterPlatform.instance as GoogleMapsFlutterAndroid; final bool previousUseAndroidViewSurfaceValue = instance.useAndroidViewSurface; instance.useAndroidViewSurface = true; final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -150,7 +150,7 @@ void main() { testWidgets('testCompassToggle', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -190,7 +190,7 @@ void main() { testWidgets('testMapToolbarToggle', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -231,11 +231,11 @@ void main() { testWidgets('updateMinMaxZoomLevels', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); - const MinMaxZoomPreference initialZoomLevel = MinMaxZoomPreference(4, 8); - const MinMaxZoomPreference finalZoomLevel = MinMaxZoomPreference(6, 10); + const initialZoomLevel = MinMaxZoomPreference(4, 8); + const finalZoomLevel = MinMaxZoomPreference(6, 10); await tester.pumpWidget( Directionality( @@ -292,7 +292,7 @@ void main() { testWidgets('testZoomGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -335,7 +335,7 @@ void main() { testWidgets('testZoomControlsEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -378,7 +378,7 @@ void main() { testWidgets('testLiteModeEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -419,7 +419,7 @@ void main() { testWidgets('testRotateGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -464,7 +464,7 @@ void main() { testWidgets('testTiltGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -507,7 +507,7 @@ void main() { testWidgets('testScrollGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -553,7 +553,7 @@ void main() { testWidgets('testInitialCenterLocationAtCenter', (WidgetTester tester) async { await tester.binding.setSurfaceSize(const Size(800, 600)); - final Completer mapControllerCompleter = + final mapControllerCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -598,12 +598,12 @@ void main() { testWidgets('testGetVisibleRegion', (WidgetTester tester) async { final Key key = GlobalKey(); - final LatLngBounds zeroLatLngBounds = LatLngBounds( + final zeroLatLngBounds = LatLngBounds( southwest: const LatLng(0, 0), northeast: const LatLng(0, 0), ); - final Completer mapControllerCompleter = + final mapControllerCompleter = Completer(); await tester.pumpWidget( @@ -638,15 +638,15 @@ void main() { // Making a new `LatLngBounds` about (10, 10) distance south west to the `firstVisibleRegion`. // The size of the `LatLngBounds` is 10 by 10. - final LatLng southWest = LatLng( + final southWest = LatLng( firstVisibleRegion.southwest.latitude - 20, firstVisibleRegion.southwest.longitude - 20, ); - final LatLng northEast = LatLng( + final northEast = LatLng( firstVisibleRegion.southwest.latitude - 10, firstVisibleRegion.southwest.longitude - 10, ); - final LatLng newCenter = LatLng( + final newCenter = LatLng( (northEast.latitude + southWest.latitude) / 2, (northEast.longitude + southWest.longitude) / 2, ); @@ -654,7 +654,7 @@ void main() { expect(firstVisibleRegion.contains(northEast), isFalse); expect(firstVisibleRegion.contains(southWest), isFalse); - final LatLngBounds latLngBounds = LatLngBounds( + final latLngBounds = LatLngBounds( southwest: southWest, northeast: northEast, ); @@ -678,7 +678,7 @@ void main() { testWidgets('testTraffic', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -719,7 +719,7 @@ void main() { testWidgets('testBuildings', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -747,7 +747,7 @@ void main() { 'testMyLocationButtonToggle', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -797,7 +797,7 @@ void main() { 'testMyLocationButton initial value false', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -828,7 +828,7 @@ void main() { 'testMyLocationButton initial value true', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -856,7 +856,7 @@ void main() { testWidgets('testSetMapStyle valid Json String', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -874,7 +874,7 @@ void main() { final ExampleGoogleMapController controller = await controllerCompleter.future; - const String mapStyle = + const mapStyle = '[{"elementType":"geometry","stylers":[{"color":"#242f3e"}]}]'; await GoogleMapsFlutterPlatform.instance.setMapStyle( mapStyle, @@ -886,7 +886,7 @@ void main() { WidgetTester tester, ) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -919,7 +919,7 @@ void main() { testWidgets('testSetMapStyle null string', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -945,7 +945,7 @@ void main() { testWidgets('testGetLatLng', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -974,7 +974,7 @@ void main() { final LatLng topLeft = await controller.getLatLng( const ScreenCoordinate(x: 0, y: 0), ); - final LatLng northWest = LatLng( + final northWest = LatLng( visibleRegion.northeast.latitude, visibleRegion.southwest.longitude, ); @@ -984,7 +984,7 @@ void main() { testWidgets('testGetZoomLevel', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -1020,7 +1020,7 @@ void main() { testWidgets('testScreenCoordinate', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -1045,7 +1045,7 @@ void main() { await Future.delayed(const Duration(seconds: 1)); final LatLngBounds visibleRegion = await controller.getVisibleRegion(); - final LatLng northWest = LatLng( + final northWest = LatLng( visibleRegion.northeast.latitude, visibleRegion.southwest.longitude, ); @@ -1056,9 +1056,9 @@ void main() { }); testWidgets('testResizeWidget', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final ExampleGoogleMap map = ExampleGoogleMap( + final map = ExampleGoogleMap( initialCameraPosition: _kInitialCameraPosition, onMapCreated: (ExampleGoogleMapController controller) async { controllerCompleter.complete(controller); @@ -1097,13 +1097,13 @@ void main() { }); testWidgets('testToggleInfoWindow', (WidgetTester tester) async { - const Marker marker = Marker( + const marker = Marker( markerId: MarkerId('marker'), infoWindow: InfoWindow(title: 'InfoWindow'), ); - final Set markers = {marker}; + final markers = {marker}; - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -1157,7 +1157,7 @@ void main() { testWidgets( 'testTakeSnapshot', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -1185,15 +1185,15 @@ void main() { ); testWidgets('set tileOverlay correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); - final TileOverlay tileOverlay1 = TileOverlay( + final mapIdCompleter = Completer(); + final tileOverlay1 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 2, transparency: 0.2, ); - final TileOverlay tileOverlay2 = TileOverlay( + final tileOverlay2 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_2'), tileProvider: _DebugTileProvider(), zIndex: 1, @@ -1246,16 +1246,16 @@ void main() { }); testWidgets('update tileOverlays correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); - final TileOverlay tileOverlay1 = TileOverlay( + final tileOverlay1 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 2, transparency: 0.2, ); - final TileOverlay tileOverlay2 = TileOverlay( + final tileOverlay2 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_2'), tileProvider: _DebugTileProvider(), zIndex: 3, @@ -1279,7 +1279,7 @@ void main() { final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; - final TileOverlay tileOverlay1New = TileOverlay( + final tileOverlay1New = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 1, @@ -1325,9 +1325,9 @@ void main() { }); testWidgets('remove tileOverlays correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); - final TileOverlay tileOverlay1 = TileOverlay( + final tileOverlay1 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 2, @@ -1376,27 +1376,27 @@ void main() { testWidgets('marker clustering', (WidgetTester tester) async { final Key key = GlobalKey(); - const int clusterManagersAmount = 2; - const int markersPerClusterManager = 5; - final Map markers = {}; - final Set clusterManagers = {}; + const clusterManagersAmount = 2; + const markersPerClusterManager = 5; + final markers = {}; + final clusterManagers = {}; - for (int i = 0; i < clusterManagersAmount; i++) { - final ClusterManagerId clusterManagerId = ClusterManagerId( + for (var i = 0; i < clusterManagersAmount; i++) { + final clusterManagerId = ClusterManagerId( 'cluster_manager_$i', ); - final ClusterManager clusterManager = ClusterManager( + final clusterManager = ClusterManager( clusterManagerId: clusterManagerId, ); clusterManagers.add(clusterManager); } - for (final ClusterManager cm in clusterManagers) { - for (int i = 0; i < markersPerClusterManager; i++) { - final MarkerId markerId = MarkerId( + for (final cm in clusterManagers) { + for (var i = 0; i < markersPerClusterManager; i++) { + final markerId = MarkerId( '${cm.clusterManagerId.value}_marker_$i', ); - final Marker marker = Marker( + final marker = Marker( markerId: markerId, clusterManagerId: cm.clusterManagerId, position: LatLng( @@ -1408,7 +1408,7 @@ void main() { } } - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -1432,7 +1432,7 @@ void main() { final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; - for (final ClusterManager cm in clusterManagers) { + for (final cm in clusterManagers) { final List clusters = await inspector.getClusters( mapId: controller.mapId, clusterManagerId: cm.clusterManagerId, @@ -1459,7 +1459,7 @@ void main() { ), ); - for (final ClusterManager cm in clusterManagers) { + for (final cm in clusterManagers) { final List clusters = await inspector.getClusters( mapId: controller.mapId, clusterManagerId: cm.clusterManagerId, @@ -1469,7 +1469,7 @@ void main() { }); testWidgets('testCloudMapId', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -1493,7 +1493,7 @@ void main() { testWidgets('getStyleError reports last error', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -1513,7 +1513,7 @@ void main() { final ExampleGoogleMapController controller = await controllerCompleter.future; String? error = await controller.getStyleError(); - for (int i = 0; i < 1000 && error == null; i++) { + for (var i = 0; i < 1000 && error == null; i++) { await Future.delayed(const Duration(milliseconds: 10)); error = await controller.getStyleError(); } @@ -1524,7 +1524,7 @@ void main() { WidgetTester tester, ) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -1549,7 +1549,7 @@ void main() { }); testWidgets('markerWithAssetMapBitmap', (WidgetTester tester) async { - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: AssetMapBitmap('assets/red_square.png', imagePixelRatio: 1.0), @@ -1569,10 +1569,10 @@ void main() { }); testWidgets('markerWithAssetMapBitmapCreate', (WidgetTester tester) async { - final ImageConfiguration imageConfiguration = ImageConfiguration( + final imageConfiguration = ImageConfiguration( devicePixelRatio: tester.view.devicePixelRatio, ); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: await AssetMapBitmap.create( @@ -1596,7 +1596,7 @@ void main() { testWidgets('markerWithBytesMapBitmap', (WidgetTester tester) async { final Uint8List bytes = const Base64Decoder().convert(iconImageBase64); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: BytesMapBitmap( @@ -1620,11 +1620,11 @@ void main() { testWidgets('markerWithLegacyAsset', (WidgetTester tester) async { tester.view.devicePixelRatio = 2.0; - final ImageConfiguration imageConfiguration = ImageConfiguration( + final imageConfiguration = ImageConfiguration( devicePixelRatio: tester.view.devicePixelRatio, size: const Size(100, 100), ); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), // Intentionally testing the deprecated code path. @@ -1653,7 +1653,7 @@ void main() { testWidgets('markerWithLegacyBytes', (WidgetTester tester) async { tester.view.devicePixelRatio = 2.0; final Uint8List bytes = const Base64Decoder().convert(iconImageBase64); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), // Intentionally testing the deprecated code path. @@ -1677,12 +1677,12 @@ void main() { }); group('GroundOverlay', () { - final LatLngBounds kGroundOverlayBounds = LatLngBounds( + final kGroundOverlayBounds = LatLngBounds( southwest: const LatLng(37.77483, -122.41942), northeast: const LatLng(37.78183, -122.39105), ); - final GroundOverlay groundOverlayBounds1 = GroundOverlay.fromBounds( + final groundOverlayBounds1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('bounds_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -1692,7 +1692,7 @@ void main() { ), ); - final GroundOverlay groundOverlayPosition1 = GroundOverlay.fromPosition( + final groundOverlayPosition1 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('position_1'), position: kGroundOverlayBounds.northeast, width: 100, @@ -1747,8 +1747,8 @@ void main() { } testWidgets('set ground overlays correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); - final GroundOverlay groundOverlayBounds2 = GroundOverlay.fromBounds( + final mapIdCompleter = Completer(); + final groundOverlayBounds2 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('bounds_2'), bounds: groundOverlayBounds1.bounds!, image: groundOverlayBounds1.image, @@ -1805,7 +1805,7 @@ void main() { testWidgets('update ground overlays correctly', ( WidgetTester tester, ) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -1889,7 +1889,7 @@ void main() { testWidgets('remove ground overlays correctly', ( WidgetTester tester, ) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -1944,7 +1944,7 @@ void main() { 'testAnimateCameraWithoutDuration', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; @@ -2039,7 +2039,7 @@ void main() { 'testAnimateCameraWithDuration', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; @@ -2047,8 +2047,8 @@ void main() { /// Completer to track when the camera has come to rest. Completer? cameraIdleCompleter; - const int shortCameraAnimationDurationMS = 200; - const int longCameraAnimationDurationMS = 1000; + const shortCameraAnimationDurationMS = 200; + const longCameraAnimationDurationMS = 1000; /// Calculate the midpoint duration of the animation test, which will /// serve as a reference to verify that animations complete more quickly @@ -2057,7 +2057,7 @@ void main() { (shortCameraAnimationDurationMS + longCameraAnimationDurationMS) ~/ 2; // Stopwatch to measure the time taken for the animation to complete. - final Stopwatch stopwatch = Stopwatch(); + final stopwatch = Stopwatch(); await tester.pumpWidget( Directionality( @@ -2200,10 +2200,10 @@ class _DebugTileProvider implements TileProvider { @override Future getTile(int x, int y, int? zoom) async { - final ui.PictureRecorder recorder = ui.PictureRecorder(); - final Canvas canvas = Canvas(recorder); - final TextSpan textSpan = TextSpan(text: '$x,$y', style: textStyle); - final TextPainter textPainter = TextPainter( + final recorder = ui.PictureRecorder(); + final canvas = Canvas(recorder); + final textSpan = TextSpan(text: '$x,$y', style: textStyle); + final textPainter = TextPainter( text: textSpan, textDirection: TextDirection.ltr, ); @@ -2285,7 +2285,7 @@ Future _checkCameraUpdateByType( ) async { // As the target might differ a bit from the expected target, a threshold is // used. - const double latLngThreshold = 0.05; + const latLngThreshold = 0.05; switch (type) { case CameraUpdateType.newCameraPosition: diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/clustering.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/clustering.dart index ca60d810373..6d2719f0bd9 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/clustering.dart @@ -122,14 +122,14 @@ class ClusteringBodyState extends State { return; } - final String clusterManagerIdVal = + final clusterManagerIdVal = 'cluster_manager_id_$_clusterManagerIdCounter'; _clusterManagerIdCounter++; - final ClusterManagerId clusterManagerId = ClusterManagerId( + final clusterManagerId = ClusterManagerId( clusterManagerIdVal, ); - final ClusterManager clusterManager = ClusterManager( + final clusterManager = ClusterManager( clusterManagerId: clusterManagerId, onClusterTap: (Cluster cluster) => setState(() { lastCluster = cluster; @@ -155,11 +155,11 @@ class ClusteringBodyState extends State { } void _addMarkersToCluster(ClusterManager clusterManager) { - for (int i = 0; i < _markersToAddToClusterManagerCount; i++) { - final String markerIdVal = + for (var i = 0; i < _markersToAddToClusterManagerCount; i++) { + final markerIdVal = '${clusterManager.clusterManagerId.value}_marker_id_$_markerIdCounter'; _markerIdCounter++; - final MarkerId markerId = MarkerId(markerIdVal); + final markerId = MarkerId(markerIdVal); final int clusterManagerIndex = clusterManagers.values.toList().indexOf( clusterManager, @@ -170,7 +170,7 @@ class ClusteringBodyState extends State { final double clusterManagerLongitudeOffset = clusterManagerIndex * _clusterManagerLongitudeOffset; - final Marker marker = Marker( + final marker = Marker( clusterManagerId: clusterManager.clusterManagerId, markerId: markerId, position: LatLng( diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/custom_marker_icon.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/custom_marker_icon.dart index 6206787f347..548146c6206 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/custom_marker_icon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/custom_marker_icon.dart @@ -9,9 +9,9 @@ import 'package:flutter/material.dart'; /// Returns a generated png image in [ByteData] format with the requested size. Future createCustomMarkerIconImage({required Size size}) async { - final ui.PictureRecorder recorder = ui.PictureRecorder(); - final Canvas canvas = Canvas(recorder); - final _MarkerPainter painter = _MarkerPainter(); + final recorder = ui.PictureRecorder(); + final canvas = Canvas(recorder); + final painter = _MarkerPainter(); painter.paint(canvas, size); @@ -30,7 +30,7 @@ class _MarkerPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { final Rect rect = Offset.zero & size; - const RadialGradient gradient = RadialGradient( + const gradient = RadialGradient( colors: [Colors.yellow, Colors.red], stops: [0.4, 1.0], ); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/ground_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/ground_overlay.dart index 33f310de2b2..b3bf353d2d3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/ground_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/ground_overlay.dart @@ -95,7 +95,7 @@ class GroundOverlayBodyState extends State { _groundOverlayIndex += 1; - final GroundOverlayId id = GroundOverlayId( + final id = GroundOverlayId( 'ground_overlay_$_groundOverlayIndex', ); @@ -147,7 +147,7 @@ class GroundOverlayBodyState extends State { void _changeTransparency() { assert(_groundOverlay != null); setState(() { - final double transparency = _groundOverlay!.transparency == 0.0 + final transparency = _groundOverlay!.transparency == 0.0 ? 0.5 : 0.0; _groundOverlay = _groundOverlay!.copyWith( @@ -244,7 +244,7 @@ class GroundOverlayBodyState extends State { @override Widget build(BuildContext context) { - final Set overlays = { + final overlays = { if (_groundOverlay != null) _groundOverlay!, }; return Column( diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart index b980e1d2a64..8582a59a9c6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart @@ -98,13 +98,13 @@ Future initializeMapRenderer() async { return _initializedRendererCompleter!.future; } - final Completer completer = + final completer = Completer(); _initializedRendererCompleter = completer; WidgetsFlutterBinding.ensureInitialized(); - final GoogleMapsFlutterAndroid platform = + final platform = GoogleMapsFlutterPlatform.instance as GoogleMapsFlutterAndroid; unawaited( platform diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_click.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_click.dart index a2cbca5c7e0..4d45e961d63 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_click.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_click.dart @@ -41,7 +41,7 @@ class _MapClickBodyState extends State<_MapClickBody> { @override Widget build(BuildContext context) { - final ExampleGoogleMap googleMap = ExampleGoogleMap( + final googleMap = ExampleGoogleMap( onMapCreated: onMapCreated, initialCameraPosition: _kInitialPosition, onTap: (LatLng pos) { @@ -56,7 +56,7 @@ class _MapClickBodyState extends State<_MapClickBody> { }, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( @@ -66,8 +66,8 @@ class _MapClickBodyState extends State<_MapClickBody> { ]; if (mapController != null) { - final String lastTap = 'Tap:\n${_lastTap ?? ""}\n'; - final String lastLongPress = 'Long press:\n${_lastLongPress ?? ""}'; + final lastTap = 'Tap:\n${_lastTap ?? ""}\n'; + final lastLongPress = 'Long press:\n${_lastLongPress ?? ""}'; columnChildren.add( Center(child: Text(lastTap, textAlign: TextAlign.center)), ); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_coordinates.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_coordinates.dart index eee22bb5d7d..5ec74b708a4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_coordinates.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_coordinates.dart @@ -43,7 +43,7 @@ class _MapCoordinatesBodyState extends State<_MapCoordinatesBody> { @override Widget build(BuildContext context) { - final ExampleGoogleMap googleMap = ExampleGoogleMap( + final googleMap = ExampleGoogleMap( onMapCreated: onMapCreated, initialCameraPosition: _kInitialPosition, onCameraIdle: diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart index 039966595ba..306a522e8dc 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart @@ -73,7 +73,7 @@ class MapIdBodyState extends State { @override Widget build(BuildContext context) { - final ExampleGoogleMap googleMap = ExampleGoogleMap( + final googleMap = ExampleGoogleMap( onMapCreated: _onMapCreated, initialCameraPosition: const CameraPosition( target: _kMapCenter, @@ -83,7 +83,7 @@ class MapIdBodyState extends State { cloudMapId: _mapId, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_ui.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_ui.dart index 3cad6f0f84e..ce0d7d68378 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_ui.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_ui.dart @@ -265,7 +265,7 @@ class MapUiBodyState extends State { @override Widget build(BuildContext context) { - final ExampleGoogleMap googleMap = ExampleGoogleMap( + final googleMap = ExampleGoogleMap( onMapCreated: onMapCreated, initialCameraPosition: _kInitialPosition, compassEnabled: _compassEnabled, @@ -286,7 +286,7 @@ class MapUiBodyState extends State { onCameraMove: _updateCameraPosition, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/marker_icons.dart index 40df30c94ac..2959c7c0dcf 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/marker_icons.dart @@ -210,7 +210,7 @@ class MarkerIconsBodyState extends State { } Marker _createAssetMarker(int index) { - final LatLng position = LatLng( + final position = LatLng( _kMapCenter.latitude - (index * 0.5), _kMapCenter.longitude - 1, ); @@ -223,7 +223,7 @@ class MarkerIconsBodyState extends State { } Marker _createBytesMarker(int index) { - final LatLng position = LatLng( + final position = LatLng( _kMapCenter.latitude - (index * 0.5), _kMapCenter.longitude + 1, ); @@ -236,8 +236,8 @@ class MarkerIconsBodyState extends State { } void _updateMarkers() { - final Set markers = {}; - for (int i = 0; i < _markersAmountPerType; i++) { + final markers = {}; + for (var i = 0; i < _markersAmountPerType; i++) { if (_markerIconAsset != null) { markers.add(_createAssetMarker(i)); } @@ -299,7 +299,7 @@ class MarkerIconsBodyState extends State { final double? imagePixelRatio = _scalingEnabled ? devicePixelRatio : null; // Create canvasSize with physical marker size - final Size canvasSize = Size( + final canvasSize = Size( bitmapLogicalSize.width * (imagePixelRatio ?? 1.0), bitmapLogicalSize.height * (imagePixelRatio ?? 1.0), ); @@ -314,7 +314,7 @@ class MarkerIconsBodyState extends State { ? _getCurrentMarkerSize() : (null, null); - final BytesMapBitmap bitmap = BytesMapBitmap( + final bitmap = BytesMapBitmap( bytes.buffer.asUint8List(), imagePixelRatio: imagePixelRatio, width: width, diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/padding.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/padding.dart index 5154b88782b..beb39b305f5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/padding.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/padding.dart @@ -36,7 +36,7 @@ class MarkerIconsBodyState extends State { @override Widget build(BuildContext context) { - final ExampleGoogleMap googleMap = ExampleGoogleMap( + final googleMap = ExampleGoogleMap( onMapCreated: _onMapCreated, initialCameraPosition: const CameraPosition( target: _kMapCenter, @@ -45,7 +45,7 @@ class MarkerIconsBodyState extends State { padding: _padding, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_circle.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_circle.dart index d45ec7e5c27..88c84c79e12 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_circle.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_circle.dart @@ -83,11 +83,11 @@ class PlaceCircleBodyState extends State { return; } - final String circleIdVal = 'circle_id_$_circleIdCounter'; + final circleIdVal = 'circle_id_$_circleIdCounter'; _circleIdCounter++; - final CircleId circleId = CircleId(circleIdVal); + final circleId = CircleId(circleIdVal); - final Circle circle = Circle( + final circle = Circle( circleId: circleId, consumeTapEvents: true, strokeColor: Colors.orange, diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_marker.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_marker.dart index e32b7b27747..dd8d526d143 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_marker.dart @@ -123,11 +123,11 @@ class PlaceMarkerBodyState extends State { return; } - final String markerIdVal = 'marker_id_$_markerIdCounter'; + final markerIdVal = 'marker_id_$_markerIdCounter'; _markerIdCounter++; - final MarkerId markerId = MarkerId(markerIdVal); + final markerId = MarkerId(markerIdVal); - final Marker marker = Marker( + final marker = Marker( markerId: markerId, position: LatLng( center.latitude + sin(_markerIdCounter * pi / 6.0) / 20.0, @@ -155,7 +155,7 @@ class PlaceMarkerBodyState extends State { void _changePosition(MarkerId markerId) { final Marker marker = markers[markerId]!; final LatLng current = marker.position; - final Offset offset = Offset( + final offset = Offset( center.latitude - current.latitude, center.longitude - current.longitude, ); @@ -172,7 +172,7 @@ class PlaceMarkerBodyState extends State { void _changeAnchor(MarkerId markerId) { final Marker marker = markers[markerId]!; final Offset currentAnchor = marker.anchor; - final Offset newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); + final newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); setState(() { markers[markerId] = marker.copyWith(anchorParam: newAnchor); }); @@ -181,7 +181,7 @@ class PlaceMarkerBodyState extends State { Future _changeInfoAnchor(MarkerId markerId) async { final Marker marker = markers[markerId]!; final Offset currentAnchor = marker.infoWindow.anchor; - final Offset newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); + final newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); setState(() { markers[markerId] = marker.copyWith( infoWindowParam: marker.infoWindow.copyWith(anchorParam: newAnchor), @@ -205,7 +205,7 @@ class PlaceMarkerBodyState extends State { Future _changeInfo(MarkerId markerId) async { final Marker marker = markers[markerId]!; - final String newSnippet = '${marker.infoWindow.snippet!}*'; + final newSnippet = '${marker.infoWindow.snippet!}*'; setState(() { markers[markerId] = marker.copyWith( infoWindowParam: marker.infoWindow.copyWith(snippetParam: newSnippet), @@ -258,7 +258,7 @@ class PlaceMarkerBodyState extends State { } Future _getMarkerIcon(BuildContext context) async { - const Size canvasSize = Size(48, 48); + const canvasSize = Size(48, 48); final ByteData bytes = await createCustomMarkerIconImage(size: canvasSize); return BytesMapBitmap(bytes.buffer.asUint8List()); } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polygon.dart index 79475381c15..ff9eac82210 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polygon.dart @@ -82,10 +82,10 @@ class PlacePolygonBodyState extends State { return; } - final String polygonIdVal = 'polygon_id_$_polygonIdCounter'; - final PolygonId polygonId = PolygonId(polygonIdVal); + final polygonIdVal = 'polygon_id_$_polygonIdCounter'; + final polygonId = PolygonId(polygonIdVal); - final Polygon polygon = Polygon( + final polygon = Polygon( polygonId: polygonId, consumeTapEvents: true, strokeColor: Colors.orange, @@ -262,7 +262,7 @@ class PlacePolygonBodyState extends State { } List _createPoints() { - final List points = []; + final points = []; final double offset = _polygonIdCounter.ceilToDouble(); points.add(_createLatLng(51.2395 + offset, -3.4314)); points.add(_createLatLng(53.5234 + offset, -3.5314)); @@ -272,17 +272,17 @@ class PlacePolygonBodyState extends State { } List> _createHoles(PolygonId polygonId) { - final List> holes = >[]; + final holes = >[]; final double offset = polygonOffsets[polygonId]!; - final List hole1 = []; + final hole1 = []; hole1.add(_createLatLng(51.8395 + offset, -3.8814)); hole1.add(_createLatLng(52.0234 + offset, -3.9914)); hole1.add(_createLatLng(52.1351 + offset, -4.4435)); hole1.add(_createLatLng(52.0231 + offset, -4.5829)); holes.add(hole1); - final List hole2 = []; + final hole2 = []; hole2.add(_createLatLng(52.2395 + offset, -3.6814)); hole2.add(_createLatLng(52.4234 + offset, -3.7914)); hole2.add(_createLatLng(52.5351 + offset, -4.2435)); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polyline.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polyline.dart index 854046b3053..f749cac5f26 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polyline.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polyline.dart @@ -110,11 +110,11 @@ class PlacePolylineBodyState extends State { return; } - final String polylineIdVal = 'polyline_id_$_polylineIdCounter'; + final polylineIdVal = 'polyline_id_$_polylineIdCounter'; _polylineIdCounter++; - final PolylineId polylineId = PolylineId(polylineIdVal); + final polylineId = PolylineId(polylineIdVal); - final Polyline polyline = Polyline( + final polyline = Polyline( polylineId: polylineId, consumeTapEvents: true, color: Colors.orange, @@ -307,7 +307,7 @@ class PlacePolylineBodyState extends State { } List _createPoints() { - final List points = []; + final points = []; final double offset = _polylineIdCounter.ceilToDouble(); points.add(_createLatLng(51.4816 + offset, -3.1791)); points.add(_createLatLng(53.0430 + offset, -2.9925)); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/tile_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/tile_overlay.dart index 340ac4ce48d..19e06b672e2 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/tile_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/tile_overlay.dart @@ -53,7 +53,7 @@ class TileOverlayBodyState extends State { } void _addTileOverlay() { - final TileOverlay tileOverlay = TileOverlay( + final tileOverlay = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), ); @@ -70,7 +70,7 @@ class TileOverlayBodyState extends State { @override Widget build(BuildContext context) { - final Set overlays = { + final overlays = { if (_tileOverlay != null) _tileOverlay!, }; return Column( @@ -124,10 +124,10 @@ class _DebugTileProvider implements TileProvider { @override Future getTile(int x, int y, int? zoom) async { - final ui.PictureRecorder recorder = ui.PictureRecorder(); - final Canvas canvas = Canvas(recorder); - final TextSpan textSpan = TextSpan(text: '$x,$y', style: textStyle); - final TextPainter textPainter = TextPainter( + final recorder = ui.PictureRecorder(); + final canvas = Canvas(recorder); + final textSpan = TextSpan(text: '$x,$y', style: textStyle); + final textPainter = TextPainter( text: textSpan, textDirection: TextDirection.ltr, ); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/test/example_google_map_test.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/test/example_google_map_test.dart index 334dde79c77..b1d47642f7c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/test/example_google_map_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/test/example_google_map_test.dart @@ -40,10 +40,10 @@ void main() { testWidgets('circle updates with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Circle c1 = Circle(circleId: CircleId('circle_1')); - const Circle c2 = Circle(circleId: CircleId('circle_2')); - const Circle c3 = Circle(circleId: CircleId('circle_3'), radius: 1); - const Circle c3updated = Circle(circleId: CircleId('circle_3'), radius: 10); + const c1 = Circle(circleId: CircleId('circle_1')); + const c2 = Circle(circleId: CircleId('circle_2')); + const c3 = Circle(circleId: CircleId('circle_3'), radius: 1); + const c3updated = Circle(circleId: CircleId('circle_3'), radius: 10); // First remove one and add another, then update the new one. await tester.pumpWidget(_mapWithObjects(circles: {c1, c2})); @@ -72,10 +72,10 @@ void main() { testWidgets('marker updates with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Marker m1 = Marker(markerId: MarkerId('marker_1')); - const Marker m2 = Marker(markerId: MarkerId('marker_2')); - const Marker m3 = Marker(markerId: MarkerId('marker_3')); - const Marker m3updated = Marker( + const m1 = Marker(markerId: MarkerId('marker_1')); + const m2 = Marker(markerId: MarkerId('marker_2')); + const m3 = Marker(markerId: MarkerId('marker_3')); + const m3updated = Marker( markerId: MarkerId('marker_3'), draggable: true, ); @@ -107,13 +107,13 @@ void main() { testWidgets('polygon updates with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1')); - const Polygon p2 = Polygon(polygonId: PolygonId('polygon_2')); - const Polygon p3 = Polygon( + const p1 = Polygon(polygonId: PolygonId('polygon_1')); + const p2 = Polygon(polygonId: PolygonId('polygon_2')); + const p3 = Polygon( polygonId: PolygonId('polygon_3'), strokeWidth: 1, ); - const Polygon p3updated = Polygon( + const p3updated = Polygon( polygonId: PolygonId('polygon_3'), strokeWidth: 2, ); @@ -147,13 +147,13 @@ void main() { testWidgets('polyline updates with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1')); - const Polyline p2 = Polyline(polylineId: PolylineId('polyline_2')); - const Polyline p3 = Polyline( + const p1 = Polyline(polylineId: PolylineId('polyline_1')); + const p2 = Polyline(polylineId: PolylineId('polyline_2')); + const p3 = Polyline( polylineId: PolylineId('polyline_3'), width: 1, ); - const Polyline p3updated = Polyline( + const p3updated = Polyline( polylineId: PolylineId('polyline_3'), width: 2, ); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_map_inspector_android.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_map_inspector_android.dart index ef0b0aeb351..0c09c6d789e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_map_inspector_android.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_map_inspector_android.dart @@ -101,7 +101,7 @@ class GoogleMapsInspectorAndroid extends GoogleMapsInspectorPlatform { } // Create dummy image to represent the image of the ground overlay. - final BytesMapBitmap dummyImage = BytesMapBitmap( + final dummyImage = BytesMapBitmap( Uint8List.fromList([0]), bitmapScaling: MapBitmapScaling.none, ); 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 34d05ca6f8f..8ef94672fb1 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 @@ -332,7 +332,7 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { final Set previousSet = currentTileOverlays != null ? currentTileOverlays.values.toSet() : {}; - final _TileOverlayUpdates updates = _TileOverlayUpdates.from( + final updates = _TileOverlayUpdates.from( previousSet, newTileOverlays, ); @@ -565,7 +565,7 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { 'On Android width must be set when position is set for ground overlays.', ); - final PlatformMapViewCreationParams creationParams = + final creationParams = PlatformMapViewCreationParams( initialCameraPosition: _platformCameraPositionFromCameraPosition( widgetConfiguration.initialCameraPosition, @@ -597,7 +597,7 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { .toList(), ); - const String viewType = 'plugins.flutter.dev/google_maps_android'; + const viewType = 'plugins.flutter.dev/google_maps_android'; if (useAndroidViewSurface) { return PlatformViewLink( viewType: viewType, @@ -1386,7 +1386,7 @@ PlatformMapConfiguration _platformMapConfigurationFromOptionsJson( // to support this legacy API that relied on cross-package magic strings. final List? padding = (options['padding'] as List?) ?.cast(); - final int? mapType = options['mapType'] as int?; + final mapType = options['mapType'] as int?; return PlatformMapConfiguration( compassEnabled: options['compassEnabled'] as bool?, cameraTargetBounds: _platformCameraTargetBoundsFromCameraTargetBoundsJson( diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart index 7a9aca87b9a..cb5407cf5b5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart @@ -24,7 +24,7 @@ void _addIfNonNull(Map map, String fieldName, Object? value) { /// Serialize [Heatmap] Map serializeHeatmap(Heatmap heatmap) { - final Map json = {}; + final json = {}; _addIfNonNull(json, _heatmapIdKey, heatmap.heatmapId.value); _addIfNonNull( @@ -59,7 +59,7 @@ WeightedLatLng? deserializeWeightedLatLng(Object? json) { return null; } assert(json is List && json.length == 2); - final List list = json as List; + final list = json as List; final LatLng latLng = deserializeLatLng(list[0])!; return WeightedLatLng(latLng, weight: list[1] as double); } @@ -75,13 +75,13 @@ LatLng? deserializeLatLng(Object? json) { return null; } assert(json is List && json.length == 2); - final List list = json as List; + final list = json as List; return LatLng(list[0]! as double, list[1]! as double); } /// Serialize [HeatmapGradient] Object serializeHeatmapGradient(HeatmapGradient gradient) { - final Map json = {}; + final json = {}; _addIfNonNull( json, @@ -113,8 +113,8 @@ HeatmapGradient? deserializeHeatmapGradient(Object? json) { (map[_heatmapGradientStartPointsKey]! as List) .whereType() .toList(); - final List gradientColors = []; - for (int i = 0; i < colors.length; i++) { + final gradientColors = []; + for (var i = 0; i < colors.length; i++) { gradientColors.add(HeatmapGradientColor(colors[i], startPoints[i])); } return HeatmapGradient( diff --git a/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart b/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart index 3569b0098c3..64d5239328a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart @@ -23,8 +23,8 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); (GoogleMapsFlutterAndroid, MockMapsApi) setUpMockMap({required int mapId}) { - final MockMapsApi api = MockMapsApi(); - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid( + final api = MockMapsApi(); + final maps = GoogleMapsFlutterAndroid( apiProvider: (_) => api, ); maps.ensureApiInitialized(mapId); @@ -37,13 +37,13 @@ void main() { }); test('normal usage does not call MapsInitializerApi', () async { - final MockMapsApi api = MockMapsApi(); - final MockMapsInitializerApi initializerApi = MockMapsInitializerApi(); - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid( + final api = MockMapsApi(); + final initializerApi = MockMapsInitializerApi(); + final maps = GoogleMapsFlutterAndroid( apiProvider: (_) => api, initializerApi: initializerApi, ); - const int mapId = 1; + const mapId = 1; maps.ensureApiInitialized(mapId); await maps.init(1); @@ -53,9 +53,9 @@ void main() { test( 'initializeWithPreferredRenderer forwards the initialization call', () async { - final MockMapsApi api = MockMapsApi(); - final MockMapsInitializerApi initializerApi = MockMapsInitializerApi(); - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid( + final api = MockMapsApi(); + final initializerApi = MockMapsInitializerApi(); + final maps = GoogleMapsFlutterAndroid( apiProvider: (_) => api, initializerApi: initializerApi, ); @@ -70,9 +70,9 @@ void main() { ); test('warmup forwards the initialization call', () async { - final MockMapsApi api = MockMapsApi(); - final MockMapsInitializerApi initializerApi = MockMapsInitializerApi(); - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid( + final api = MockMapsApi(); + final initializerApi = MockMapsInitializerApi(); + final maps = GoogleMapsFlutterAndroid( apiProvider: (_) => api, initializerApi: initializerApi, ); @@ -82,8 +82,8 @@ void main() { }); test('init calls waitForMap', () async { - final MockMapsApi api = MockMapsApi(); - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid( + final api = MockMapsApi(); + final maps = GoogleMapsFlutterAndroid( apiProvider: (_) => api, ); @@ -93,14 +93,14 @@ void main() { }); test('getScreenCoordinate converts and passes values correctly', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); // Arbitrary values that are all different from each other. - const LatLng latLng = LatLng(10, 20); - const ScreenCoordinate expectedCoord = ScreenCoordinate(x: 30, y: 40); + const latLng = LatLng(10, 20); + const expectedCoord = ScreenCoordinate(x: 30, y: 40); when(api.getScreenCoordinate(any)).thenAnswer( (_) async => PlatformPoint(x: expectedCoord.x, y: expectedCoord.y), ); @@ -113,21 +113,21 @@ void main() { final VerificationResult verification = verify( api.getScreenCoordinate(captureAny), ); - final PlatformLatLng passedLatLng = + final passedLatLng = verification.captured[0] as PlatformLatLng; expect(passedLatLng.latitude, latLng.latitude); expect(passedLatLng.longitude, latLng.longitude); }); test('getLatLng converts and passes values correctly', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); // Arbitrary values that are all different from each other. - const LatLng expectedLatLng = LatLng(10, 20); - const ScreenCoordinate coord = ScreenCoordinate(x: 30, y: 40); + const expectedLatLng = LatLng(10, 20); + const coord = ScreenCoordinate(x: 30, y: 40); when(api.getLatLng(any)).thenAnswer( (_) async => PlatformLatLng( latitude: expectedLatLng.latitude, @@ -138,19 +138,19 @@ void main() { final LatLng latLng = await maps.getLatLng(coord, mapId: mapId); expect(latLng, expectedLatLng); final VerificationResult verification = verify(api.getLatLng(captureAny)); - final PlatformPoint passedCoord = verification.captured[0] as PlatformPoint; + final passedCoord = verification.captured[0] as PlatformPoint; expect(passedCoord.x, coord.x); expect(passedCoord.y, coord.y); }); test('getVisibleRegion converts and passes values correctly', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); // Arbitrary values that are all different from each other. - final LatLngBounds expectedBounds = LatLngBounds( + final expectedBounds = LatLngBounds( southwest: const LatLng(10, 20), northeast: const LatLng(30, 40), ); @@ -172,7 +172,7 @@ void main() { }); test('moveCamera calls through with expected scrollBy', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); @@ -181,9 +181,9 @@ void main() { await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateScrollBy scroll = + final scroll = passedUpdate.cameraUpdate as PlatformCameraUpdateScrollBy; update as CameraUpdateScrollBy; expect(scroll.dx, update.dx); @@ -191,7 +191,7 @@ void main() { }); test('animateCamera calls through with expected scrollBy', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); @@ -202,25 +202,25 @@ void main() { final VerificationResult verification = verify( api.animateCamera(captureAny, captureAny), ); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateScrollBy scroll = + final scroll = passedUpdate.cameraUpdate as PlatformCameraUpdateScrollBy; update as CameraUpdateScrollBy; expect(scroll.dx, update.dx); expect(scroll.dy, update.dy); - final int? passedDuration = verification.captured[1] as int?; + final passedDuration = verification.captured[1] as int?; expect(passedDuration, isNull); }); test('animateCameraWithConfiguration calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); final CameraUpdate update = CameraUpdate.scrollBy(10, 20); - const CameraUpdateAnimationConfiguration configuration = + const configuration = CameraUpdateAnimationConfiguration(duration: Duration(seconds: 1)); expect(configuration.duration?.inSeconds, 1); await maps.animateCameraWithConfiguration( @@ -232,25 +232,25 @@ void main() { final VerificationResult verification = verify( api.animateCamera(captureAny, captureAny), ); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateScrollBy scroll = + final scroll = passedUpdate.cameraUpdate as PlatformCameraUpdateScrollBy; update as CameraUpdateScrollBy; expect(scroll.dx, update.dx); expect(scroll.dy, update.dy); - final int? passedDuration = verification.captured[1] as int?; + final passedDuration = verification.captured[1] as int?; expect(passedDuration, configuration.duration?.inMilliseconds); }); test('getZoomLevel passes values correctly', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const double expectedZoom = 4.2; + const expectedZoom = 4.2; when(api.getZoomLevel()).thenAnswer((_) async => expectedZoom); final double zoom = await maps.getZoomLevel(mapId: mapId); @@ -258,36 +258,36 @@ void main() { }); test('showInfoWindow calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const String markedId = 'a_marker'; + const markedId = 'a_marker'; await maps.showMarkerInfoWindow(const MarkerId(markedId), mapId: mapId); verify(api.showInfoWindow(markedId)); }); test('hideInfoWindow calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const String markedId = 'a_marker'; + const markedId = 'a_marker'; await maps.hideMarkerInfoWindow(const MarkerId(markedId), mapId: mapId); verify(api.hideInfoWindow(markedId)); }); test('isInfoWindowShown calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const String markedId = 'a_marker'; + const markedId = 'a_marker'; when(api.isInfoWindowShown(markedId)).thenAnswer((_) async => true); expect( @@ -300,43 +300,43 @@ void main() { }); test('takeSnapshot calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - final Uint8List fakeSnapshot = Uint8List(10); + final fakeSnapshot = Uint8List(10); when(api.takeSnapshot()).thenAnswer((_) async => fakeSnapshot); expect(await maps.takeSnapshot(mapId: mapId), fakeSnapshot); }); test('clearTileCache calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const String tileOverlayId = 'overlay'; + const tileOverlayId = 'overlay'; await maps.clearTileCache(const TileOverlayId(tileOverlayId), mapId: mapId); verify(api.clearTileCache(tileOverlayId)); }); test('updateMapConfiguration passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); // Set some arbitrary options. - final CameraTargetBounds cameraBounds = CameraTargetBounds( + final cameraBounds = CameraTargetBounds( LatLngBounds( southwest: const LatLng(10, 20), northeast: const LatLng(30, 40), ), ); - final MapConfiguration config = MapConfiguration( + final config = MapConfiguration( compassEnabled: true, mapType: MapType.terrain, cameraTargetBounds: cameraBounds, @@ -346,7 +346,7 @@ void main() { final VerificationResult verification = verify( api.updateMapConfiguration(captureAny), ); - final PlatformMapConfiguration passedConfig = + final passedConfig = verification.captured[0] as PlatformMapConfiguration; // Each set option should be present. expect(passedConfig.compassEnabled, true); @@ -374,19 +374,19 @@ void main() { }); test('updateMapOptions passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); // Set some arbitrary options. - final CameraTargetBounds cameraBounds = CameraTargetBounds( + final cameraBounds = CameraTargetBounds( LatLngBounds( southwest: const LatLng(10, 20), northeast: const LatLng(30, 40), ), ); - final Map config = { + final config = { 'compassEnabled': true, 'mapType': MapType.terrain.index, 'cameraTargetBounds': cameraBounds.toJson(), @@ -396,7 +396,7 @@ void main() { final VerificationResult verification = verify( api.updateMapConfiguration(captureAny), ); - final PlatformMapConfiguration passedConfig = + final passedConfig = verification.captured[0] as PlatformMapConfiguration; // Each set option should be present. expect(passedConfig.compassEnabled, true); @@ -424,15 +424,15 @@ void main() { }); test('updateCircles passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const Circle object1 = Circle(circleId: CircleId('1')); - const Circle object2old = Circle(circleId: CircleId('2')); + const object1 = Circle(circleId: CircleId('1')); + const object2old = Circle(circleId: CircleId('2')); final Circle object2new = object2old.copyWith(radiusParam: 42); - const Circle object3 = Circle(circleId: CircleId('3')); + const object3 = Circle(circleId: CircleId('3')); await maps.updateCircles( CircleUpdates.from( {object1, object2old}, @@ -444,11 +444,11 @@ void main() { final VerificationResult verification = verify( api.updateCircles(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; // Object one should be removed. expect(toRemove.length, 1); expect(toRemove.first, object1.circleId.value); @@ -485,15 +485,15 @@ void main() { }); test('updateClusterManagers passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const ClusterManager object1 = ClusterManager( + const object1 = ClusterManager( clusterManagerId: ClusterManagerId('1'), ); - const ClusterManager object3 = ClusterManager( + const object3 = ClusterManager( clusterManagerId: ClusterManagerId('3'), ); await maps.updateClusterManagers( @@ -507,9 +507,9 @@ void main() { final VerificationResult verification = verify( api.updateClusterManagers(captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toRemove = verification.captured[1] as List; + final toRemove = verification.captured[1] as List; // Object one should be removed. expect(toRemove.length, 1); expect(toRemove.first, object1.clusterManagerId.value); @@ -521,15 +521,15 @@ void main() { }); test('updateMarkers passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const Marker object1 = Marker(markerId: MarkerId('1')); - const Marker object2old = Marker(markerId: MarkerId('2')); + const object1 = Marker(markerId: MarkerId('1')); + const object2old = Marker(markerId: MarkerId('2')); final Marker object2new = object2old.copyWith(rotationParam: 42); - const Marker object3 = Marker(markerId: MarkerId('3')); + const object3 = Marker(markerId: MarkerId('3')); await maps.updateMarkers( MarkerUpdates.from( {object1, object2old}, @@ -541,11 +541,11 @@ void main() { final VerificationResult verification = verify( api.updateMarkers(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; // Object one should be removed. expect(toRemove.length, 1); expect(toRemove.first, object1.markerId.value); @@ -610,15 +610,15 @@ void main() { }); test('updatePolygons passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const Polygon object1 = Polygon(polygonId: PolygonId('1')); - const Polygon object2old = Polygon(polygonId: PolygonId('2')); + const object1 = Polygon(polygonId: PolygonId('1')); + const object2old = Polygon(polygonId: PolygonId('2')); final Polygon object2new = object2old.copyWith(strokeWidthParam: 42); - const Polygon object3 = Polygon(polygonId: PolygonId('3')); + const object3 = Polygon(polygonId: PolygonId('3')); await maps.updatePolygons( PolygonUpdates.from( {object1, object2old}, @@ -630,11 +630,11 @@ void main() { final VerificationResult verification = verify( api.updatePolygons(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; // Object one should be removed. expect(toRemove.length, 1); expect(toRemove.first, object1.polygonId.value); @@ -671,13 +671,13 @@ void main() { }); test('updatePolylines passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const Polyline object1 = Polyline(polylineId: PolylineId('1')); - const Polyline object2old = Polyline(polylineId: PolylineId('2')); + const object1 = Polyline(polylineId: PolylineId('1')); + const object2old = Polyline(polylineId: PolylineId('2')); final Polyline object2new = object2old.copyWith( widthParam: 42, startCapParam: Cap.squareCap, @@ -687,7 +687,7 @@ void main() { BitmapDescriptor.defaultMarker, refWidth: 15, ); - final Polyline object3 = Polyline( + final object3 = Polyline( polylineId: const PolylineId('3'), startCap: customCap, endCap: Cap.roundCap, @@ -703,11 +703,11 @@ void main() { final VerificationResult verification = verify( api.updatePolylines(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; void expectPolyline(PlatformPolyline actual, Polyline expected) { expect(actual.polylineId, expected.polylineId.value); expect(actual.consumesTapEvents, expected.consumeTapEvents); @@ -763,17 +763,17 @@ void main() { }); test('updateTileOverlays passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const TileOverlay object1 = TileOverlay(tileOverlayId: TileOverlayId('1')); - const TileOverlay object2old = TileOverlay( + const object1 = TileOverlay(tileOverlayId: TileOverlayId('1')); + const object2old = TileOverlay( tileOverlayId: TileOverlayId('2'), ); final TileOverlay object2new = object2old.copyWith(zIndexParam: 42); - const TileOverlay object3 = TileOverlay(tileOverlayId: TileOverlayId('3')); + const object3 = TileOverlay(tileOverlayId: TileOverlayId('3')); // Pre-set the initial state, since this update method doesn't take the old // state. await maps.updateTileOverlays( @@ -790,11 +790,11 @@ void main() { final VerificationResult verification = verify( api.updateTileOverlays(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; void expectTileOverlay(PlatformTileOverlay actual, TileOverlay expected) { expect(actual.tileOverlayId, expected.tileOverlayId.value); expect(actual.fadeIn, expected.fadeIn); @@ -816,18 +816,18 @@ void main() { }); test('updateGroundOverlays passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - final AssetMapBitmap image = AssetMapBitmap( + final image = AssetMapBitmap( 'assets/red_square.png', imagePixelRatio: 1.0, bitmapScaling: MapBitmapScaling.none, ); - final GroundOverlay object1 = GroundOverlay.fromBounds( + final object1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('1'), bounds: LatLngBounds( southwest: const LatLng(10, 20), @@ -835,7 +835,7 @@ void main() { ), image: image, ); - final GroundOverlay object2old = GroundOverlay.fromBounds( + final object2old = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('2'), bounds: LatLngBounds( southwest: const LatLng(10, 20), @@ -850,7 +850,7 @@ void main() { transparencyParam: 0.5, zIndexParam: 100, ); - final GroundOverlay object3 = GroundOverlay.fromPosition( + final object3 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('3'), position: const LatLng(10, 20), width: 100, @@ -868,11 +868,11 @@ void main() { api.updateGroundOverlays(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; // Object one should be removed. expect(toRemove.length, 1); expect(toRemove.first, object1.groundOverlayId.value); @@ -957,18 +957,18 @@ void main() { test( 'updateGroundOverlays throws assertion error on unsupported ground overlays', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - final AssetMapBitmap image = AssetMapBitmap( + final image = AssetMapBitmap( 'assets/red_square.png', imagePixelRatio: 1.0, bitmapScaling: MapBitmapScaling.none, ); - final GroundOverlay groundOverlay = GroundOverlay.fromPosition( + final groundOverlay = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('1'), position: const LatLng(10, 20), // Assert should be thrown because width is not set for position-based @@ -1006,25 +1006,25 @@ void main() { ); test('markers send drag event to correct streams', () async { - const int mapId = 1; - const String dragStartId = 'drag-start-marker'; - const String dragId = 'drag-marker'; - const String dragEndId = 'drag-end-marker'; - final PlatformLatLng fakePosition = PlatformLatLng( + const mapId = 1; + const dragStartId = 'drag-start-marker'; + const dragId = 'drag-marker'; + const dragEndId = 'drag-end-marker'; + final fakePosition = PlatformLatLng( latitude: 1.0, longitude: 1.0, ); - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid(); + final maps = GoogleMapsFlutterAndroid(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue markerDragStartStream = + final markerDragStartStream = StreamQueue(maps.onMarkerDragStart(mapId: mapId)); - final StreamQueue markerDragStream = + final markerDragStream = StreamQueue(maps.onMarkerDrag(mapId: mapId)); - final StreamQueue markerDragEndStream = + final markerDragEndStream = StreamQueue(maps.onMarkerDragEnd(mapId: mapId)); // Simulate messages from the native side. @@ -1038,15 +1038,15 @@ void main() { }); test('markers send tap events to correct stream', () async { - const int mapId = 1; - const String objectId = 'object-id'; + const mapId = 1; + const objectId = 'object-id'; - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid(); + final maps = GoogleMapsFlutterAndroid(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = StreamQueue( + final stream = StreamQueue( maps.onMarkerTap(mapId: mapId), ); @@ -1057,15 +1057,15 @@ void main() { }); test('circles send tap events to correct stream', () async { - const int mapId = 1; - const String objectId = 'object-id'; + const mapId = 1; + const objectId = 'object-id'; - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid(); + final maps = GoogleMapsFlutterAndroid(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = StreamQueue( + final stream = StreamQueue( maps.onCircleTap(mapId: mapId), ); @@ -1076,30 +1076,30 @@ void main() { }); test('clusters send tap events to correct stream', () async { - const int mapId = 1; - const String managerId = 'manager-id'; - final PlatformLatLng fakePosition = PlatformLatLng( + const mapId = 1; + const managerId = 'manager-id'; + final fakePosition = PlatformLatLng( latitude: 10, longitude: 20, ); - final PlatformLatLngBounds fakeBounds = PlatformLatLngBounds( + final fakeBounds = PlatformLatLngBounds( southwest: PlatformLatLng(latitude: 30, longitude: 40), northeast: PlatformLatLng(latitude: 50, longitude: 60), ); - const List markerIds = ['marker-1', 'marker-2']; - final PlatformCluster cluster = PlatformCluster( + const markerIds = ['marker-1', 'marker-2']; + final cluster = PlatformCluster( clusterManagerId: managerId, position: fakePosition, bounds: fakeBounds, markerIds: markerIds, ); - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid(); + final maps = GoogleMapsFlutterAndroid(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = StreamQueue( + final stream = StreamQueue( maps.onClusterTap(mapId: mapId), ); @@ -1125,15 +1125,15 @@ void main() { }); test('polygons send tap events to correct stream', () async { - const int mapId = 1; - const String objectId = 'object-id'; + const mapId = 1; + const objectId = 'object-id'; - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid(); + final maps = GoogleMapsFlutterAndroid(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = StreamQueue( + final stream = StreamQueue( maps.onPolygonTap(mapId: mapId), ); @@ -1144,15 +1144,15 @@ void main() { }); test('polylines send tap events to correct stream', () async { - const int mapId = 1; - const String objectId = 'object-id'; + const mapId = 1; + const objectId = 'object-id'; - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid(); + final maps = GoogleMapsFlutterAndroid(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = StreamQueue( + final stream = StreamQueue( maps.onPolylineTap(mapId: mapId), ); @@ -1163,15 +1163,15 @@ void main() { }); test('ground overlays send tap events to correct stream', () async { - const int mapId = 1; - const String objectId = 'object-id'; + const mapId = 1; + const objectId = 'object-id'; - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid(); + final maps = GoogleMapsFlutterAndroid(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = + final stream = StreamQueue( maps.onGroundOverlayTap(mapId: mapId), ); @@ -1183,7 +1183,7 @@ void main() { }); test('Does not use PlatformViewLink when using TLHC', () async { - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid(); + final maps = GoogleMapsFlutterAndroid(); maps.useAndroidViewSurface = false; final Widget widget = maps.buildViewWithConfiguration( 1, @@ -1198,20 +1198,20 @@ void main() { }); test('moveCamera calls through with expected newCameraPosition', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const LatLng latLng = LatLng(10.0, 20.0); - const CameraPosition position = CameraPosition(target: latLng); + const latLng = LatLng(10.0, 20.0); + const position = CameraPosition(target: latLng); final CameraUpdate update = CameraUpdate.newCameraPosition(position); await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateNewCameraPosition typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateNewCameraPosition; update as CameraUpdateNewCameraPosition; expect( @@ -1225,19 +1225,19 @@ void main() { }); test('moveCamera calls through with expected newLatLng', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const LatLng latLng = LatLng(10.0, 20.0); + const latLng = LatLng(10.0, 20.0); final CameraUpdate update = CameraUpdate.newLatLng(latLng); await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateNewLatLng typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateNewLatLng; update as CameraUpdateNewLatLng; expect(typedUpdate.latLng.latitude, update.latLng.latitude); @@ -1245,12 +1245,12 @@ void main() { }); test('moveCamera calls through with expected newLatLngBounds', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - final LatLngBounds latLng = LatLngBounds( + final latLng = LatLngBounds( northeast: const LatLng(10.0, 20.0), southwest: const LatLng(9.0, 21.0), ); @@ -1258,9 +1258,9 @@ void main() { await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateNewLatLngBounds typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateNewLatLngBounds; update as CameraUpdateNewLatLngBounds; expect( @@ -1283,19 +1283,19 @@ void main() { }); test('moveCamera calls through with expected newLatLngZoom', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const LatLng latLng = LatLng(10.0, 20.0); + const latLng = LatLng(10.0, 20.0); final CameraUpdate update = CameraUpdate.newLatLngZoom(latLng, 2.0); await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateNewLatLngZoom typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateNewLatLngZoom; update as CameraUpdateNewLatLngZoom; expect(typedUpdate.latLng.latitude, update.latLng.latitude); @@ -1304,19 +1304,19 @@ void main() { }); test('moveCamera calls through with expected zoomBy', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const Offset focus = Offset(10.0, 20.0); + const focus = Offset(10.0, 20.0); final CameraUpdate update = CameraUpdate.zoomBy(2.0, focus); await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateZoomBy typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateZoomBy; update as CameraUpdateZoomBy; expect(typedUpdate.focus?.x, update.focus?.dx); @@ -1325,7 +1325,7 @@ void main() { }); test('moveCamera calls through with expected zoomTo', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); @@ -1334,16 +1334,16 @@ void main() { await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateZoomTo typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateZoomTo; update as CameraUpdateZoomTo; expect(typedUpdate.zoom, update.zoom); }); test('moveCamera calls through with expected zoomIn', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); @@ -1352,15 +1352,15 @@ void main() { await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateZoom typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateZoom; expect(typedUpdate.out, false); }); test('moveCamera calls through with expected zoomOut', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterAndroid maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); @@ -1369,9 +1369,9 @@ void main() { await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateZoom typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateZoom; expect(typedUpdate.out, true); }); @@ -1396,13 +1396,13 @@ void main() { final PlatformBitmap platformBitmap = GoogleMapsFlutterAndroid.platformBitmapFromBitmapDescriptor(bitmap); expect(platformBitmap.bitmap, isA()); - final PlatformBitmapDefaultMarker typedBitmap = + final typedBitmap = platformBitmap.bitmap as PlatformBitmapDefaultMarker; expect(typedBitmap.hue, 10.0); }); test('BytesMapBitmap bitmap to PlatformBitmap', () { - final Uint8List data = Uint8List.fromList([1, 2, 3, 4]); + final data = Uint8List.fromList([1, 2, 3, 4]); final BytesMapBitmap bitmap = BitmapDescriptor.bytes( data, imagePixelRatio: 2.0, @@ -1412,7 +1412,7 @@ void main() { final PlatformBitmap platformBitmap = GoogleMapsFlutterAndroid.platformBitmapFromBitmapDescriptor(bitmap); expect(platformBitmap.bitmap, isA()); - final PlatformBitmapBytesMap typedBitmap = + final typedBitmap = platformBitmap.bitmap as PlatformBitmapBytesMap; expect(typedBitmap.byteData, data); expect(typedBitmap.bitmapScaling, PlatformMapBitmapScaling.auto); @@ -1422,8 +1422,8 @@ void main() { }); test('AssetMapBitmap bitmap to PlatformBitmap', () { - const String assetName = 'fake_asset_name'; - final AssetMapBitmap bitmap = AssetMapBitmap( + const assetName = 'fake_asset_name'; + final bitmap = AssetMapBitmap( assetName, imagePixelRatio: 2.0, width: 100.0, @@ -1432,7 +1432,7 @@ void main() { final PlatformBitmap platformBitmap = GoogleMapsFlutterAndroid.platformBitmapFromBitmapDescriptor(bitmap); expect(platformBitmap.bitmap, isA()); - final PlatformBitmapAssetMap typedBitmap = + final typedBitmap = platformBitmap.bitmap as PlatformBitmapAssetMap; expect(typedBitmap.assetName, assetName); expect(typedBitmap.bitmapScaling, PlatformMapBitmapScaling.auto); @@ -1456,7 +1456,7 @@ void main() { ); const BitmapDescriptor bitmap = BitmapDescriptor.defaultMarker; - const CustomCap customCap = CustomCap(bitmap, refWidth: 15.0); + const customCap = CustomCap(bitmap, refWidth: 15.0); final PlatformCap platformCap = GoogleMapsFlutterAndroid.platformCapFromCap( customCap, ); @@ -1467,7 +1467,7 @@ void main() { testWidgets('Use PlatformViewLink when using surface view', ( WidgetTester tester, ) async { - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid(); + final maps = GoogleMapsFlutterAndroid(); maps.useAndroidViewSurface = true; final Widget widget = maps.buildViewWithConfiguration( @@ -1483,7 +1483,7 @@ void main() { }); testWidgets('Defaults to AndroidView', (WidgetTester tester) async { - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid(); + final maps = GoogleMapsFlutterAndroid(); final Widget widget = maps.buildViewWithConfiguration( 1, @@ -1498,21 +1498,21 @@ void main() { }); testWidgets('cloudMapId is passed', (WidgetTester tester) async { - const String cloudMapId = '000000000000000'; // Dummy map ID. - final Completer passedCloudMapIdCompleter = Completer(); + const cloudMapId = '000000000000000'; // Dummy map ID. + final passedCloudMapIdCompleter = Completer(); TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler(SystemChannels.platform_views, ( MethodCall methodCall, ) async { if (methodCall.method == 'create') { - final Map args = Map.from( + final args = Map.from( methodCall.arguments as Map, ); if (args.containsKey('params')) { - final Uint8List paramsUint8List = args['params'] as Uint8List; - final ByteData byteData = ByteData.sublistView(paramsUint8List); - final PlatformMapViewCreationParams? creationParams = + final paramsUint8List = args['params'] as Uint8List; + final byteData = ByteData.sublistView(paramsUint8List); + final creationParams = MapsApi.pigeonChannelCodec.decodeMessage(byteData) as PlatformMapViewCreationParams?; if (creationParams != null) { @@ -1527,7 +1527,7 @@ void main() { return 0; }); - final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid(); + final maps = GoogleMapsFlutterAndroid(); await tester.pumpWidget( maps.buildViewWithConfiguration( diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart index 5eb14dbdd0e..5aaa8ba6a2f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart @@ -50,7 +50,7 @@ void main() { testWidgets('testCompassToggle', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -90,7 +90,7 @@ void main() { testWidgets('testMapToolbar returns false', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -117,11 +117,11 @@ void main() { testWidgets('updateMinMaxZoomLevels', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); - const MinMaxZoomPreference initialZoomLevel = MinMaxZoomPreference(4, 8); - const MinMaxZoomPreference finalZoomLevel = MinMaxZoomPreference(6, 10); + const initialZoomLevel = MinMaxZoomPreference(4, 8); + const finalZoomLevel = MinMaxZoomPreference(6, 10); await tester.pumpWidget( Directionality( @@ -167,7 +167,7 @@ void main() { testWidgets('testZoomGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -210,7 +210,7 @@ void main() { testWidgets('testZoomControlsEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -238,7 +238,7 @@ void main() { testWidgets('testRotateGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -283,7 +283,7 @@ void main() { testWidgets('testTiltGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -326,7 +326,7 @@ void main() { testWidgets('testScrollGesturesEnabled', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -374,7 +374,7 @@ void main() { (WidgetTester tester) async { await tester.binding.setSurfaceSize(const Size(800, 600)); - final Completer mapControllerCompleter = + final mapControllerCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -415,12 +415,12 @@ void main() { 'testGetVisibleRegion', (WidgetTester tester) async { final Key key = GlobalKey(); - final LatLngBounds zeroLatLngBounds = LatLngBounds( + final zeroLatLngBounds = LatLngBounds( southwest: const LatLng(0, 0), northeast: const LatLng(0, 0), ); - final Completer mapControllerCompleter = + final mapControllerCompleter = Completer(); await tester.pumpWidget( @@ -451,15 +451,15 @@ void main() { // Making a new `LatLngBounds` about (10, 10) distance south west to the `firstVisibleRegion`. // The size of the `LatLngBounds` is 10 by 10. - final LatLng southWest = LatLng( + final southWest = LatLng( firstVisibleRegion.southwest.latitude - 20, firstVisibleRegion.southwest.longitude - 20, ); - final LatLng northEast = LatLng( + final northEast = LatLng( firstVisibleRegion.southwest.latitude - 10, firstVisibleRegion.southwest.longitude - 10, ); - final LatLng newCenter = LatLng( + final newCenter = LatLng( (northEast.latitude + southWest.latitude) / 2, (northEast.longitude + southWest.longitude) / 2, ); @@ -467,7 +467,7 @@ void main() { expect(firstVisibleRegion.contains(northEast), isFalse); expect(firstVisibleRegion.contains(southWest), isFalse); - final LatLngBounds latLngBounds = LatLngBounds( + final latLngBounds = LatLngBounds( southwest: southWest, northeast: northEast, ); @@ -497,7 +497,7 @@ void main() { testWidgets('testTraffic', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -538,7 +538,7 @@ void main() { testWidgets('testBuildings', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -564,7 +564,7 @@ void main() { testWidgets('testMyLocationButtonToggle', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -611,7 +611,7 @@ void main() { WidgetTester tester, ) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -639,7 +639,7 @@ void main() { WidgetTester tester, ) async { final Key key = GlobalKey(); - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -664,7 +664,7 @@ void main() { testWidgets('testSetMapStyle valid Json String', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -682,7 +682,7 @@ void main() { final ExampleGoogleMapController controller = await controllerCompleter.future; - const String mapStyle = + const mapStyle = '[{"elementType":"geometry","stylers":[{"color":"#242f3e"}]}]'; await GoogleMapsFlutterPlatform.instance.setMapStyle( mapStyle, @@ -694,7 +694,7 @@ void main() { WidgetTester tester, ) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -727,7 +727,7 @@ void main() { testWidgets('testSetMapStyle null string', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -753,7 +753,7 @@ void main() { testWidgets('testGetLatLng', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -782,7 +782,7 @@ void main() { final LatLng topLeft = await controller.getLatLng( const ScreenCoordinate(x: 0, y: 0), ); - final LatLng northWest = LatLng( + final northWest = LatLng( visibleRegion.northeast.latitude, visibleRegion.southwest.longitude, ); @@ -794,7 +794,7 @@ void main() { 'testGetZoomLevel', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -835,7 +835,7 @@ void main() { 'testScreenCoordinate', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -860,7 +860,7 @@ void main() { await Future.delayed(const Duration(seconds: 1)); final LatLngBounds visibleRegion = await controller.getVisibleRegion(); - final LatLng northWest = LatLng( + final northWest = LatLng( visibleRegion.northeast.latitude, visibleRegion.southwest.longitude, ); @@ -874,9 +874,9 @@ void main() { ); testWidgets('testResizeWidget', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final ExampleGoogleMap map = ExampleGoogleMap( + final map = ExampleGoogleMap( initialCameraPosition: _kInitialCameraPosition, onMapCreated: (ExampleGoogleMapController controller) async { controllerCompleter.complete(controller); @@ -915,13 +915,13 @@ void main() { }); testWidgets('testToggleInfoWindow', (WidgetTester tester) async { - const Marker marker = Marker( + const marker = Marker( markerId: MarkerId('marker'), infoWindow: InfoWindow(title: 'InfoWindow'), ); - final Set markers = {marker}; + final markers = {marker}; - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -960,20 +960,20 @@ void main() { WidgetTester tester, ) async { final Key key = GlobalKey(); - const Marker marker = Marker( + const marker = Marker( markerId: MarkerId('marker'), infoWindow: InfoWindow(title: 'InfoWindow'), ); - Set markers = {marker}; + var markers = {marker}; - const ClusterManager clusterManager = ClusterManager( + const clusterManager = ClusterManager( clusterManagerId: ClusterManagerId('cluster_manager'), ); - final Set clusterManagers = { + final clusterManagers = { clusterManager, }; - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -1029,7 +1029,7 @@ void main() { testWidgets( 'testTakeSnapshot', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -1056,15 +1056,15 @@ void main() { ); testWidgets('set tileOverlay correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); - final TileOverlay tileOverlay1 = TileOverlay( + final mapIdCompleter = Completer(); + final tileOverlay1 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 2, transparency: 0.2, ); - final TileOverlay tileOverlay2 = TileOverlay( + final tileOverlay2 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_2'), tileProvider: _DebugTileProvider(), zIndex: 1, @@ -1117,16 +1117,16 @@ void main() { }); testWidgets('update tileOverlays correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); - final TileOverlay tileOverlay1 = TileOverlay( + final tileOverlay1 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 2, transparency: 0.2, ); - final TileOverlay tileOverlay2 = TileOverlay( + final tileOverlay2 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_2'), tileProvider: _DebugTileProvider(), zIndex: 3, @@ -1150,7 +1150,7 @@ void main() { final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; - final TileOverlay tileOverlay1New = TileOverlay( + final tileOverlay1New = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 1, @@ -1196,9 +1196,9 @@ void main() { }); testWidgets('remove tileOverlays correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); - final TileOverlay tileOverlay1 = TileOverlay( + final tileOverlay1 = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), zIndex: 2, @@ -1247,27 +1247,27 @@ void main() { testWidgets('marker clustering', (WidgetTester tester) async { final Key key = GlobalKey(); - const int clusterManagersAmount = 2; - const int markersPerClusterManager = 5; - final Map markers = {}; - final Set clusterManagers = {}; + const clusterManagersAmount = 2; + const markersPerClusterManager = 5; + final markers = {}; + final clusterManagers = {}; - for (int i = 0; i < clusterManagersAmount; i++) { - final ClusterManagerId clusterManagerId = ClusterManagerId( + for (var i = 0; i < clusterManagersAmount; i++) { + final clusterManagerId = ClusterManagerId( 'cluster_manager_$i', ); - final ClusterManager clusterManager = ClusterManager( + final clusterManager = ClusterManager( clusterManagerId: clusterManagerId, ); clusterManagers.add(clusterManager); } - for (final ClusterManager cm in clusterManagers) { - for (int i = 0; i < markersPerClusterManager; i++) { - final MarkerId markerId = MarkerId( + for (final cm in clusterManagers) { + for (var i = 0; i < markersPerClusterManager; i++) { + final markerId = MarkerId( '${cm.clusterManagerId.value}_marker_$i', ); - final Marker marker = Marker( + final marker = Marker( markerId: markerId, clusterManagerId: cm.clusterManagerId, position: LatLng( @@ -1279,7 +1279,7 @@ void main() { } } - final Completer controllerCompleter = + final controllerCompleter = Completer(); final GoogleMapsInspectorPlatform inspector = @@ -1303,7 +1303,7 @@ void main() { final ExampleGoogleMapController controller = await controllerCompleter.future; - for (final ClusterManager cm in clusterManagers) { + for (final cm in clusterManagers) { final List clusters = await inspector.getClusters( mapId: controller.mapId, clusterManagerId: cm.clusterManagerId, @@ -1379,7 +1379,7 @@ void main() { ), ); - for (final ClusterManager cm in clusterManagers) { + for (final cm in clusterManagers) { final List clusters = await inspector.getClusters( mapId: controller.mapId, clusterManagerId: cm.clusterManagerId, @@ -1405,7 +1405,7 @@ void main() { testWidgets('getStyleError reports last error', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -1432,7 +1432,7 @@ void main() { WidgetTester tester, ) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -1457,7 +1457,7 @@ void main() { }); testWidgets('markerWithAssetMapBitmap', (WidgetTester tester) async { - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: AssetMapBitmap('assets/red_square.png', imagePixelRatio: 1.0), @@ -1479,10 +1479,10 @@ void main() { }); testWidgets('markerWithAssetMapBitmapCreate', (WidgetTester tester) async { - final ImageConfiguration imageConfiguration = ImageConfiguration( + final imageConfiguration = ImageConfiguration( devicePixelRatio: tester.view.devicePixelRatio, ); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: await AssetMapBitmap.create( @@ -1508,7 +1508,7 @@ void main() { testWidgets('markerWithBytesMapBitmap', (WidgetTester tester) async { final Uint8List bytes = const Base64Decoder().convert(iconImageBase64); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: BytesMapBitmap( @@ -1535,11 +1535,11 @@ void main() { testWidgets('markerWithLegacyAsset', (WidgetTester tester) async { //tester.view.devicePixelRatio = 2.0; - const ImageConfiguration imageConfiguration = ImageConfiguration( + const imageConfiguration = ImageConfiguration( devicePixelRatio: 2.0, size: Size(100, 100), ); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), // Intentionally testing the deprecated code path. @@ -1550,7 +1550,7 @@ void main() { ), ), }; - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -1576,10 +1576,10 @@ void main() { // ignore: deprecated_member_use final BitmapDescriptor icon = BitmapDescriptor.fromBytes(bytes); - final Set markers = { + final markers = { Marker(markerId: const MarkerId('1'), icon: icon), }; - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -1598,12 +1598,12 @@ void main() { }); group('GroundOverlay', () { - final LatLngBounds kGroundOverlayBounds = LatLngBounds( + final kGroundOverlayBounds = LatLngBounds( southwest: const LatLng(37.77483, -122.41942), northeast: const LatLng(37.78183, -122.39105), ); - final GroundOverlay groundOverlayBounds1 = GroundOverlay.fromBounds( + final groundOverlayBounds1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('bounds_1'), bounds: kGroundOverlayBounds, image: AssetMapBitmap( @@ -1613,7 +1613,7 @@ void main() { ), ); - final GroundOverlay groundOverlayPosition1 = GroundOverlay.fromPosition( + final groundOverlayPosition1 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('position_1'), position: kGroundOverlayBounds.northeast, width: 100, @@ -1665,8 +1665,8 @@ void main() { } testWidgets('set ground overlays correctly', (WidgetTester tester) async { - final Completer mapIdCompleter = Completer(); - final GroundOverlay groundOverlayBounds2 = GroundOverlay.fromBounds( + final mapIdCompleter = Completer(); + final groundOverlayBounds2 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('bounds_2'), bounds: groundOverlayBounds1.bounds!, image: groundOverlayBounds1.image, @@ -1723,7 +1723,7 @@ void main() { testWidgets('update ground overlays correctly', ( WidgetTester tester, ) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -1807,7 +1807,7 @@ void main() { testWidgets('remove ground overlays correctly', ( WidgetTester tester, ) async { - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); final Key key = GlobalKey(); await tester.pumpWidget( @@ -1862,7 +1862,7 @@ void main() { 'testAnimateCameraWithoutDuration', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; @@ -1956,7 +1956,7 @@ void main() { 'testAnimateCameraWithDuration', (WidgetTester tester) async { final Key key = GlobalKey(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; @@ -1964,8 +1964,8 @@ void main() { /// Completer to track when the camera has come to rest. Completer? cameraIdleCompleter; - const int shortCameraAnimationDurationMS = 200; - const int longCameraAnimationDurationMS = 1000; + const shortCameraAnimationDurationMS = 200; + const longCameraAnimationDurationMS = 1000; /// Calculate the midpoint duration of the animation test, which will /// serve as a reference to verify that animations complete more quickly @@ -1974,7 +1974,7 @@ void main() { (shortCameraAnimationDurationMS + longCameraAnimationDurationMS) ~/ 2; // Stopwatch to measure the time taken for the animation to complete. - final Stopwatch stopwatch = Stopwatch(); + final stopwatch = Stopwatch(); await tester.pumpWidget( Directionality( @@ -2116,10 +2116,10 @@ class _DebugTileProvider implements TileProvider { @override Future getTile(int x, int y, int? zoom) async { - final ui.PictureRecorder recorder = ui.PictureRecorder(); - final Canvas canvas = Canvas(recorder); - final TextSpan textSpan = TextSpan(text: '$x,$y', style: textStyle); - final TextPainter textPainter = TextPainter( + final recorder = ui.PictureRecorder(); + final canvas = Canvas(recorder); + final textSpan = TextSpan(text: '$x,$y', style: textStyle); + final textPainter = TextPainter( text: textSpan, textDirection: TextDirection.ltr, ); @@ -2199,7 +2199,7 @@ Future _checkCameraUpdateByType( ) async { // As the target might differ a bit from the expected target, a threshold is // used. - const double latLngThreshold = 0.05; + const latLngThreshold = 0.05; switch (type) { case CameraUpdateType.newCameraPosition: diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/clustering.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/clustering.dart index e7ed25a3043..1d7f2f43483 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/clustering.dart @@ -116,14 +116,14 @@ class ClusteringBodyState extends State { return; } - final String clusterManagerIdVal = + final clusterManagerIdVal = 'cluster_manager_id_$_clusterManagerIdCounter'; _clusterManagerIdCounter++; - final ClusterManagerId clusterManagerId = ClusterManagerId( + final clusterManagerId = ClusterManagerId( clusterManagerIdVal, ); - final ClusterManager clusterManager = ClusterManager( + final clusterManager = ClusterManager( clusterManagerId: clusterManagerId, onClusterTap: (Cluster cluster) => setState(() { lastCluster = cluster; @@ -149,11 +149,11 @@ class ClusteringBodyState extends State { } void _addMarkersToCluster(ClusterManager clusterManager) { - for (int i = 0; i < _markersToAddToClusterManagerCount; i++) { - final String markerIdVal = + for (var i = 0; i < _markersToAddToClusterManagerCount; i++) { + final markerIdVal = '${clusterManager.clusterManagerId.value}_marker_id_$_markerIdCounter'; _markerIdCounter++; - final MarkerId markerId = MarkerId(markerIdVal); + final markerId = MarkerId(markerIdVal); final int clusterManagerIndex = clusterManagers.values.toList().indexOf( clusterManager, @@ -164,7 +164,7 @@ class ClusteringBodyState extends State { final double clusterManagerLongitudeOffset = clusterManagerIndex * _clusterManagerLongitudeOffset; - final Marker marker = Marker( + final marker = Marker( clusterManagerId: clusterManager.clusterManagerId, markerId: markerId, position: LatLng( diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/custom_marker_icon.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/custom_marker_icon.dart index 6206787f347..548146c6206 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/custom_marker_icon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/custom_marker_icon.dart @@ -9,9 +9,9 @@ import 'package:flutter/material.dart'; /// Returns a generated png image in [ByteData] format with the requested size. Future createCustomMarkerIconImage({required Size size}) async { - final ui.PictureRecorder recorder = ui.PictureRecorder(); - final Canvas canvas = Canvas(recorder); - final _MarkerPainter painter = _MarkerPainter(); + final recorder = ui.PictureRecorder(); + final canvas = Canvas(recorder); + final painter = _MarkerPainter(); painter.paint(canvas, size); @@ -30,7 +30,7 @@ class _MarkerPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { final Rect rect = Offset.zero & size; - const RadialGradient gradient = RadialGradient( + const gradient = RadialGradient( colors: [Colors.yellow, Colors.red], stops: [0.4, 1.0], ); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/ground_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/ground_overlay.dart index 8c8f5dcf159..1d5f5e7a67e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/ground_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/ground_overlay.dart @@ -93,7 +93,7 @@ class GroundOverlayBodyState extends State { _groundOverlayIndex += 1; - final GroundOverlayId id = GroundOverlayId( + final id = GroundOverlayId( 'ground_overlay_$_groundOverlayIndex', ); @@ -144,7 +144,7 @@ class GroundOverlayBodyState extends State { void _changeTransparency() { assert(_groundOverlay != null); setState(() { - final double transparency = _groundOverlay!.transparency == 0.0 + final transparency = _groundOverlay!.transparency == 0.0 ? 0.5 : 0.0; _groundOverlay = _groundOverlay!.copyWith( @@ -227,7 +227,7 @@ class GroundOverlayBodyState extends State { @override Widget build(BuildContext context) { - final Set overlays = { + final overlays = { if (_groundOverlay != null) _groundOverlay!, }; return Column( diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_click.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_click.dart index a2cbca5c7e0..4d45e961d63 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_click.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_click.dart @@ -41,7 +41,7 @@ class _MapClickBodyState extends State<_MapClickBody> { @override Widget build(BuildContext context) { - final ExampleGoogleMap googleMap = ExampleGoogleMap( + final googleMap = ExampleGoogleMap( onMapCreated: onMapCreated, initialCameraPosition: _kInitialPosition, onTap: (LatLng pos) { @@ -56,7 +56,7 @@ class _MapClickBodyState extends State<_MapClickBody> { }, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( @@ -66,8 +66,8 @@ class _MapClickBodyState extends State<_MapClickBody> { ]; if (mapController != null) { - final String lastTap = 'Tap:\n${_lastTap ?? ""}\n'; - final String lastLongPress = 'Long press:\n${_lastLongPress ?? ""}'; + final lastTap = 'Tap:\n${_lastTap ?? ""}\n'; + final lastLongPress = 'Long press:\n${_lastLongPress ?? ""}'; columnChildren.add( Center(child: Text(lastTap, textAlign: TextAlign.center)), ); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_coordinates.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_coordinates.dart index 59858c4d321..3a93b0db93b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_coordinates.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_coordinates.dart @@ -43,7 +43,7 @@ class _MapCoordinatesBodyState extends State<_MapCoordinatesBody> { @override Widget build(BuildContext context) { - final ExampleGoogleMap googleMap = ExampleGoogleMap( + final googleMap = ExampleGoogleMap( onMapCreated: onMapCreated, initialCameraPosition: _kInitialPosition, onCameraIdle: diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart index 79e983d8a21..d4dd922b060 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart @@ -47,7 +47,7 @@ class MapIdBodyState extends State { @override Widget build(BuildContext context) { - final ExampleGoogleMap googleMap = ExampleGoogleMap( + final googleMap = ExampleGoogleMap( onMapCreated: _onMapCreated, initialCameraPosition: const CameraPosition( target: _kMapCenter, @@ -57,7 +57,7 @@ class MapIdBodyState extends State { cloudMapId: _mapId, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_ui.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_ui.dart index 53109eeac4d..46fa320ad3a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_ui.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_ui.dart @@ -253,7 +253,7 @@ class MapUiBodyState extends State { @override Widget build(BuildContext context) { - final ExampleGoogleMap googleMap = ExampleGoogleMap( + final googleMap = ExampleGoogleMap( onMapCreated: onMapCreated, initialCameraPosition: _kInitialPosition, compassEnabled: _compassEnabled, @@ -273,7 +273,7 @@ class MapUiBodyState extends State { onCameraMove: _updateCameraPosition, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/marker_icons.dart index 40df30c94ac..2959c7c0dcf 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/marker_icons.dart @@ -210,7 +210,7 @@ class MarkerIconsBodyState extends State { } Marker _createAssetMarker(int index) { - final LatLng position = LatLng( + final position = LatLng( _kMapCenter.latitude - (index * 0.5), _kMapCenter.longitude - 1, ); @@ -223,7 +223,7 @@ class MarkerIconsBodyState extends State { } Marker _createBytesMarker(int index) { - final LatLng position = LatLng( + final position = LatLng( _kMapCenter.latitude - (index * 0.5), _kMapCenter.longitude + 1, ); @@ -236,8 +236,8 @@ class MarkerIconsBodyState extends State { } void _updateMarkers() { - final Set markers = {}; - for (int i = 0; i < _markersAmountPerType; i++) { + final markers = {}; + for (var i = 0; i < _markersAmountPerType; i++) { if (_markerIconAsset != null) { markers.add(_createAssetMarker(i)); } @@ -299,7 +299,7 @@ class MarkerIconsBodyState extends State { final double? imagePixelRatio = _scalingEnabled ? devicePixelRatio : null; // Create canvasSize with physical marker size - final Size canvasSize = Size( + final canvasSize = Size( bitmapLogicalSize.width * (imagePixelRatio ?? 1.0), bitmapLogicalSize.height * (imagePixelRatio ?? 1.0), ); @@ -314,7 +314,7 @@ class MarkerIconsBodyState extends State { ? _getCurrentMarkerSize() : (null, null); - final BytesMapBitmap bitmap = BytesMapBitmap( + final bitmap = BytesMapBitmap( bytes.buffer.asUint8List(), imagePixelRatio: imagePixelRatio, width: width, diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/padding.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/padding.dart index 5154b88782b..beb39b305f5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/padding.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/padding.dart @@ -36,7 +36,7 @@ class MarkerIconsBodyState extends State { @override Widget build(BuildContext context) { - final ExampleGoogleMap googleMap = ExampleGoogleMap( + final googleMap = ExampleGoogleMap( onMapCreated: _onMapCreated, initialCameraPosition: const CameraPosition( target: _kMapCenter, @@ -45,7 +45,7 @@ class MarkerIconsBodyState extends State { padding: _padding, ); - final List columnChildren = [ + final columnChildren = [ Padding( padding: const EdgeInsets.all(10.0), child: Center( diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_circle.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_circle.dart index d45ec7e5c27..88c84c79e12 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_circle.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_circle.dart @@ -83,11 +83,11 @@ class PlaceCircleBodyState extends State { return; } - final String circleIdVal = 'circle_id_$_circleIdCounter'; + final circleIdVal = 'circle_id_$_circleIdCounter'; _circleIdCounter++; - final CircleId circleId = CircleId(circleIdVal); + final circleId = CircleId(circleIdVal); - final Circle circle = Circle( + final circle = Circle( circleId: circleId, consumeTapEvents: true, strokeColor: Colors.orange, diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_marker.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_marker.dart index 9674927fe37..926c2db2e42 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_marker.dart @@ -141,11 +141,11 @@ class PlaceMarkerBodyState extends State { return; } - final String markerIdVal = 'marker_id_$_markerIdCounter'; + final markerIdVal = 'marker_id_$_markerIdCounter'; _markerIdCounter++; - final MarkerId markerId = MarkerId(markerIdVal); + final markerId = MarkerId(markerIdVal); - final Marker marker = Marker( + final marker = Marker( markerId: markerId, position: LatLng( center.latitude + sin(_markerIdCounter * pi / 6.0) / 20.0, @@ -174,7 +174,7 @@ class PlaceMarkerBodyState extends State { void _changePosition(MarkerId markerId) { final Marker marker = markers[markerId]!; final LatLng current = marker.position; - final Offset offset = Offset( + final offset = Offset( center.latitude - current.latitude, center.longitude - current.longitude, ); @@ -191,7 +191,7 @@ class PlaceMarkerBodyState extends State { void _changeAnchor(MarkerId markerId) { final Marker marker = markers[markerId]!; final Offset currentAnchor = marker.anchor; - final Offset newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); + final newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); setState(() { markers[markerId] = marker.copyWith(anchorParam: newAnchor); }); @@ -200,7 +200,7 @@ class PlaceMarkerBodyState extends State { Future _changeInfoAnchor(MarkerId markerId) async { final Marker marker = markers[markerId]!; final Offset currentAnchor = marker.infoWindow.anchor; - final Offset newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); + final newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx); setState(() { markers[markerId] = marker.copyWith( infoWindowParam: marker.infoWindow.copyWith(anchorParam: newAnchor), @@ -224,7 +224,7 @@ class PlaceMarkerBodyState extends State { Future _changeInfo(MarkerId markerId) async { final Marker marker = markers[markerId]!; - final String newSnippet = '${marker.infoWindow.snippet!}*'; + final newSnippet = '${marker.infoWindow.snippet!}*'; setState(() { markers[markerId] = marker.copyWith( infoWindowParam: marker.infoWindow.copyWith(snippetParam: newSnippet), @@ -277,7 +277,7 @@ class PlaceMarkerBodyState extends State { } Future _getMarkerIcon(BuildContext context) async { - const Size canvasSize = Size(48, 48); + const canvasSize = Size(48, 48); final ByteData bytes = await createCustomMarkerIconImage(size: canvasSize); return BytesMapBitmap(bytes.buffer.asUint8List()); } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_polygon.dart index 79475381c15..ff9eac82210 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_polygon.dart @@ -82,10 +82,10 @@ class PlacePolygonBodyState extends State { return; } - final String polygonIdVal = 'polygon_id_$_polygonIdCounter'; - final PolygonId polygonId = PolygonId(polygonIdVal); + final polygonIdVal = 'polygon_id_$_polygonIdCounter'; + final polygonId = PolygonId(polygonIdVal); - final Polygon polygon = Polygon( + final polygon = Polygon( polygonId: polygonId, consumeTapEvents: true, strokeColor: Colors.orange, @@ -262,7 +262,7 @@ class PlacePolygonBodyState extends State { } List _createPoints() { - final List points = []; + final points = []; final double offset = _polygonIdCounter.ceilToDouble(); points.add(_createLatLng(51.2395 + offset, -3.4314)); points.add(_createLatLng(53.5234 + offset, -3.5314)); @@ -272,17 +272,17 @@ class PlacePolygonBodyState extends State { } List> _createHoles(PolygonId polygonId) { - final List> holes = >[]; + final holes = >[]; final double offset = polygonOffsets[polygonId]!; - final List hole1 = []; + final hole1 = []; hole1.add(_createLatLng(51.8395 + offset, -3.8814)); hole1.add(_createLatLng(52.0234 + offset, -3.9914)); hole1.add(_createLatLng(52.1351 + offset, -4.4435)); hole1.add(_createLatLng(52.0231 + offset, -4.5829)); holes.add(hole1); - final List hole2 = []; + final hole2 = []; hole2.add(_createLatLng(52.2395 + offset, -3.6814)); hole2.add(_createLatLng(52.4234 + offset, -3.7914)); hole2.add(_createLatLng(52.5351 + offset, -4.2435)); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_polyline.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_polyline.dart index 854046b3053..f749cac5f26 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_polyline.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/place_polyline.dart @@ -110,11 +110,11 @@ class PlacePolylineBodyState extends State { return; } - final String polylineIdVal = 'polyline_id_$_polylineIdCounter'; + final polylineIdVal = 'polyline_id_$_polylineIdCounter'; _polylineIdCounter++; - final PolylineId polylineId = PolylineId(polylineIdVal); + final polylineId = PolylineId(polylineIdVal); - final Polyline polyline = Polyline( + final polyline = Polyline( polylineId: polylineId, consumeTapEvents: true, color: Colors.orange, @@ -307,7 +307,7 @@ class PlacePolylineBodyState extends State { } List _createPoints() { - final List points = []; + final points = []; final double offset = _polylineIdCounter.ceilToDouble(); points.add(_createLatLng(51.4816 + offset, -3.1791)); points.add(_createLatLng(53.0430 + offset, -2.9925)); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/tile_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/tile_overlay.dart index 340ac4ce48d..19e06b672e2 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/tile_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/tile_overlay.dart @@ -53,7 +53,7 @@ class TileOverlayBodyState extends State { } void _addTileOverlay() { - final TileOverlay tileOverlay = TileOverlay( + final tileOverlay = TileOverlay( tileOverlayId: const TileOverlayId('tile_overlay_1'), tileProvider: _DebugTileProvider(), ); @@ -70,7 +70,7 @@ class TileOverlayBodyState extends State { @override Widget build(BuildContext context) { - final Set overlays = { + final overlays = { if (_tileOverlay != null) _tileOverlay!, }; return Column( @@ -124,10 +124,10 @@ class _DebugTileProvider implements TileProvider { @override Future getTile(int x, int y, int? zoom) async { - final ui.PictureRecorder recorder = ui.PictureRecorder(); - final Canvas canvas = Canvas(recorder); - final TextSpan textSpan = TextSpan(text: '$x,$y', style: textStyle); - final TextPainter textPainter = TextPainter( + final recorder = ui.PictureRecorder(); + final canvas = Canvas(recorder); + final textSpan = TextSpan(text: '$x,$y', style: textStyle); + final textPainter = TextPainter( text: textSpan, textDirection: TextDirection.ltr, ); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/test/example_google_map_test.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/test/example_google_map_test.dart index 8cb555d3d54..7527d50e561 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/test/example_google_map_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/test/example_google_map_test.dart @@ -40,10 +40,10 @@ void main() { testWidgets('circle updates with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Circle c1 = Circle(circleId: CircleId('circle_1')); - const Circle c2 = Circle(circleId: CircleId('circle_2')); - const Circle c3 = Circle(circleId: CircleId('circle_3'), radius: 1); - const Circle c3updated = Circle(circleId: CircleId('circle_3'), radius: 10); + const c1 = Circle(circleId: CircleId('circle_1')); + const c2 = Circle(circleId: CircleId('circle_2')); + const c3 = Circle(circleId: CircleId('circle_3'), radius: 1); + const c3updated = Circle(circleId: CircleId('circle_3'), radius: 10); // First remove one and add another, then update the new one. await tester.pumpWidget(_mapWithObjects(circles: {c1, c2})); @@ -72,10 +72,10 @@ void main() { testWidgets('marker updates with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Marker m1 = Marker(markerId: MarkerId('marker_1')); - const Marker m2 = Marker(markerId: MarkerId('marker_2')); - const Marker m3 = Marker(markerId: MarkerId('marker_3')); - const Marker m3updated = Marker( + const m1 = Marker(markerId: MarkerId('marker_1')); + const m2 = Marker(markerId: MarkerId('marker_2')); + const m3 = Marker(markerId: MarkerId('marker_3')); + const m3updated = Marker( markerId: MarkerId('marker_3'), draggable: true, ); @@ -107,13 +107,13 @@ void main() { testWidgets('polygon updates with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Polygon p1 = Polygon(polygonId: PolygonId('polygon_1')); - const Polygon p2 = Polygon(polygonId: PolygonId('polygon_2')); - const Polygon p3 = Polygon( + const p1 = Polygon(polygonId: PolygonId('polygon_1')); + const p2 = Polygon(polygonId: PolygonId('polygon_2')); + const p3 = Polygon( polygonId: PolygonId('polygon_3'), strokeWidth: 1, ); - const Polygon p3updated = Polygon( + const p3updated = Polygon( polygonId: PolygonId('polygon_3'), strokeWidth: 2, ); @@ -147,13 +147,13 @@ void main() { testWidgets('polyline updates with delays', (WidgetTester tester) async { platform.simulatePlatformDelay = true; - const Polyline p1 = Polyline(polylineId: PolylineId('polyline_1')); - const Polyline p2 = Polyline(polylineId: PolylineId('polyline_2')); - const Polyline p3 = Polyline( + const p1 = Polyline(polylineId: PolylineId('polyline_1')); + const p2 = Polyline(polylineId: PolylineId('polyline_2')); + const p3 = Polyline( polylineId: PolylineId('polyline_3'), width: 1, ); - const Polyline p3updated = Polyline( + const p3updated = Polyline( polylineId: PolylineId('polyline_3'), width: 2, ); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_map_inspector_ios.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_map_inspector_ios.dart index b00703f7204..9ab35fc6aae 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_map_inspector_ios.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_map_inspector_ios.dart @@ -128,7 +128,7 @@ class GoogleMapsInspectorIOS extends GoogleMapsInspectorPlatform { } // Create dummy image to represent the image of the ground overlay. - final BytesMapBitmap dummyImage = BytesMapBitmap( + final dummyImage = BytesMapBitmap( Uint8List.fromList([0]), bitmapScaling: MapBitmapScaling.none, ); 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 1794c914855..d4f7a8f205d 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 @@ -310,7 +310,7 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { final Set previousSet = currentTileOverlays != null ? currentTileOverlays.values.toSet() : {}; - final _TileOverlayUpdates updates = _TileOverlayUpdates.from( + final updates = _TileOverlayUpdates.from( previousSet, newTileOverlays, ); @@ -494,7 +494,7 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { 'On iOS zoom level must be set when position is set for ground overlays.', ); - final PlatformMapViewCreationParams creationParams = + final creationParams = PlatformMapViewCreationParams( initialCameraPosition: _platformCameraPositionFromCameraPosition( widgetConfiguration.initialCameraPosition, @@ -1234,7 +1234,7 @@ PlatformMapConfiguration _platformMapConfigurationFromOptionsJson( // to support this legacy API that relied on cross-package magic strings. final List? padding = (options['padding'] as List?) ?.cast(); - final int? mapType = options['mapType'] as int?; + final mapType = options['mapType'] as int?; return PlatformMapConfiguration( compassEnabled: options['compassEnabled'] as bool?, cameraTargetBounds: _platformCameraTargetBoundsFromCameraTargetBoundsJson( diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart index aa94f6c12b2..7c0d9f50c49 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart @@ -25,7 +25,7 @@ void _addIfNonNull(Map map, String fieldName, Object? value) { /// Serialize [Heatmap] Object serializeHeatmap(Heatmap heatmap) { - final Map json = {}; + final json = {}; _addIfNonNull(json, _heatmapIdKey, heatmap.heatmapId.value); _addIfNonNull( @@ -69,7 +69,7 @@ WeightedLatLng? deserializeWeightedLatLng(Object? json) { return null; } assert(json is List && json.length == 2); - final List list = json as List; + final list = json as List; final LatLng latLng = deserializeLatLng(list[0])!; return WeightedLatLng(latLng, weight: list[1] as double); } @@ -85,13 +85,13 @@ LatLng? deserializeLatLng(Object? json) { return null; } assert(json is List && json.length == 2); - final List list = json as List; + final list = json as List; return LatLng(list[0]! as double, list[1]! as double); } /// Serialize [HeatmapGradient] Object serializeHeatmapGradient(HeatmapGradient gradient) { - final Map json = {}; + final json = {}; _addIfNonNull( json, @@ -123,8 +123,8 @@ HeatmapGradient? deserializeHeatmapGradient(Object? json) { (map[_heatmapGradientStartPointsKey]! as List) .whereType() .toList(); - final List gradientColors = []; - for (int i = 0; i < colors.length; i++) { + final gradientColors = []; + for (var i = 0; i < colors.length; i++) { gradientColors.add(HeatmapGradientColor(colors[i], startPoints[i])); } return HeatmapGradient( diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart b/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart index 84890f6f883..c2c00fc7c2a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart @@ -20,8 +20,8 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); (GoogleMapsFlutterIOS, MockMapsApi) setUpMockMap({required int mapId}) { - final MockMapsApi api = MockMapsApi(); - final GoogleMapsFlutterIOS maps = GoogleMapsFlutterIOS( + final api = MockMapsApi(); + final maps = GoogleMapsFlutterIOS( apiProvider: (_) => api, ); maps.ensureApiInitialized(mapId); @@ -34,8 +34,8 @@ void main() { }); test('init calls waitForMap', () async { - final MockMapsApi api = MockMapsApi(); - final GoogleMapsFlutterIOS maps = GoogleMapsFlutterIOS( + final api = MockMapsApi(); + final maps = GoogleMapsFlutterIOS( apiProvider: (_) => api, ); @@ -45,14 +45,14 @@ void main() { }); test('getScreenCoordinate converts and passes values correctly', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); // Arbitrary values that are all different from each other. - const LatLng latLng = LatLng(10, 20); - const ScreenCoordinate expectedCoord = ScreenCoordinate(x: 30, y: 40); + const latLng = LatLng(10, 20); + const expectedCoord = ScreenCoordinate(x: 30, y: 40); when(api.getScreenCoordinate(any)).thenAnswer( (_) async => PlatformPoint( x: expectedCoord.x.toDouble(), @@ -68,21 +68,21 @@ void main() { final VerificationResult verification = verify( api.getScreenCoordinate(captureAny), ); - final PlatformLatLng passedLatLng = + final passedLatLng = verification.captured[0] as PlatformLatLng; expect(passedLatLng.latitude, latLng.latitude); expect(passedLatLng.longitude, latLng.longitude); }); test('getLatLng converts and passes values correctly', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); // Arbitrary values that are all different from each other. - const LatLng expectedLatLng = LatLng(10, 20); - const ScreenCoordinate coord = ScreenCoordinate(x: 30, y: 40); + const expectedLatLng = LatLng(10, 20); + const coord = ScreenCoordinate(x: 30, y: 40); when(api.getLatLng(any)).thenAnswer( (_) async => PlatformLatLng( latitude: expectedLatLng.latitude, @@ -93,19 +93,19 @@ void main() { final LatLng latLng = await maps.getLatLng(coord, mapId: mapId); expect(latLng, expectedLatLng); final VerificationResult verification = verify(api.getLatLng(captureAny)); - final PlatformPoint passedCoord = verification.captured[0] as PlatformPoint; + final passedCoord = verification.captured[0] as PlatformPoint; expect(passedCoord.x, coord.x); expect(passedCoord.y, coord.y); }); test('getVisibleRegion converts and passes values correctly', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); // Arbitrary values that are all different from each other. - final LatLngBounds expectedBounds = LatLngBounds( + final expectedBounds = LatLngBounds( southwest: const LatLng(10, 20), northeast: const LatLng(30, 40), ); @@ -127,7 +127,7 @@ void main() { }); test('moveCamera calls through with expected scrollBy', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); @@ -136,9 +136,9 @@ void main() { await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateScrollBy scroll = + final scroll = passedUpdate.cameraUpdate as PlatformCameraUpdateScrollBy; update as CameraUpdateScrollBy; expect(scroll.dx, update.dx); @@ -146,7 +146,7 @@ void main() { }); test('animateCamera calls through with expected scrollBy', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); @@ -157,9 +157,9 @@ void main() { final VerificationResult verification = verify( api.animateCamera(captureAny, captureAny), ); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateScrollBy scroll = + final scroll = passedUpdate.cameraUpdate as PlatformCameraUpdateScrollBy; update as CameraUpdateScrollBy; expect(scroll.dx, update.dx); @@ -168,13 +168,13 @@ void main() { }); test('animateCameraWithConfiguration calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); final CameraUpdate update = CameraUpdate.scrollBy(10, 20); - const CameraUpdateAnimationConfiguration configuration = + const configuration = CameraUpdateAnimationConfiguration(duration: Duration(seconds: 1)); expect(configuration.duration?.inSeconds, 1); await maps.animateCameraWithConfiguration( @@ -186,25 +186,25 @@ void main() { final VerificationResult verification = verify( api.animateCamera(captureAny, captureAny), ); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateScrollBy scroll = + final scroll = passedUpdate.cameraUpdate as PlatformCameraUpdateScrollBy; update as CameraUpdateScrollBy; expect(scroll.dx, update.dx); expect(scroll.dy, update.dy); - final int? passedDuration = verification.captured[1] as int?; + final passedDuration = verification.captured[1] as int?; expect(passedDuration, configuration.duration?.inMilliseconds); }); test('getZoomLevel passes values correctly', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const double expectedZoom = 4.2; + const expectedZoom = 4.2; when(api.getZoomLevel()).thenAnswer((_) async => expectedZoom); final double zoom = await maps.getZoomLevel(mapId: mapId); @@ -212,36 +212,36 @@ void main() { }); test('showInfoWindow calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const String markedId = 'a_marker'; + const markedId = 'a_marker'; await maps.showMarkerInfoWindow(const MarkerId(markedId), mapId: mapId); verify(api.showInfoWindow(markedId)); }); test('hideInfoWindow calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const String markedId = 'a_marker'; + const markedId = 'a_marker'; await maps.hideMarkerInfoWindow(const MarkerId(markedId), mapId: mapId); verify(api.hideInfoWindow(markedId)); }); test('isInfoWindowShown calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const String markedId = 'a_marker'; + const markedId = 'a_marker'; when(api.isInfoWindowShown(markedId)).thenAnswer((_) async => true); expect( @@ -254,43 +254,43 @@ void main() { }); test('takeSnapshot calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - final Uint8List fakeSnapshot = Uint8List(10); + final fakeSnapshot = Uint8List(10); when(api.takeSnapshot()).thenAnswer((_) async => fakeSnapshot); expect(await maps.takeSnapshot(mapId: mapId), fakeSnapshot); }); test('clearTileCache calls through', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const String tileOverlayId = 'overlay'; + const tileOverlayId = 'overlay'; await maps.clearTileCache(const TileOverlayId(tileOverlayId), mapId: mapId); verify(api.clearTileCache(tileOverlayId)); }); test('updateMapConfiguration passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); // Set some arbitrary options. - final CameraTargetBounds cameraBounds = CameraTargetBounds( + final cameraBounds = CameraTargetBounds( LatLngBounds( southwest: const LatLng(10, 20), northeast: const LatLng(30, 40), ), ); - final MapConfiguration config = MapConfiguration( + final config = MapConfiguration( compassEnabled: true, mapType: MapType.terrain, cameraTargetBounds: cameraBounds, @@ -300,7 +300,7 @@ void main() { final VerificationResult verification = verify( api.updateMapConfiguration(captureAny), ); - final PlatformMapConfiguration passedConfig = + final passedConfig = verification.captured[0] as PlatformMapConfiguration; // Each set option should be present. expect(passedConfig.compassEnabled, true); @@ -328,19 +328,19 @@ void main() { }); test('updateMapOptions passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); // Set some arbitrary options. - final CameraTargetBounds cameraBounds = CameraTargetBounds( + final cameraBounds = CameraTargetBounds( LatLngBounds( southwest: const LatLng(10, 20), northeast: const LatLng(30, 40), ), ); - final Map config = { + final config = { 'compassEnabled': true, 'mapType': MapType.terrain.index, 'cameraTargetBounds': cameraBounds.toJson(), @@ -350,7 +350,7 @@ void main() { final VerificationResult verification = verify( api.updateMapConfiguration(captureAny), ); - final PlatformMapConfiguration passedConfig = + final passedConfig = verification.captured[0] as PlatformMapConfiguration; // Each set option should be present. expect(passedConfig.compassEnabled, true); @@ -378,15 +378,15 @@ void main() { }); test('updateCircles passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const Circle object1 = Circle(circleId: CircleId('1')); - const Circle object2old = Circle(circleId: CircleId('2')); + const object1 = Circle(circleId: CircleId('1')); + const object2old = Circle(circleId: CircleId('2')); final Circle object2new = object2old.copyWith(radiusParam: 42); - const Circle object3 = Circle(circleId: CircleId('3')); + const object3 = Circle(circleId: CircleId('3')); await maps.updateCircles( CircleUpdates.from( {object1, object2old}, @@ -398,11 +398,11 @@ void main() { final VerificationResult verification = verify( api.updateCircles(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; // Object one should be removed. expect(toRemove.length, 1); expect(toRemove.first, object1.circleId.value); @@ -439,15 +439,15 @@ void main() { }); test('updateClusterManagers passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const ClusterManager object1 = ClusterManager( + const object1 = ClusterManager( clusterManagerId: ClusterManagerId('1'), ); - const ClusterManager object3 = ClusterManager( + const object3 = ClusterManager( clusterManagerId: ClusterManagerId('3'), ); await maps.updateClusterManagers( @@ -461,9 +461,9 @@ void main() { final VerificationResult verification = verify( api.updateClusterManagers(captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toRemove = verification.captured[1] as List; + final toRemove = verification.captured[1] as List; // Object one should be removed. expect(toRemove.length, 1); expect(toRemove.first, object1.clusterManagerId.value); @@ -475,15 +475,15 @@ void main() { }); test('updateMarkers passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const Marker object1 = Marker(markerId: MarkerId('1')); - const Marker object2old = Marker(markerId: MarkerId('2')); + const object1 = Marker(markerId: MarkerId('1')); + const object2old = Marker(markerId: MarkerId('2')); final Marker object2new = object2old.copyWith(rotationParam: 42); - const Marker object3 = Marker(markerId: MarkerId('3')); + const object3 = Marker(markerId: MarkerId('3')); await maps.updateMarkers( MarkerUpdates.from( {object1, object2old}, @@ -495,11 +495,11 @@ void main() { final VerificationResult verification = verify( api.updateMarkers(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; // Object one should be removed. expect(toRemove.length, 1); expect(toRemove.first, object1.markerId.value); @@ -562,15 +562,15 @@ void main() { }); test('updatePolygons passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const Polygon object1 = Polygon(polygonId: PolygonId('1')); - const Polygon object2old = Polygon(polygonId: PolygonId('2')); + const object1 = Polygon(polygonId: PolygonId('1')); + const object2old = Polygon(polygonId: PolygonId('2')); final Polygon object2new = object2old.copyWith(strokeWidthParam: 42); - const Polygon object3 = Polygon(polygonId: PolygonId('3')); + const object3 = Polygon(polygonId: PolygonId('3')); await maps.updatePolygons( PolygonUpdates.from( {object1, object2old}, @@ -582,11 +582,11 @@ void main() { final VerificationResult verification = verify( api.updatePolygons(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; // Object one should be removed. expect(toRemove.length, 1); expect(toRemove.first, object1.polygonId.value); @@ -623,13 +623,13 @@ void main() { }); test('updatePolylines passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const Polyline object1 = Polyline(polylineId: PolylineId('1')); - const Polyline object2old = Polyline(polylineId: PolylineId('2')); + const object1 = Polyline(polylineId: PolylineId('1')); + const object2old = Polyline(polylineId: PolylineId('2')); final Polyline object2new = object2old.copyWith( widthParam: 42, startCapParam: Cap.squareCap, @@ -639,7 +639,7 @@ void main() { BitmapDescriptor.defaultMarker, refWidth: 15, ); - final Polyline object3 = Polyline( + final object3 = Polyline( polylineId: const PolylineId('3'), startCap: customCap, endCap: Cap.roundCap, @@ -655,11 +655,11 @@ void main() { final VerificationResult verification = verify( api.updatePolylines(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; void expectPolyline(PlatformPolyline actual, Polyline expected) { expect(actual.polylineId, expected.polylineId.value); expect(actual.consumesTapEvents, expected.consumeTapEvents); @@ -699,17 +699,17 @@ void main() { }); test('updateTileOverlays passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const TileOverlay object1 = TileOverlay(tileOverlayId: TileOverlayId('1')); - const TileOverlay object2old = TileOverlay( + const object1 = TileOverlay(tileOverlayId: TileOverlayId('1')); + const object2old = TileOverlay( tileOverlayId: TileOverlayId('2'), ); final TileOverlay object2new = object2old.copyWith(zIndexParam: 42); - const TileOverlay object3 = TileOverlay(tileOverlayId: TileOverlayId('3')); + const object3 = TileOverlay(tileOverlayId: TileOverlayId('3')); // Pre-set the initial state, since this update method doesn't take the old // state. await maps.updateTileOverlays( @@ -726,11 +726,11 @@ void main() { final VerificationResult verification = verify( api.updateTileOverlays(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; void expectTileOverlay(PlatformTileOverlay actual, TileOverlay expected) { expect(actual.tileOverlayId, expected.tileOverlayId.value); expect(actual.fadeIn, expected.fadeIn); @@ -752,18 +752,18 @@ void main() { }); test('updateGroundOverlays passes expected arguments', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - final AssetMapBitmap image = AssetMapBitmap( + final image = AssetMapBitmap( 'assets/red_square.png', imagePixelRatio: 1.0, bitmapScaling: MapBitmapScaling.none, ); - final GroundOverlay object1 = GroundOverlay.fromBounds( + final object1 = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('1'), bounds: LatLngBounds( southwest: const LatLng(10, 20), @@ -771,7 +771,7 @@ void main() { ), image: image, ); - final GroundOverlay object2old = GroundOverlay.fromBounds( + final object2old = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('2'), bounds: LatLngBounds( southwest: const LatLng(10, 20), @@ -786,7 +786,7 @@ void main() { transparencyParam: 0.5, zIndexParam: 100, ); - final GroundOverlay object3 = GroundOverlay.fromPosition( + final object3 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('3'), position: const LatLng(10, 20), width: 100, @@ -805,11 +805,11 @@ void main() { api.updateGroundOverlays(captureAny, captureAny, captureAny), ); - final List toAdd = + final toAdd = verification.captured[0] as List; - final List toChange = + final toChange = verification.captured[1] as List; - final List toRemove = verification.captured[2] as List; + final toRemove = verification.captured[2] as List; // Object one should be removed. expect(toRemove.length, 1); expect(toRemove.first, object1.groundOverlayId.value); @@ -892,18 +892,18 @@ void main() { test( 'updateGroundOverlays throws assertion error on unsupported ground overlays', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - final AssetMapBitmap image = AssetMapBitmap( + final image = AssetMapBitmap( 'assets/red_square.png', imagePixelRatio: 1.0, bitmapScaling: MapBitmapScaling.none, ); - final GroundOverlay object3 = GroundOverlay.fromPosition( + final object3 = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('1'), position: const LatLng(10, 20), // Assert should be thrown because zoomLevel is not set for position-based @@ -926,25 +926,25 @@ void main() { ); test('markers send drag event to correct streams', () async { - const int mapId = 1; - const String dragStartId = 'drag-start-marker'; - const String dragId = 'drag-marker'; - const String dragEndId = 'drag-end-marker'; - final PlatformLatLng fakePosition = PlatformLatLng( + const mapId = 1; + const dragStartId = 'drag-start-marker'; + const dragId = 'drag-marker'; + const dragEndId = 'drag-end-marker'; + final fakePosition = PlatformLatLng( latitude: 1.0, longitude: 1.0, ); - final GoogleMapsFlutterIOS maps = GoogleMapsFlutterIOS(); + final maps = GoogleMapsFlutterIOS(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue markerDragStartStream = + final markerDragStartStream = StreamQueue(maps.onMarkerDragStart(mapId: mapId)); - final StreamQueue markerDragStream = + final markerDragStream = StreamQueue(maps.onMarkerDrag(mapId: mapId)); - final StreamQueue markerDragEndStream = + final markerDragEndStream = StreamQueue(maps.onMarkerDragEnd(mapId: mapId)); // Simulate messages from the native side. @@ -958,15 +958,15 @@ void main() { }); test('markers send tap events to correct stream', () async { - const int mapId = 1; - const String objectId = 'object-id'; + const mapId = 1; + const objectId = 'object-id'; - final GoogleMapsFlutterIOS maps = GoogleMapsFlutterIOS(); + final maps = GoogleMapsFlutterIOS(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = StreamQueue( + final stream = StreamQueue( maps.onMarkerTap(mapId: mapId), ); @@ -977,15 +977,15 @@ void main() { }); test('circles send tap events to correct stream', () async { - const int mapId = 1; - const String objectId = 'object-id'; + const mapId = 1; + const objectId = 'object-id'; - final GoogleMapsFlutterIOS maps = GoogleMapsFlutterIOS(); + final maps = GoogleMapsFlutterIOS(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = StreamQueue( + final stream = StreamQueue( maps.onCircleTap(mapId: mapId), ); @@ -996,30 +996,30 @@ void main() { }); test('clusters send tap events to correct stream', () async { - const int mapId = 1; - const String managerId = 'manager-id'; - final PlatformLatLng fakePosition = PlatformLatLng( + const mapId = 1; + const managerId = 'manager-id'; + final fakePosition = PlatformLatLng( latitude: 10, longitude: 20, ); - final PlatformLatLngBounds fakeBounds = PlatformLatLngBounds( + final fakeBounds = PlatformLatLngBounds( southwest: PlatformLatLng(latitude: 30, longitude: 40), northeast: PlatformLatLng(latitude: 50, longitude: 60), ); - const List markerIds = ['marker-1', 'marker-2']; - final PlatformCluster cluster = PlatformCluster( + const markerIds = ['marker-1', 'marker-2']; + final cluster = PlatformCluster( clusterManagerId: managerId, position: fakePosition, bounds: fakeBounds, markerIds: markerIds, ); - final GoogleMapsFlutterIOS maps = GoogleMapsFlutterIOS(); + final maps = GoogleMapsFlutterIOS(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = StreamQueue( + final stream = StreamQueue( maps.onClusterTap(mapId: mapId), ); @@ -1045,15 +1045,15 @@ void main() { }); test('polygons send tap events to correct stream', () async { - const int mapId = 1; - const String objectId = 'object-id'; + const mapId = 1; + const objectId = 'object-id'; - final GoogleMapsFlutterIOS maps = GoogleMapsFlutterIOS(); + final maps = GoogleMapsFlutterIOS(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = StreamQueue( + final stream = StreamQueue( maps.onPolygonTap(mapId: mapId), ); @@ -1064,15 +1064,15 @@ void main() { }); test('polylines send tap events to correct stream', () async { - const int mapId = 1; - const String objectId = 'object-id'; + const mapId = 1; + const objectId = 'object-id'; - final GoogleMapsFlutterIOS maps = GoogleMapsFlutterIOS(); + final maps = GoogleMapsFlutterIOS(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = StreamQueue( + final stream = StreamQueue( maps.onPolylineTap(mapId: mapId), ); @@ -1083,15 +1083,15 @@ void main() { }); test('ground overlays send tap events to correct stream', () async { - const int mapId = 1; - const String objectId = 'object-id'; + const mapId = 1; + const objectId = 'object-id'; - final GoogleMapsFlutterIOS maps = GoogleMapsFlutterIOS(); + final maps = GoogleMapsFlutterIOS(); final HostMapMessageHandler callbackHandler = maps.ensureHandlerInitialized( mapId, ); - final StreamQueue stream = + final stream = StreamQueue( maps.onGroundOverlayTap(mapId: mapId), ); @@ -1103,20 +1103,20 @@ void main() { }); test('moveCamera calls through with expected newCameraPosition', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const LatLng latLng = LatLng(10.0, 20.0); - const CameraPosition position = CameraPosition(target: latLng); + const latLng = LatLng(10.0, 20.0); + const position = CameraPosition(target: latLng); final CameraUpdate update = CameraUpdate.newCameraPosition(position); await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateNewCameraPosition typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateNewCameraPosition; update as CameraUpdateNewCameraPosition; expect( @@ -1130,19 +1130,19 @@ void main() { }); test('moveCamera calls through with expected newLatLng', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const LatLng latLng = LatLng(10.0, 20.0); + const latLng = LatLng(10.0, 20.0); final CameraUpdate update = CameraUpdate.newLatLng(latLng); await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateNewLatLng typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateNewLatLng; update as CameraUpdateNewLatLng; expect(typedUpdate.latLng.latitude, update.latLng.latitude); @@ -1150,12 +1150,12 @@ void main() { }); test('moveCamera calls through with expected newLatLngBounds', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - final LatLngBounds latLng = LatLngBounds( + final latLng = LatLngBounds( northeast: const LatLng(10.0, 20.0), southwest: const LatLng(9.0, 21.0), ); @@ -1163,9 +1163,9 @@ void main() { await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateNewLatLngBounds typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateNewLatLngBounds; update as CameraUpdateNewLatLngBounds; expect( @@ -1188,19 +1188,19 @@ void main() { }); test('moveCamera calls through with expected newLatLngZoom', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const LatLng latLng = LatLng(10.0, 20.0); + const latLng = LatLng(10.0, 20.0); final CameraUpdate update = CameraUpdate.newLatLngZoom(latLng, 2.0); await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateNewLatLngZoom typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateNewLatLngZoom; update as CameraUpdateNewLatLngZoom; expect(typedUpdate.latLng.latitude, update.latLng.latitude); @@ -1209,19 +1209,19 @@ void main() { }); test('moveCamera calls through with expected zoomBy', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); - const Offset focus = Offset(10.0, 20.0); + const focus = Offset(10.0, 20.0); final CameraUpdate update = CameraUpdate.zoomBy(2.0, focus); await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateZoomBy typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateZoomBy; update as CameraUpdateZoomBy; expect(typedUpdate.focus?.x, update.focus?.dx); @@ -1230,7 +1230,7 @@ void main() { }); test('moveCamera calls through with expected zoomTo', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); @@ -1239,16 +1239,16 @@ void main() { await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateZoomTo typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateZoomTo; update as CameraUpdateZoomTo; expect(typedUpdate.zoom, update.zoom); }); test('moveCamera calls through with expected zoomIn', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); @@ -1257,15 +1257,15 @@ void main() { await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateZoom typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateZoom; expect(typedUpdate.out, false); }); test('moveCamera calls through with expected zoomOut', () async { - const int mapId = 1; + const mapId = 1; final (GoogleMapsFlutterIOS maps, MockMapsApi api) = setUpMockMap( mapId: mapId, ); @@ -1274,9 +1274,9 @@ void main() { await maps.moveCamera(update, mapId: mapId); final VerificationResult verification = verify(api.moveCamera(captureAny)); - final PlatformCameraUpdate passedUpdate = + final passedUpdate = verification.captured[0] as PlatformCameraUpdate; - final PlatformCameraUpdateZoom typedUpdate = + final typedUpdate = passedUpdate.cameraUpdate as PlatformCameraUpdateZoom; expect(typedUpdate.out, true); }); @@ -1301,13 +1301,13 @@ void main() { final PlatformBitmap platformBitmap = GoogleMapsFlutterIOS.platformBitmapFromBitmapDescriptor(bitmap); expect(platformBitmap.bitmap, isA()); - final PlatformBitmapDefaultMarker typedBitmap = + final typedBitmap = platformBitmap.bitmap as PlatformBitmapDefaultMarker; expect(typedBitmap.hue, 10.0); }); test('BytesMapBitmap bitmap to PlatformBitmap', () { - final Uint8List data = Uint8List.fromList([1, 2, 3, 4]); + final data = Uint8List.fromList([1, 2, 3, 4]); final BytesMapBitmap bitmap = BitmapDescriptor.bytes( data, imagePixelRatio: 2.0, @@ -1317,7 +1317,7 @@ void main() { final PlatformBitmap platformBitmap = GoogleMapsFlutterIOS.platformBitmapFromBitmapDescriptor(bitmap); expect(platformBitmap.bitmap, isA()); - final PlatformBitmapBytesMap typedBitmap = + final typedBitmap = platformBitmap.bitmap as PlatformBitmapBytesMap; expect(typedBitmap.byteData, data); expect(typedBitmap.bitmapScaling, PlatformMapBitmapScaling.auto); @@ -1327,8 +1327,8 @@ void main() { }); test('AssetMapBitmap bitmap to PlatformBitmap', () { - const String assetName = 'fake_asset_name'; - final AssetMapBitmap bitmap = AssetMapBitmap( + const assetName = 'fake_asset_name'; + final bitmap = AssetMapBitmap( assetName, imagePixelRatio: 2.0, width: 100.0, @@ -1337,7 +1337,7 @@ void main() { final PlatformBitmap platformBitmap = GoogleMapsFlutterIOS.platformBitmapFromBitmapDescriptor(bitmap); expect(platformBitmap.bitmap, isA()); - final PlatformBitmapAssetMap typedBitmap = + final typedBitmap = platformBitmap.bitmap as PlatformBitmapAssetMap; expect(typedBitmap.assetName, assetName); expect(typedBitmap.bitmapScaling, PlatformMapBitmapScaling.auto); @@ -1347,21 +1347,21 @@ void main() { }); testWidgets('cloudMapId is passed', (WidgetTester tester) async { - const String cloudMapId = '000000000000000'; // Dummy map ID. - final Completer passedCloudMapIdCompleter = Completer(); + const cloudMapId = '000000000000000'; // Dummy map ID. + final passedCloudMapIdCompleter = Completer(); TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler(SystemChannels.platform_views, ( MethodCall methodCall, ) { if (methodCall.method == 'create') { - final Map args = Map.from( + final args = Map.from( methodCall.arguments as Map, ); if (args.containsKey('params')) { - final Uint8List paramsUint8List = args['params'] as Uint8List; - final ByteData byteData = ByteData.sublistView(paramsUint8List); - final PlatformMapViewCreationParams? creationParams = + final paramsUint8List = args['params'] as Uint8List; + final byteData = ByteData.sublistView(paramsUint8List); + final creationParams = MapsApi.pigeonChannelCodec.decodeMessage(byteData) as PlatformMapViewCreationParams?; if (creationParams != null) { @@ -1376,7 +1376,7 @@ void main() { return null; }); - final GoogleMapsFlutterIOS maps = GoogleMapsFlutterIOS(); + final maps = GoogleMapsFlutterIOS(); await tester.pumpWidget( Directionality( 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 67c8d78570e..a114d1ef605 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 @@ -256,7 +256,7 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { final Map arguments = _getArgumentDictionary(call); final Map? tileOverlaysForThisMap = _tileOverlays[mapId]; - final String tileOverlayId = arguments['tileOverlayId']! as String; + final tileOverlayId = arguments['tileOverlayId']! as String; final TileOverlay? tileOverlay = tileOverlaysForThisMap?[TileOverlayId(tileOverlayId)]; final TileProvider? tileProvider = tileOverlay?.tileProvider; @@ -271,7 +271,7 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { return tile.toJson(); case 'cluster#onTap': final Map arguments = _getArgumentDictionary(call); - final ClusterManagerId clusterManagerId = ClusterManagerId( + final clusterManagerId = ClusterManagerId( arguments['clusterManagerId']! as String, ); final LatLng position = LatLng.fromJson(arguments['position'])!; @@ -284,7 +284,7 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { ), ); - final LatLngBounds bounds = LatLngBounds( + final bounds = LatLngBounds( northeast: LatLng.fromJson(latLngData['northeast'])!, southwest: LatLng.fromJson(latLngData['southwest'])!, ); @@ -389,7 +389,7 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { final Set previousSet = currentTileOverlays != null ? currentTileOverlays.values.toSet() : {}; - final TileOverlayUpdates updates = TileOverlayUpdates.from( + final updates = TileOverlayUpdates.from( previousSet, newTileOverlays, ); @@ -440,7 +440,7 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { final List successAndError = (await channel( mapId, ).invokeMethod>('map#setStyle', mapStyle))!; - final bool success = successAndError[0] as bool; + final success = successAndError[0] as bool; if (!success) { throw MapStyleException(successAndError[1] as String); } @@ -540,7 +540,7 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform { MapObjects mapObjects = const MapObjects(), Map mapOptions = const {}, }) { - final Map creationParams = { + final creationParams = { 'initialCameraPosition': widgetConfiguration.initialCameraPosition .toMap(), 'options': mapOptions, diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/serialization.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/serialization.dart index 5c3cf395141..8b3b6317b4e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/serialization.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/serialization.dart @@ -32,7 +32,7 @@ Object serializeMapsObjectUpdates>( MapsObjectUpdates updates, Object Function(T) serialize, ) { - final Map json = {}; + final json = {}; _addIfNonNull( json, @@ -57,7 +57,7 @@ Object serializeMapsObjectUpdates>( /// Serialize [Heatmap] Object serializeHeatmap(Heatmap heatmap) { - final Map json = {}; + final json = {}; _addIfNonNull(json, _heatmapIdKey, heatmap.heatmapId.value); _addIfNonNull( @@ -103,7 +103,7 @@ WeightedLatLng? deserializeWeightedLatLng(Object? json) { return null; } assert(json is List && json.length == 2); - final List list = json as List; + final list = json as List; final LatLng latLng = deserializeLatLng(list[0])!; return WeightedLatLng(latLng, weight: list[1] as double); } @@ -119,13 +119,13 @@ LatLng? deserializeLatLng(Object? json) { return null; } assert(json is List && json.length == 2); - final List list = json as List; + final list = json as List; return LatLng(list[0]! as double, list[1]! as double); } /// Serialize [HeatmapGradient] Object serializeHeatmapGradient(HeatmapGradient gradient) { - final Map json = {}; + final json = {}; _addIfNonNull( json, @@ -159,8 +159,8 @@ HeatmapGradient? deserializeHeatmapGradient(Object? json) { (map[_heatmapGradientStartPointsKey]! as List) .whereType() .toList(); - final List gradientColors = []; - for (int i = 0; i < colors.length; i++) { + final gradientColors = []; + for (var i = 0; i < colors.length; i++) { gradientColors.add(HeatmapGradientColor(colors[i], startPoints[i])); } return HeatmapGradient( diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/bitmap.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/bitmap.dart index 8ad4752685f..24e2d7dc700 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/bitmap.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/bitmap.dart @@ -63,14 +63,14 @@ abstract class BitmapDescriptor { @Deprecated('No longer supported') static BitmapDescriptor fromJson(Object json) { assert(json is List); - final List jsonList = json as List; + final jsonList = json as List; assert(_validTypes.contains(jsonList[0])); switch (jsonList[0]) { case _defaultMarker: assert(jsonList.length <= 2); if (jsonList.length == 2) { assert(jsonList[1] is num); - final num secondElement = jsonList[1] as num; + final secondElement = jsonList[1] as num; assert(0 <= secondElement && secondElement < 360); return DefaultMarker(hue: secondElement); } @@ -101,7 +101,7 @@ abstract class BitmapDescriptor { if (jsonList.length == 4) { assert(jsonList[3] != null && jsonList[3] is List); assert((jsonList[3] as List).length == 2); - final List sizeList = jsonList[3] as List; + final sizeList = jsonList[3] as List; return AssetImageBitmap( name: jsonList[1] as String, scale: jsonList[2] as double, @@ -118,7 +118,7 @@ abstract class BitmapDescriptor { case AssetMapBitmap.type: assert(jsonList.length == 2); assert(jsonList[1] != null && jsonList[1] is Map); - final Map jsonMap = + final jsonMap = jsonList[1] as Map; assert(jsonMap.containsKey('assetName')); assert(jsonMap.containsKey('bitmapScaling')); @@ -146,7 +146,7 @@ abstract class BitmapDescriptor { case BytesMapBitmap.type: assert(jsonList.length == 2); assert(jsonList[1] != null && jsonList[1] is Map); - final Map jsonMap = + final jsonMap = jsonList[1] as Map; assert(jsonMap.containsKey('byteData')); assert(jsonMap.containsKey('bitmapScaling')); @@ -256,7 +256,7 @@ abstract class BitmapDescriptor { if (!mipmaps && devicePixelRatio != null) { return AssetImageBitmap(name: assetName, scale: devicePixelRatio); } - final AssetImage assetImage = AssetImage( + final assetImage = AssetImage( assetName, package: package, bundle: bundle, @@ -811,7 +811,7 @@ class AssetMapBitmap extends MapBitmap { MapBitmapScaling bitmapScaling = MapBitmapScaling.auto, }) async { assert(assetName.isNotEmpty, 'The asset name must not be empty.'); - final AssetImage assetImage = AssetImage( + final assetImage = AssetImage( assetName, package: package, bundle: bundle, 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 2bf92bec7e6..f0c057d09e0 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 @@ -35,7 +35,7 @@ class ArgumentCallbacks { if (length == 1) { _callbacks[0].call(argument); } else if (0 < length) { - for (final ArgumentCallback callback in List>.from( + for (final callback in List>.from( _callbacks, )) { callback(argument); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/circle.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/circle.dart index 3dc0161d953..b20222748ef 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/circle.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/circle.dart @@ -111,7 +111,7 @@ class Circle implements MapsObject { /// Converts this object to something serializable in JSON. @override Object toJson() { - final Map json = {}; + final json = {}; void addIfPresent(String fieldName, Object? value) { if (value != null) { diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/cluster_manager.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/cluster_manager.dart index 67df384078d..db6cc0e455e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/cluster_manager.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/cluster_manager.dart @@ -46,7 +46,7 @@ class ClusterManager implements MapsObject { /// Converts this object to something serializable in JSON. @override Object toJson() { - final Map json = {}; + final json = {}; void addIfPresent(String fieldName, Object? value) { if (value != null) { diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/ground_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/ground_overlay.dart index bf712c71ab6..62d77a98c25 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/ground_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/ground_overlay.dart @@ -310,7 +310,7 @@ class GroundOverlay implements MapsObject { /// Converts this object to something serializable in JSON. @override Object toJson() { - final Map json = {}; + final json = {}; void addIfPresent(String fieldName, Object? value) { if (value != null) { diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/heatmap.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/heatmap.dart index 1eb10292aa8..88f33b8ab82 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/heatmap.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/heatmap.dart @@ -166,7 +166,7 @@ class Heatmap implements MapsObject { /// Converts this object to something serializable in JSON. @override Object toJson() { - final Map json = {}; + final json = {}; void addIfPresent(String fieldName, Object? value) { if (value != null) { @@ -283,7 +283,7 @@ class HeatmapGradient { /// Converts this object to something serializable in JSON. Object toJson() { - final Map json = {}; + final json = {}; void addIfPresent(String fieldName, Object? value) { if (value != null) { 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 6879757087f..9c193950a3a 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 @@ -39,7 +39,7 @@ class LatLng { return null; } assert(json is List && json.length == 2); - final List list = json as List; + final list = json as List; return LatLng(list[0]! as double, list[1]! as double); } @@ -111,7 +111,7 @@ class LatLngBounds { return null; } assert(json is List && json.length == 2); - final List list = json as List; + final list = json as List; return LatLngBounds( southwest: LatLng.fromJson(list[0])!, northeast: LatLng.fromJson(list[1])!, diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/maps_object_updates.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/maps_object_updates.dart index 85f9d2da4c1..33bf6efdc7e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/maps_object_updates.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/maps_object_updates.dart @@ -82,7 +82,7 @@ class MapsObjectUpdates> { /// Converts this object to JSON. Object toJson() { - final Map updateMap = {}; + final updateMap = {}; void addIfNonNull(String fieldName, Object? value) { if (value != null) { 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 3de612c04e5..7756ce42295 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 @@ -66,7 +66,7 @@ class InfoWindow { /// Converts this object to something serializable in JSON. Object toJson() { - final Map json = {}; + final json = {}; void addIfPresent(String fieldName, Object? value) { if (value != null) { @@ -317,7 +317,7 @@ class Marker implements MapsObject { /// Converts this object to something serializable in JSON. @override Object toJson() { - final Map json = {}; + final json = {}; void addIfPresent(String fieldName, Object? value) { if (value != null) { 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 fed4a2c9e48..9d84e1317c5 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 @@ -131,7 +131,7 @@ class Polygon implements MapsObject { /// Converts this object to something serializable in JSON. @override Object toJson() { - final Map json = {}; + final json = {}; void addIfPresent(String fieldName, Object? value) { if (value != null) { @@ -180,7 +180,7 @@ class Polygon implements MapsObject { int get hashCode => polygonId.hashCode; Object _pointsToJson() { - final List result = []; + final result = []; for (final LatLng point in points) { result.add(point.toJson()); } @@ -188,10 +188,10 @@ class Polygon implements MapsObject { } List> _holesToJson() { - final List> result = >[]; + final result = >[]; for (final List hole in holes) { - final List jsonHole = []; - for (final LatLng point in hole) { + final jsonHole = []; + for (final point in hole) { jsonHole.add(point.toJson()); } result.add(jsonHole); 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 085ed9e34be..970ffdb35a2 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 @@ -161,7 +161,7 @@ class Polyline implements MapsObject { /// Converts this object to something serializable in JSON. @override Object toJson() { - final Map json = {}; + final json = {}; void addIfPresent(String fieldName, Object? value) { if (value != null) { @@ -214,7 +214,7 @@ class Polyline implements MapsObject { int get hashCode => polylineId.hashCode; Object _pointsToJson() { - final List result = []; + final result = []; for (final LatLng point in points) { result.add(point.toJson()); } @@ -222,7 +222,7 @@ class Polyline implements MapsObject { } Object _patternToJson() { - final List result = []; + final result = []; for (final PatternItem patternItem in patterns) { result.add(patternItem.toJson()); } diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/tile.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/tile.dart index 6a14cfbc685..654095b7ae2 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/tile.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/tile.dart @@ -25,7 +25,7 @@ class Tile { /// Converts this object to JSON. Object toJson() { - final Map json = {}; + final json = {}; void addIfPresent(String fieldName, Object? value) { if (value != null) { diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/tile_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/tile_overlay.dart index e12458d83a0..7732b841306 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/tile_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/tile_overlay.dart @@ -112,7 +112,7 @@ class TileOverlay implements MapsObject { /// Converts this object to JSON. @override Object toJson() { - final Map json = {}; + final json = {}; void addIfPresent(String fieldName, Object? value) { if (value != null) { diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/method_channel/method_channel_google_maps_flutter_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/method_channel/method_channel_google_maps_flutter_test.dart index 6a998465c42..3beb22391e0 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/method_channel/method_channel_google_maps_flutter_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/method_channel/method_channel_google_maps_flutter_test.dart @@ -54,8 +54,8 @@ void main() { // TODO(stuartmorgan): Remove this once there is real test coverage of // each method, since that would cover this issue. test('non-void invokeMethods handle types correctly', () async { - const int mapId = 0; - final MethodChannelGoogleMapsFlutter maps = + const mapId = 0; + final maps = MethodChannelGoogleMapsFlutter(); configureMockMap( maps, @@ -87,34 +87,34 @@ void main() { ]); }); test('markers send drag event to correct streams', () async { - const int mapId = 1; - final Map jsonMarkerDragStartEvent = { + const mapId = 1; + final jsonMarkerDragStartEvent = { 'mapId': mapId, 'markerId': 'drag-start-marker', 'position': [1.0, 1.0], }; - final Map jsonMarkerDragEvent = { + final jsonMarkerDragEvent = { 'mapId': mapId, 'markerId': 'drag-marker', 'position': [1.0, 1.0], }; - final Map jsonMarkerDragEndEvent = { + final jsonMarkerDragEndEvent = { 'mapId': mapId, 'markerId': 'drag-end-marker', 'position': [1.0, 1.0], }; - final MethodChannelGoogleMapsFlutter maps = + final maps = MethodChannelGoogleMapsFlutter(); maps.ensureChannelInitialized(mapId); - final StreamQueue markerDragStartStream = + final markerDragStartStream = StreamQueue( maps.onMarkerDragStart(mapId: mapId), ); - final StreamQueue markerDragStream = + final markerDragStream = StreamQueue(maps.onMarkerDrag(mapId: mapId)); - final StreamQueue markerDragEndStream = + final markerDragEndStream = StreamQueue(maps.onMarkerDragEnd(mapId: mapId)); await sendPlatformMessage( diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/platform_interface/google_maps_flutter_platform_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/platform_interface/google_maps_flutter_platform_test.dart index 033421ea014..7b0dd4fefd4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/platform_interface/google_maps_flutter_platform_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/platform_interface/google_maps_flutter_platform_test.dart @@ -38,7 +38,7 @@ void main() { }); test('Can be mocked with `implements`', () { - final GoogleMapsFlutterPlatformMock mock = + final mock = GoogleMapsFlutterPlatformMock(); GoogleMapsFlutterPlatform.instance = mock; }); @@ -131,7 +131,7 @@ void main() { ExtendsGoogleMapsFlutterPlatform(); GoogleMapsFlutterPlatform.instance = platform; - const CameraUpdateAnimationConfiguration animationConfig = + const animationConfig = CameraUpdateAnimationConfiguration(duration: Duration(seconds: 2)); final CameraUpdate cameraUpdate = CameraUpdate.newCameraPosition( const CameraPosition(target: LatLng(10.0, 15.0)), diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/advanced_marker_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/advanced_marker_test.dart index a794cd5986f..190b3246dd9 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/advanced_marker_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/advanced_marker_test.dart @@ -9,7 +9,7 @@ void main() { group('$AdvancedMarker', () { test('constructor defaults', () { - final AdvancedMarker marker = AdvancedMarker( + final marker = AdvancedMarker( markerId: const MarkerId('ABC123'), ); @@ -46,7 +46,7 @@ void main() { test('toJson', () { final BitmapDescriptor testDescriptor = BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueCyan); - final AdvancedMarker marker = AdvancedMarker( + final marker = AdvancedMarker( markerId: const MarkerId('ABC123'), alpha: 0.12345, anchor: const Offset(100, 100), @@ -70,7 +70,7 @@ void main() { collisionBehavior: MarkerCollisionBehavior.requiredAndHidesOptional, ); - final Map json = marker.toJson() as Map; + final json = marker.toJson() as Map; expect(json, { 'markerId': 'ABC123', @@ -104,26 +104,26 @@ void main() { }); test('copyWith', () { - const MarkerId markerId = MarkerId('ABC123'); - final AdvancedMarker marker = AdvancedMarker(markerId: markerId); + const markerId = MarkerId('ABC123'); + final marker = AdvancedMarker(markerId: markerId); final BitmapDescriptor testDescriptor = BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueCyan); - const double testAlphaParam = 0.12345; - const Offset testAnchorParam = Offset(100, 100); + const testAlphaParam = 0.12345; + const testAnchorParam = Offset(100, 100); final bool testConsumeTapEventsParam = !marker.consumeTapEvents; final bool testDraggableParam = !marker.draggable; final bool testFlatParam = !marker.flat; - final BitmapDescriptor testIconParam = testDescriptor; - const InfoWindow testInfoWindowParam = InfoWindow(title: 'Test'); - const LatLng testPositionParam = LatLng(100, 100); + final testIconParam = testDescriptor; + const testInfoWindowParam = InfoWindow(title: 'Test'); + const testPositionParam = LatLng(100, 100); const double testRotationParam = 100; final bool testVisibleParam = !marker.visible; const double testZIndexParam = 100; - const ClusterManagerId testClusterManagerIdParam = ClusterManagerId( + const testClusterManagerIdParam = ClusterManagerId( 'DEF123', ); - final List log = []; + final log = []; const MarkerCollisionBehavior testCollisionBehavior = MarkerCollisionBehavior.requiredAndHidesOptional; @@ -184,7 +184,7 @@ void main() { }); test('zIndex param', () { - final AdvancedMarker marker = AdvancedMarker( + final marker = AdvancedMarker( markerId: const MarkerId('ABC123'), zIndex: 5, ); @@ -194,7 +194,7 @@ void main() { }); test('zIndexInt param copyWith', () { - final AdvancedMarker marker = AdvancedMarker( + final marker = AdvancedMarker( markerId: const MarkerId('ABC123'), zIndex: 5, ); @@ -204,7 +204,7 @@ void main() { }); test('zIndex param copyWith', () { - final AdvancedMarker marker = AdvancedMarker( + final marker = AdvancedMarker( markerId: const MarkerId('ABC123'), zIndex: 5, ); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/bitmap_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/bitmap_test.dart index 16aa10d28ee..095de5a7d6e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/bitmap_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/bitmap_test.dart @@ -219,7 +219,7 @@ void main() { test( 'mipmaps determines dpi', () async { - const ImageConfiguration imageConfiguration = ImageConfiguration( + const imageConfiguration = ImageConfiguration( devicePixelRatio: 3, ); @@ -592,8 +592,8 @@ void main() { ); test('create with size', () async { - const Size size = Size(100, 200); - const ImageConfiguration imageConfiguration = ImageConfiguration( + const size = Size(100, 200); + const imageConfiguration = ImageConfiguration( size: size, ); final BitmapDescriptor descriptor = await AssetMapBitmap.create( @@ -774,7 +774,7 @@ void main() { }); test('construct', () { - const PinConfig pinConfig = PinConfig( + const pinConfig = PinConfig( backgroundColor: Colors.green, borderColor: Colors.blue, ); @@ -791,7 +791,7 @@ void main() { }); test('construct with glyph text', () { - const PinConfig pinConfig = PinConfig( + const pinConfig = PinConfig( backgroundColor: Colors.green, borderColor: Colors.blue, glyph: TextGlyph(text: 'Hello', textColor: Colors.red), @@ -817,7 +817,7 @@ void main() { test('construct with glyph bitmap', () async { const BitmapDescriptor bitmap = AssetBitmap(name: 'red_square.png'); - const PinConfig pinConfig = PinConfig( + const pinConfig = PinConfig( backgroundColor: Colors.black, borderColor: Colors.red, glyph: BitmapGlyph(bitmap: bitmap), diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/camera_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/camera_test.dart index 7a7449ea213..0ecb775e2cf 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/camera_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/camera_test.dart @@ -9,7 +9,7 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); test('toMap / fromMap', () { - const CameraPosition cameraPosition = CameraPosition( + const cameraPosition = CameraPosition( target: LatLng(10.0, 15.0), bearing: 0.5, tilt: 30.0, @@ -26,7 +26,7 @@ void main() { }); test('CameraUpdate.newCameraPosition', () { - const CameraPosition cameraPosition = CameraPosition( + const cameraPosition = CameraPosition( target: LatLng(10.0, 15.0), bearing: 0.5, tilt: 30.0, @@ -39,27 +39,27 @@ void main() { expect(cameraUpdate.updateType, CameraUpdateType.newCameraPosition); cameraUpdate as CameraUpdateNewCameraPosition; expect(cameraUpdate.cameraPosition, cameraPosition); - final List jsonList = cameraUpdate.toJson() as List; + final jsonList = cameraUpdate.toJson() as List; expect(jsonList[0], 'newCameraPosition'); }); test('CameraUpdate.newLatLng', () { - const LatLng latLng = LatLng(1.0, 2.0); + const latLng = LatLng(1.0, 2.0); final CameraUpdate cameraUpdate = CameraUpdate.newLatLng(latLng); expect(cameraUpdate.runtimeType, CameraUpdateNewLatLng); expect(cameraUpdate.updateType, CameraUpdateType.newLatLng); cameraUpdate as CameraUpdateNewLatLng; expect(cameraUpdate.latLng, latLng); - final List jsonList = cameraUpdate.toJson() as List; + final jsonList = cameraUpdate.toJson() as List; expect(jsonList[0], 'newLatLng'); }); test('CameraUpdate.newLatLngBounds', () { - final LatLngBounds latLngBounds = LatLngBounds( + final latLngBounds = LatLngBounds( northeast: const LatLng(1.0, 2.0), southwest: const LatLng(-2.0, -3.0), ); - const double padding = 1.0; + const padding = 1.0; final CameraUpdate cameraUpdate = CameraUpdate.newLatLngBounds( latLngBounds, padding, @@ -69,46 +69,46 @@ void main() { cameraUpdate as CameraUpdateNewLatLngBounds; expect(cameraUpdate.bounds, latLngBounds); expect(cameraUpdate.padding, padding); - final List jsonList = cameraUpdate.toJson() as List; + final jsonList = cameraUpdate.toJson() as List; expect(jsonList[0], 'newLatLngBounds'); }); test('CameraUpdate.newLatLngZoom', () { - const LatLng latLng = LatLng(1.0, 2.0); - const double zoom = 2.0; + const latLng = LatLng(1.0, 2.0); + const zoom = 2.0; final CameraUpdate cameraUpdate = CameraUpdate.newLatLngZoom(latLng, zoom); expect(cameraUpdate.runtimeType, CameraUpdateNewLatLngZoom); expect(cameraUpdate.updateType, CameraUpdateType.newLatLngZoom); cameraUpdate as CameraUpdateNewLatLngZoom; expect(cameraUpdate.latLng, latLng); expect(cameraUpdate.zoom, zoom); - final List jsonList = cameraUpdate.toJson() as List; + final jsonList = cameraUpdate.toJson() as List; expect(jsonList[0], 'newLatLngZoom'); }); test('CameraUpdate.scrollBy', () { - const double dx = 2.0; - const double dy = 5.0; + const dx = 2.0; + const dy = 5.0; final CameraUpdate cameraUpdate = CameraUpdate.scrollBy(dx, dy); expect(cameraUpdate.runtimeType, CameraUpdateScrollBy); expect(cameraUpdate.updateType, CameraUpdateType.scrollBy); cameraUpdate as CameraUpdateScrollBy; expect(cameraUpdate.dx, dx); expect(cameraUpdate.dy, dy); - final List jsonList = cameraUpdate.toJson() as List; + final jsonList = cameraUpdate.toJson() as List; expect(jsonList[0], 'scrollBy'); }); test('CameraUpdate.zoomBy', () { - const double amount = 1.5; - const Offset focus = Offset(-1.0, -2.0); + const amount = 1.5; + const focus = Offset(-1.0, -2.0); final CameraUpdate cameraUpdate = CameraUpdate.zoomBy(amount, focus); expect(cameraUpdate.runtimeType, CameraUpdateZoomBy); expect(cameraUpdate.updateType, CameraUpdateType.zoomBy); cameraUpdate as CameraUpdateZoomBy; expect(cameraUpdate.amount, amount); expect(cameraUpdate.focus, focus); - final List jsonList = cameraUpdate.toJson() as List; + final jsonList = cameraUpdate.toJson() as List; expect(jsonList[0], 'zoomBy'); }); @@ -116,7 +116,7 @@ void main() { final CameraUpdate cameraUpdate = CameraUpdate.zoomIn(); expect(cameraUpdate.runtimeType, CameraUpdateZoomIn); expect(cameraUpdate.updateType, CameraUpdateType.zoomIn); - final List jsonList = cameraUpdate.toJson() as List; + final jsonList = cameraUpdate.toJson() as List; expect(jsonList[0], 'zoomIn'); }); @@ -124,7 +124,7 @@ void main() { final CameraUpdate cameraUpdate = CameraUpdate.zoomOut(); expect(cameraUpdate.runtimeType, CameraUpdateZoomOut); expect(cameraUpdate.updateType, CameraUpdateType.zoomOut); - final List jsonList = cameraUpdate.toJson() as List; + final jsonList = cameraUpdate.toJson() as List; expect(jsonList[0], 'zoomOut'); }); } diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/cluster_manager_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/cluster_manager_test.dart index 31aed908b9c..a842eed38df 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/cluster_manager_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/cluster_manager_test.dart @@ -11,7 +11,7 @@ void main() { group('$ClusterManager', () { test('constructor defaults', () { - const ClusterManager manager = ClusterManager( + const manager = ClusterManager( clusterManagerId: ClusterManagerId('1234'), ); @@ -19,16 +19,16 @@ void main() { }); test('toJson', () { - const ClusterManager manager = ClusterManager( + const manager = ClusterManager( clusterManagerId: ClusterManagerId('1234'), ); - final Map json = manager.toJson() as Map; + final json = manager.toJson() as Map; expect(json, {'clusterManagerId': '1234'}); }); test('clone', () { - const ClusterManager manager = ClusterManager( + const manager = ClusterManager( clusterManagerId: ClusterManagerId('1234'), ); final ClusterManager clone = manager.clone(); @@ -37,10 +37,10 @@ void main() { expect(clone, equals(manager)); }); test('copyWith', () { - const ClusterManager manager = ClusterManager( + const manager = ClusterManager( clusterManagerId: ClusterManagerId('1234'), ); - final List log = []; + final log = []; final ClusterManager copy = manager.copyWith( onClusterTapParam: (Cluster cluster) { diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/cluster_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/cluster_test.dart index 0cd37b2d40f..8641cb5fc85 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/cluster_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/cluster_test.dart @@ -11,7 +11,7 @@ void main() { group('$Cluster', () { test('constructor', () { - final Cluster cluster = Cluster( + final cluster = Cluster( const ClusterManagerId('3456787654'), const [MarkerId('23456')], position: const LatLng(55.0, 66.0), diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/ground_overlay_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/ground_overlay_test.dart index 471b60412fb..0b756643dcd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/ground_overlay_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/ground_overlay_test.dart @@ -9,29 +9,29 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); group('GroundOverlay', () { - const GroundOverlayId kID = GroundOverlayId('groundOverlay'); - final LatLngBounds kBounds = LatLngBounds( + const kID = GroundOverlayId('groundOverlay'); + final kBounds = LatLngBounds( southwest: const LatLng(37.42, -122.08), northeast: const LatLng(37.43, -122.09), ); - const LatLng kPosition = LatLng(37.42, -122.08); + const kPosition = LatLng(37.42, -122.08); final MapBitmap kMapBitmap = AssetMapBitmap( 'assets/asset.png', imagePixelRatio: 1.0, bitmapScaling: MapBitmapScaling.none, ); - const Offset kAnchor = Offset(0.3, 0.7); - const double kBearing = 45.0; - const double kTransparency = 0.5; - const int kZIndex = 1; - const bool kVisible = false; - const bool kClickable = false; + const kAnchor = Offset(0.3, 0.7); + const kBearing = 45.0; + const kTransparency = 0.5; + const kZIndex = 1; + const kVisible = false; + const kClickable = false; const double kWidth = 200; const double kHeight = 300; - const double kZoomLevel = 10.0; + const kZoomLevel = 10.0; test('fromBounds constructor defaults', () { - final GroundOverlay groundOverlay = GroundOverlay.fromBounds( + final groundOverlay = GroundOverlay.fromBounds( groundOverlayId: kID, image: kMapBitmap, bounds: kBounds, @@ -50,7 +50,7 @@ void main() { }); test('fromBounds construct with values', () { - final GroundOverlay groundOverlay = GroundOverlay.fromBounds( + final groundOverlay = GroundOverlay.fromBounds( groundOverlayId: kID, image: kMapBitmap, bounds: kBounds, @@ -74,7 +74,7 @@ void main() { }); test('fromPosition constructor defaults', () { - final GroundOverlay groundOverlay = GroundOverlay.fromPosition( + final groundOverlay = GroundOverlay.fromPosition( groundOverlayId: kID, image: kMapBitmap, position: kPosition, @@ -97,7 +97,7 @@ void main() { }); test('fromPosition construct with values', () { - final GroundOverlay groundOverlay = GroundOverlay.fromPosition( + final groundOverlay = GroundOverlay.fromPosition( groundOverlayId: kID, image: kMapBitmap, position: kPosition, @@ -127,7 +127,7 @@ void main() { }); test('copyWith fromPosition', () { - final GroundOverlay groundOverlay1 = GroundOverlay.fromPosition( + final groundOverlay1 = GroundOverlay.fromPosition( groundOverlayId: kID, image: kMapBitmap, position: kPosition, @@ -159,7 +159,7 @@ void main() { }); test('copyWith fromBounds', () { - final GroundOverlay groundOverlay1 = GroundOverlay.fromBounds( + final groundOverlay1 = GroundOverlay.fromBounds( groundOverlayId: kID, image: kMapBitmap, bounds: kBounds, @@ -189,7 +189,7 @@ void main() { }); test('fromPosition clone', () { - final GroundOverlay groundOverlay1 = GroundOverlay.fromPosition( + final groundOverlay1 = GroundOverlay.fromPosition( groundOverlayId: kID, image: kMapBitmap, position: kPosition, @@ -203,7 +203,7 @@ void main() { }); test('fromBounds clone', () { - final GroundOverlay groundOverlay1 = GroundOverlay.fromBounds( + final groundOverlay1 = GroundOverlay.fromBounds( groundOverlayId: kID, image: kMapBitmap, bounds: kBounds, @@ -215,7 +215,7 @@ void main() { }); test('==', () { - final GroundOverlay groundOverlayPosition1 = GroundOverlay.fromPosition( + final groundOverlayPosition1 = GroundOverlay.fromPosition( groundOverlayId: kID, image: kMapBitmap, position: kPosition, @@ -230,7 +230,7 @@ void main() { zoomLevel: kZoomLevel, ); - final GroundOverlay groundOverlayPosition2 = GroundOverlay.fromPosition( + final groundOverlayPosition2 = GroundOverlay.fromPosition( groundOverlayId: kID, image: kMapBitmap, position: kPosition, @@ -245,7 +245,7 @@ void main() { zoomLevel: kZoomLevel, ); - final GroundOverlay groundOverlayPosition3 = GroundOverlay.fromPosition( + final groundOverlayPosition3 = GroundOverlay.fromPosition( groundOverlayId: kID, image: kMapBitmap, position: kPosition, @@ -260,7 +260,7 @@ void main() { zoomLevel: kZoomLevel + 1, ); - final GroundOverlay groundOverlayBounds1 = GroundOverlay.fromBounds( + final groundOverlayBounds1 = GroundOverlay.fromBounds( groundOverlayId: kID, image: kMapBitmap, bounds: kBounds, @@ -272,7 +272,7 @@ void main() { clickable: kClickable, ); - final GroundOverlay groundOverlayBounds2 = GroundOverlay.fromBounds( + final groundOverlayBounds2 = GroundOverlay.fromBounds( groundOverlayId: kID, image: kMapBitmap, bounds: kBounds, @@ -284,7 +284,7 @@ void main() { clickable: kClickable, ); - final GroundOverlay groundOverlayBounds3 = GroundOverlay.fromBounds( + final groundOverlayBounds3 = GroundOverlay.fromBounds( groundOverlayId: kID, image: kMapBitmap, bounds: kBounds, @@ -304,7 +304,7 @@ void main() { }); test('hashCode', () { - final GroundOverlay groundOverlay = GroundOverlay.fromPosition( + final groundOverlay = GroundOverlay.fromPosition( groundOverlayId: kID, image: kMapBitmap, position: kPosition, diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/heatmap_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/heatmap_test.dart index 93329adbdf3..e0bc1d70d3d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/heatmap_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/heatmap_test.dart @@ -11,33 +11,33 @@ void main() { group('$HeatmapRadius', () { test('fromPixels', () { - const HeatmapRadius radius = HeatmapRadius.fromPixels(10); + const radius = HeatmapRadius.fromPixels(10); expect(radius.radius, 10); }); test('==', () { - const HeatmapRadius radius1 = HeatmapRadius.fromPixels(10); - const HeatmapRadius radius2 = HeatmapRadius.fromPixels(10); - const HeatmapRadius radius3 = HeatmapRadius.fromPixels(20); + const radius1 = HeatmapRadius.fromPixels(10); + const radius2 = HeatmapRadius.fromPixels(10); + const radius3 = HeatmapRadius.fromPixels(20); expect(radius1, radius2); expect(radius1, isNot(radius3)); }); test('hashCode', () { - const int radius = 10; - const HeatmapRadius heatmapRadius = HeatmapRadius.fromPixels(radius); + const radius = 10; + const heatmapRadius = HeatmapRadius.fromPixels(radius); expect(heatmapRadius.hashCode, radius.hashCode); }); }); group('$Heatmap', () { test('constructor defaults', () { - const HeatmapId id = HeatmapId('heatmap'); - const List data = [ + const id = HeatmapId('heatmap'); + const data = [ WeightedLatLng(LatLng(1, 1)), ]; - const HeatmapRadius radius = HeatmapRadius.fromPixels(10); - const Heatmap heatmap = Heatmap( + const radius = HeatmapRadius.fromPixels(10); + const heatmap = Heatmap( heatmapId: id, data: data, radius: radius, @@ -57,19 +57,19 @@ void main() { }); test('construct with values', () { - const HeatmapId id = HeatmapId('heatmap'); - const List data = [ + const id = HeatmapId('heatmap'); + const data = [ WeightedLatLng(LatLng(1, 1)), ]; - const HeatmapGradient gradient = HeatmapGradient([ + const gradient = HeatmapGradient([ HeatmapGradientColor(Colors.red, 0.0), ]); - const double maxIntensity = 1.0; - const double opacity = 0.5; - const HeatmapRadius radius = HeatmapRadius.fromPixels(10); - const int minimumZoomIntensity = 1; - const int maximumZoomIntensity = 20; - const Heatmap heatmap = Heatmap( + const maxIntensity = 1.0; + const opacity = 0.5; + const radius = HeatmapRadius.fromPixels(10); + const minimumZoomIntensity = 1; + const maximumZoomIntensity = 20; + const heatmap = Heatmap( heatmapId: id, data: data, dissipating: false, @@ -93,23 +93,23 @@ void main() { }); test('copyWith', () { - const Heatmap heatmap1 = Heatmap( + const heatmap1 = Heatmap( heatmapId: HeatmapId('heatmap'), data: [], radius: HeatmapRadius.fromPixels(10), ); - const List data = [ + const data = [ WeightedLatLng(LatLng(1, 1)), ]; - const HeatmapGradient gradient = HeatmapGradient([ + const gradient = HeatmapGradient([ HeatmapGradientColor(Colors.red, 0.0), ]); - const double maxIntensity = 1.0; - const double opacity = 0.5; - const HeatmapRadius radius = HeatmapRadius.fromPixels(20); - const int minimumZoomIntensity = 1; - const int maximumZoomIntensity = 20; + const maxIntensity = 1.0; + const opacity = 0.5; + const radius = HeatmapRadius.fromPixels(20); + const minimumZoomIntensity = 1; + const maximumZoomIntensity = 20; final Heatmap heatmap2 = heatmap1.copyWith( dataParam: data, @@ -133,7 +133,7 @@ void main() { }); test('clone', () { - const Heatmap heatmap1 = Heatmap( + const heatmap1 = Heatmap( heatmapId: HeatmapId('heatmap'), data: [], radius: HeatmapRadius.fromPixels(10), @@ -145,22 +145,22 @@ void main() { }); test('==', () { - const HeatmapId id = HeatmapId('heatmap'); - const List data = [ + const id = HeatmapId('heatmap'); + const data = [ WeightedLatLng(LatLng(1, 1)), ]; - const HeatmapRadius radius = HeatmapRadius.fromPixels(10); - const Heatmap heatmap1 = Heatmap( + const radius = HeatmapRadius.fromPixels(10); + const heatmap1 = Heatmap( heatmapId: id, data: data, radius: radius, ); - const Heatmap heatmap2 = Heatmap( + const heatmap2 = Heatmap( heatmapId: id, data: data, radius: radius, ); - const Heatmap heatmap3 = Heatmap( + const heatmap3 = Heatmap( heatmapId: id, data: data, radius: HeatmapRadius.fromPixels(20), @@ -171,8 +171,8 @@ void main() { }); test('hashCode', () { - const HeatmapId id = HeatmapId('heatmap'); - const Heatmap heatmap = Heatmap( + const id = HeatmapId('heatmap'); + const heatmap = Heatmap( heatmapId: id, data: [], radius: HeatmapRadius.fromPixels(10), @@ -184,26 +184,26 @@ void main() { group('$WeightedLatLng', () { test('constructor defaults', () { - const LatLng point = LatLng(1, 1); - const WeightedLatLng wll = WeightedLatLng(point); + const point = LatLng(1, 1); + const wll = WeightedLatLng(point); expect(wll.point, point); expect(wll.weight, 1.0); }); test('construct with values', () { - const LatLng point = LatLng(1, 1); - const double weight = 2.0; - const WeightedLatLng wll = WeightedLatLng(point, weight: weight); + const point = LatLng(1, 1); + const weight = 2.0; + const wll = WeightedLatLng(point, weight: weight); expect(wll.point, point); expect(wll.weight, weight); }); test('toJson', () { - const LatLng point = LatLng(1, 1); - const double weight = 2.0; - const WeightedLatLng wll = WeightedLatLng(point, weight: weight); + const point = LatLng(1, 1); + const weight = 2.0; + const wll = WeightedLatLng(point, weight: weight); expect(wll.toJson(), [ [point.latitude, point.longitude], @@ -212,28 +212,28 @@ void main() { }); test('toString', () { - const LatLng point = LatLng(1, 1); - const double weight = 2.0; - const WeightedLatLng wll = WeightedLatLng(point, weight: weight); + const point = LatLng(1, 1); + const weight = 2.0; + const wll = WeightedLatLng(point, weight: weight); expect(wll.toString(), 'WeightedLatLng($point, $weight)'); }); test('==', () { - const LatLng point = LatLng(1, 1); - const double weight = 2.0; - const WeightedLatLng wll1 = WeightedLatLng(point, weight: weight); - const WeightedLatLng wll2 = WeightedLatLng(point, weight: weight); - const WeightedLatLng wll3 = WeightedLatLng(point, weight: 3.0); + const point = LatLng(1, 1); + const weight = 2.0; + const wll1 = WeightedLatLng(point, weight: weight); + const wll2 = WeightedLatLng(point, weight: weight); + const wll3 = WeightedLatLng(point, weight: 3.0); expect(wll1, wll2); expect(wll1, isNot(wll3)); }); test('hashCode', () { - const LatLng point = LatLng(1, 1); - const double weight = 2.0; - const WeightedLatLng wll = WeightedLatLng(point, weight: weight); + const point = LatLng(1, 1); + const weight = 2.0; + const wll = WeightedLatLng(point, weight: weight); expect(wll.hashCode, Object.hash(point, weight)); }); @@ -241,21 +241,21 @@ void main() { group('$HeatmapGradient', () { test('constructor defaults', () { - const List colors = [ + const colors = [ HeatmapGradientColor(Colors.red, 0.0), ]; - const HeatmapGradient gradient = HeatmapGradient(colors); + const gradient = HeatmapGradient(colors); expect(gradient.colors, colors); expect(gradient.colorMapSize, 256); }); test('construct with values', () { - const List colors = [ + const colors = [ HeatmapGradientColor(Colors.red, 0.0), ]; - const int colorMapSize = 512; - const HeatmapGradient gradient = HeatmapGradient( + const colorMapSize = 512; + const gradient = HeatmapGradient( colors, colorMapSize: colorMapSize, ); @@ -265,14 +265,14 @@ void main() { }); test('copyWith', () { - const HeatmapGradient gradient1 = HeatmapGradient([ + const gradient1 = HeatmapGradient([ HeatmapGradientColor(Colors.red, 0.0), ]); - const List colors = [ + const colors = [ HeatmapGradientColor(Colors.blue, 0.0), ]; - const int colorMapSize = 512; + const colorMapSize = 512; final HeatmapGradient gradient2 = gradient1.copyWith( colorsParam: colors, colorMapSizeParam: colorMapSize, @@ -283,7 +283,7 @@ void main() { }); test('clone', () { - const HeatmapGradient gradient1 = HeatmapGradient([ + const gradient1 = HeatmapGradient([ HeatmapGradientColor(Colors.red, 0.0), ], colorMapSize: 512); @@ -292,11 +292,11 @@ void main() { }); test('toJson', () { - const List colors = [ + const colors = [ HeatmapGradientColor(Colors.red, 0.0), ]; - const int colorMapSize = 512; - const HeatmapGradient gradient = HeatmapGradient( + const colorMapSize = 512; + const gradient = HeatmapGradient( colors, colorMapSize: colorMapSize, ); @@ -313,12 +313,12 @@ void main() { }); test('==', () { - const List colors = [ + const colors = [ HeatmapGradientColor(Colors.red, 0.0), ]; - const HeatmapGradient gradient1 = HeatmapGradient(colors); - const HeatmapGradient gradient2 = HeatmapGradient(colors); - const HeatmapGradient gradient3 = HeatmapGradient([ + const gradient1 = HeatmapGradient(colors); + const gradient2 = HeatmapGradient(colors); + const gradient3 = HeatmapGradient([ HeatmapGradientColor(Colors.blue, 0.0), ], colorMapSize: 512); @@ -327,11 +327,11 @@ void main() { }); test('hashCode', () { - const List colors = [ + const colors = [ HeatmapGradientColor(Colors.red, 0.0), ]; - const int colorMapSize = 512; - const HeatmapGradient gradient = HeatmapGradient( + const colorMapSize = 512; + const gradient = HeatmapGradient( colors, colorMapSize: colorMapSize, ); @@ -343,8 +343,8 @@ void main() { group('$HeatmapGradientColor', () { test('construct with values', () { const Color color = Colors.red; - const double startPoint = 0.0; - const HeatmapGradientColor gradientColor = HeatmapGradientColor( + const startPoint = 0.0; + const gradientColor = HeatmapGradientColor( color, startPoint, ); @@ -354,13 +354,13 @@ void main() { }); test('copyWith', () { - const HeatmapGradientColor gradientColor1 = HeatmapGradientColor( + const gradientColor1 = HeatmapGradientColor( Colors.red, 0.0, ); const Color color = Colors.blue; - const double startPoint = 0.5; + const startPoint = 0.5; final HeatmapGradientColor gradientColor2 = gradientColor1.copyWith( colorParam: color, startPointParam: startPoint, @@ -371,7 +371,7 @@ void main() { }); test('clone', () { - const HeatmapGradientColor gradientColor1 = HeatmapGradientColor( + const gradientColor1 = HeatmapGradientColor( Colors.red, 0.0, ); @@ -381,15 +381,15 @@ void main() { }); test('==', () { - const HeatmapGradientColor gradientColor1 = HeatmapGradientColor( + const gradientColor1 = HeatmapGradientColor( Colors.red, 0.0, ); - const HeatmapGradientColor gradientColor2 = HeatmapGradientColor( + const gradientColor2 = HeatmapGradientColor( Colors.red, 0.0, ); - const HeatmapGradientColor gradientColor3 = HeatmapGradientColor( + const gradientColor3 = HeatmapGradientColor( Colors.blue, 0.0, ); @@ -399,7 +399,7 @@ void main() { }); test('hashCode', () { - const HeatmapGradientColor gradientColor = HeatmapGradientColor( + const gradientColor = HeatmapGradientColor( Colors.red, 0.0, ); @@ -411,7 +411,7 @@ void main() { }); test('toString', () { - const HeatmapGradientColor gradientColor = HeatmapGradientColor( + const gradientColor = HeatmapGradientColor( Colors.red, 0.0, ); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/location_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/location_test.dart index f7c9461fe66..55d8740fb3f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/location_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/location_test.dart @@ -10,50 +10,50 @@ void main() { group('LanLng constructor', () { test('Maintains longitude precision if within acceptable range', () async { - const double lat = -34.509981; - const double lng = 150.792384; + const lat = -34.509981; + const lng = 150.792384; - const LatLng latLng = LatLng(lat, lng); + const latLng = LatLng(lat, lng); expect(latLng.latitude, equals(lat)); expect(latLng.longitude, equals(lng)); }); test('Normalizes longitude that is below lower limit', () async { - const double lat = -34.509981; - const double lng = -270.0; + const lat = -34.509981; + const lng = -270.0; - const LatLng latLng = LatLng(lat, lng); + const latLng = LatLng(lat, lng); expect(latLng.latitude, equals(lat)); expect(latLng.longitude, equals(90.0)); }); test('Normalizes longitude that is above upper limit', () async { - const double lat = -34.509981; - const double lng = 270.0; + const lat = -34.509981; + const lng = 270.0; - const LatLng latLng = LatLng(lat, lng); + const latLng = LatLng(lat, lng); expect(latLng.latitude, equals(lat)); expect(latLng.longitude, equals(-90.0)); }); test('Includes longitude set to lower limit', () async { - const double lat = -34.509981; - const double lng = -180.0; + const lat = -34.509981; + const lng = -180.0; - const LatLng latLng = LatLng(lat, lng); + const latLng = LatLng(lat, lng); expect(latLng.latitude, equals(lat)); expect(latLng.longitude, equals(-180.0)); }); test('Normalizes longitude set to upper limit', () async { - const double lat = -34.509981; - const double lng = 180.0; + const lat = -34.509981; + const lng = 180.0; - const LatLng latLng = LatLng(lat, lng); + const latLng = LatLng(lat, lng); expect(latLng.latitude, equals(lat)); expect(latLng.longitude, equals(-180.0)); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/map_configuration_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/map_configuration_test.dart index e06d5daccf7..601e6c155fa 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/map_configuration_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/map_configuration_test.dart @@ -11,7 +11,7 @@ const String _kMapId = '000000000000000'; // Dummy map ID. void main() { group('diffs', () { // A options instance with every field set, to test diffs against. - final MapConfiguration diffBase = MapConfiguration( + final diffBase = MapConfiguration( webCameraControlPosition: WebCameraControlPosition.topRight, webCameraControlEnabled: false, webGestureHandling: WebGestureHandling.auto, @@ -43,14 +43,14 @@ void main() { ); test('only include changed fields', () async { - const MapConfiguration nullOptions = MapConfiguration(); + const nullOptions = MapConfiguration(); // Everything should be null since nothing changed. expect(diffBase.diffFrom(diffBase), nullOptions); }); test('only apply non-null fields', () async { - const MapConfiguration smallDiff = MapConfiguration(compassEnabled: true); + const smallDiff = MapConfiguration(compassEnabled: true); final MapConfiguration updated = diffBase.applyDiff(smallDiff); @@ -70,11 +70,11 @@ void main() { }); test('handle webGestureHandling', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( webGestureHandling: WebGestureHandling.none, ); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -88,11 +88,11 @@ void main() { }); test('handle webCameraControlPosition', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( webCameraControlPosition: WebCameraControlPosition.blockEndInlineEnd, ); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -109,11 +109,11 @@ void main() { }); test('handle webCameraControlEnabled', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( webCameraControlEnabled: true, ); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -127,9 +127,9 @@ void main() { }); test('handle compassEnabled', () async { - const MapConfiguration diff = MapConfiguration(compassEnabled: true); + const diff = MapConfiguration(compassEnabled: true); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -143,9 +143,9 @@ void main() { }); test('handle mapToolbarEnabled', () async { - const MapConfiguration diff = MapConfiguration(mapToolbarEnabled: true); + const diff = MapConfiguration(mapToolbarEnabled: true); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -159,17 +159,17 @@ void main() { }); test('handle cameraTargetBounds', () async { - final CameraTargetBounds newBounds = CameraTargetBounds( + final newBounds = CameraTargetBounds( LatLngBounds( northeast: const LatLng(55, 15), southwest: const LatLng(5, 15), ), ); - final MapConfiguration diff = MapConfiguration( + final diff = MapConfiguration( cameraTargetBounds: newBounds, ); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -183,11 +183,11 @@ void main() { }); test('handle mapType', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( mapType: MapType.satellite, ); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -201,12 +201,12 @@ void main() { }); test('handle minMaxZoomPreference', () async { - const MinMaxZoomPreference newZoomPref = MinMaxZoomPreference(3.3, 4.5); - const MapConfiguration diff = MapConfiguration( + const newZoomPref = MinMaxZoomPreference(3.3, 4.5); + const diff = MapConfiguration( minMaxZoomPreference: newZoomPref, ); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -220,11 +220,11 @@ void main() { }); test('handle rotateGesturesEnabled', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( rotateGesturesEnabled: true, ); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -238,11 +238,11 @@ void main() { }); test('handle scrollGesturesEnabled', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( scrollGesturesEnabled: true, ); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -256,9 +256,9 @@ void main() { }); test('handle tiltGesturesEnabled', () async { - const MapConfiguration diff = MapConfiguration(tiltGesturesEnabled: true); + const diff = MapConfiguration(tiltGesturesEnabled: true); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -272,11 +272,11 @@ void main() { }); test('handle fortyFiveDegreeImageryEnabled', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( fortyFiveDegreeImageryEnabled: true, ); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -290,9 +290,9 @@ void main() { }); test('handle trackCameraPosition', () async { - const MapConfiguration diff = MapConfiguration(trackCameraPosition: true); + const diff = MapConfiguration(trackCameraPosition: true); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -306,9 +306,9 @@ void main() { }); test('handle zoomControlsEnabled', () async { - const MapConfiguration diff = MapConfiguration(zoomControlsEnabled: true); + const diff = MapConfiguration(zoomControlsEnabled: true); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -322,9 +322,9 @@ void main() { }); test('handle zoomGesturesEnabled', () async { - const MapConfiguration diff = MapConfiguration(zoomGesturesEnabled: true); + const diff = MapConfiguration(zoomGesturesEnabled: true); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -338,9 +338,9 @@ void main() { }); test('handle liteModeEnabled', () async { - const MapConfiguration diff = MapConfiguration(liteModeEnabled: true); + const diff = MapConfiguration(liteModeEnabled: true); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -354,9 +354,9 @@ void main() { }); test('handle myLocationEnabled', () async { - const MapConfiguration diff = MapConfiguration(myLocationEnabled: true); + const diff = MapConfiguration(myLocationEnabled: true); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -370,11 +370,11 @@ void main() { }); test('handle myLocationButtonEnabled', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( myLocationButtonEnabled: true, ); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -388,13 +388,13 @@ void main() { }); test('handle padding', () async { - const EdgeInsets newPadding = EdgeInsets.symmetric( + const newPadding = EdgeInsets.symmetric( vertical: 1.0, horizontal: 3.0, ); - const MapConfiguration diff = MapConfiguration(padding: newPadding); + const diff = MapConfiguration(padding: newPadding); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -408,9 +408,9 @@ void main() { }); test('handle indoorViewEnabled', () async { - const MapConfiguration diff = MapConfiguration(indoorViewEnabled: true); + const diff = MapConfiguration(indoorViewEnabled: true); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -424,9 +424,9 @@ void main() { }); test('handle trafficEnabled', () async { - const MapConfiguration diff = MapConfiguration(trafficEnabled: true); + const diff = MapConfiguration(trafficEnabled: true); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -440,9 +440,9 @@ void main() { }); test('handle buildingsEnabled', () async { - const MapConfiguration diff = MapConfiguration(buildingsEnabled: true); + const diff = MapConfiguration(buildingsEnabled: true); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -456,9 +456,9 @@ void main() { }); test('handle cloudMapId', () async { - const MapConfiguration diff = MapConfiguration(cloudMapId: _kMapId); + const diff = MapConfiguration(cloudMapId: _kMapId); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -473,9 +473,9 @@ void main() { }); test('handle mapId', () async { - const MapConfiguration diff = MapConfiguration(mapId: _kMapId); + const diff = MapConfiguration(mapId: _kMapId); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -489,10 +489,10 @@ void main() { }); test('handle style', () async { - const String aStlye = 'a style'; - const MapConfiguration diff = MapConfiguration(style: aStlye); + const aStlye = 'a style'; + const diff = MapConfiguration(style: aStlye); - const MapConfiguration empty = MapConfiguration(); + const empty = MapConfiguration(); final MapConfiguration updated = diffBase.applyDiff(diff); // A diff applied to empty options should be the diff itself. @@ -508,13 +508,13 @@ void main() { group('isEmpty', () { test('is true for empty', () async { - const MapConfiguration nullOptions = MapConfiguration(); + const nullOptions = MapConfiguration(); expect(nullOptions.isEmpty, true); }); test('is false with webCameraControlEnabled', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( webCameraControlEnabled: true, ); @@ -522,7 +522,7 @@ void main() { }); test('is false with webCameraControlPosition', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( webCameraControlPosition: WebCameraControlPosition.blockEndInlineCenter, ); @@ -530,25 +530,25 @@ void main() { }); test('is false with compassEnabled', () async { - const MapConfiguration diff = MapConfiguration(compassEnabled: true); + const diff = MapConfiguration(compassEnabled: true); expect(diff.isEmpty, false); }); test('is false with mapToolbarEnabled', () async { - const MapConfiguration diff = MapConfiguration(mapToolbarEnabled: true); + const diff = MapConfiguration(mapToolbarEnabled: true); expect(diff.isEmpty, false); }); test('is false with cameraTargetBounds', () async { - final CameraTargetBounds newBounds = CameraTargetBounds( + final newBounds = CameraTargetBounds( LatLngBounds( northeast: const LatLng(55, 15), southwest: const LatLng(5, 15), ), ); - final MapConfiguration diff = MapConfiguration( + final diff = MapConfiguration( cameraTargetBounds: newBounds, ); @@ -556,7 +556,7 @@ void main() { }); test('is false with mapType', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( mapType: MapType.satellite, ); @@ -564,8 +564,8 @@ void main() { }); test('is false with minMaxZoomPreference', () async { - const MinMaxZoomPreference newZoomPref = MinMaxZoomPreference(3.3, 4.5); - const MapConfiguration diff = MapConfiguration( + const newZoomPref = MinMaxZoomPreference(3.3, 4.5); + const diff = MapConfiguration( minMaxZoomPreference: newZoomPref, ); @@ -573,7 +573,7 @@ void main() { }); test('is false with rotateGesturesEnabled', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( rotateGesturesEnabled: true, ); @@ -581,7 +581,7 @@ void main() { }); test('is false with scrollGesturesEnabled', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( scrollGesturesEnabled: true, ); @@ -589,43 +589,43 @@ void main() { }); test('is false with tiltGesturesEnabled', () async { - const MapConfiguration diff = MapConfiguration(tiltGesturesEnabled: true); + const diff = MapConfiguration(tiltGesturesEnabled: true); expect(diff.isEmpty, false); }); test('is false with trackCameraPosition', () async { - const MapConfiguration diff = MapConfiguration(trackCameraPosition: true); + const diff = MapConfiguration(trackCameraPosition: true); expect(diff.isEmpty, false); }); test('is false with zoomControlsEnabled', () async { - const MapConfiguration diff = MapConfiguration(zoomControlsEnabled: true); + const diff = MapConfiguration(zoomControlsEnabled: true); expect(diff.isEmpty, false); }); test('is false with zoomGesturesEnabled', () async { - const MapConfiguration diff = MapConfiguration(zoomGesturesEnabled: true); + const diff = MapConfiguration(zoomGesturesEnabled: true); expect(diff.isEmpty, false); }); test('is false with liteModeEnabled', () async { - const MapConfiguration diff = MapConfiguration(liteModeEnabled: true); + const diff = MapConfiguration(liteModeEnabled: true); expect(diff.isEmpty, false); }); test('is false with myLocationEnabled', () async { - const MapConfiguration diff = MapConfiguration(myLocationEnabled: true); + const diff = MapConfiguration(myLocationEnabled: true); expect(diff.isEmpty, false); }); test('is false with myLocationButtonEnabled', () async { - const MapConfiguration diff = MapConfiguration( + const diff = MapConfiguration( myLocationButtonEnabled: true, ); @@ -633,47 +633,47 @@ void main() { }); test('is false with padding', () async { - const EdgeInsets newPadding = EdgeInsets.symmetric( + const newPadding = EdgeInsets.symmetric( vertical: 1.0, horizontal: 3.0, ); - const MapConfiguration diff = MapConfiguration(padding: newPadding); + const diff = MapConfiguration(padding: newPadding); expect(diff.isEmpty, false); }); test('is false with indoorViewEnabled', () async { - const MapConfiguration diff = MapConfiguration(indoorViewEnabled: true); + const diff = MapConfiguration(indoorViewEnabled: true); expect(diff.isEmpty, false); }); test('is false with trafficEnabled', () async { - const MapConfiguration diff = MapConfiguration(trafficEnabled: true); + const diff = MapConfiguration(trafficEnabled: true); expect(diff.isEmpty, false); }); test('is false with buildingsEnabled', () async { - const MapConfiguration diff = MapConfiguration(buildingsEnabled: true); + const diff = MapConfiguration(buildingsEnabled: true); expect(diff.isEmpty, false); }); test('is false with cloudMapId', () async { - const MapConfiguration diff = MapConfiguration(mapId: _kMapId); + const diff = MapConfiguration(mapId: _kMapId); expect(diff.isEmpty, false); }); test('is false with mapId', () async { - const MapConfiguration diff = MapConfiguration(mapId: _kMapId); + const diff = MapConfiguration(mapId: _kMapId); expect(diff.isEmpty, false); }); test('is false with style', () async { - const MapConfiguration diff = MapConfiguration(style: 'a style'); + const diff = MapConfiguration(style: 'a style'); expect(diff.isEmpty, false); }); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/maps_object_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/maps_object_test.dart index 37d5e9430c0..4dadb84ef9f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/maps_object_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/maps_object_test.dart @@ -12,12 +12,12 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); test('keyByMapsObjectId', () async { - const MapsObjectId id1 = MapsObjectId('1'); - const MapsObjectId id2 = MapsObjectId('2'); - const MapsObjectId id3 = MapsObjectId('3'); - const TestMapsObject object1 = TestMapsObject(id1); - const TestMapsObject object2 = TestMapsObject(id2, data: 2); - const TestMapsObject object3 = TestMapsObject(id3); + const id1 = MapsObjectId('1'); + const id2 = MapsObjectId('2'); + const id3 = MapsObjectId('3'); + const object1 = TestMapsObject(id1); + const object2 = TestMapsObject(id2, data: 2); + const object3 = TestMapsObject(id3); expect( keyByMapsObjectId({object1, object2, object3}), , TestMapsObject>{ @@ -29,12 +29,12 @@ void main() { }); test('serializeMapsObjectSet', () async { - const MapsObjectId id1 = MapsObjectId('1'); - const MapsObjectId id2 = MapsObjectId('2'); - const MapsObjectId id3 = MapsObjectId('3'); - const TestMapsObject object1 = TestMapsObject(id1); - const TestMapsObject object2 = TestMapsObject(id2, data: 2); - const TestMapsObject object3 = TestMapsObject(id3); + const id1 = MapsObjectId('1'); + const id2 = MapsObjectId('2'); + const id3 = MapsObjectId('3'); + const object1 = TestMapsObject(id1); + const object2 = TestMapsObject(id2, data: 2); + const object3 = TestMapsObject(id3); expect( serializeMapsObjectSet({object1, object2, object3}), >[ diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/maps_object_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/maps_object_updates_test.dart index c2fb440eb5e..2e33fd32e41 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/maps_object_updates_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/maps_object_updates_test.dart @@ -19,70 +19,70 @@ void main() { group('tile overlay updates tests', () { test('Correctly set toRemove, toAdd and toChange', () async { - const TestMapsObject to1 = TestMapsObject( + const to1 = TestMapsObject( MapsObjectId('id1'), ); - const TestMapsObject to2 = TestMapsObject( + const to2 = TestMapsObject( MapsObjectId('id2'), ); - const TestMapsObject to3 = TestMapsObject( + const to3 = TestMapsObject( MapsObjectId('id3'), ); - const TestMapsObject to3Changed = TestMapsObject( + const to3Changed = TestMapsObject( MapsObjectId('id3'), data: 2, ); - const TestMapsObject to4 = TestMapsObject( + const to4 = TestMapsObject( MapsObjectId('id4'), ); - final Set previous = {to1, to2, to3}; - final Set current = { + final previous = {to1, to2, to3}; + final current = { to2, to3Changed, to4, }; - final TestMapsObjectUpdate updates = TestMapsObjectUpdate.from( + final updates = TestMapsObjectUpdate.from( previous, current, ); - final Set> toRemove = + final toRemove = >{ const MapsObjectId('id1'), }; expect(updates.objectIdsToRemove, toRemove); - final Set toAdd = {to4}; + final toAdd = {to4}; expect(updates.objectsToAdd, toAdd); - final Set toChange = {to3Changed}; + final toChange = {to3Changed}; expect(updates.objectsToChange, toChange); }); test('toJson', () async { - const TestMapsObject to1 = TestMapsObject( + const to1 = TestMapsObject( MapsObjectId('id1'), ); - const TestMapsObject to2 = TestMapsObject( + const to2 = TestMapsObject( MapsObjectId('id2'), ); - const TestMapsObject to3 = TestMapsObject( + const to3 = TestMapsObject( MapsObjectId('id3'), ); - const TestMapsObject to3Changed = TestMapsObject( + const to3Changed = TestMapsObject( MapsObjectId('id3'), data: 2, ); - const TestMapsObject to4 = TestMapsObject( + const to4 = TestMapsObject( MapsObjectId('id4'), ); - final Set previous = {to1, to2, to3}; - final Set current = { + final previous = {to1, to2, to3}; + final current = { to2, to3Changed, to4, }; - final TestMapsObjectUpdate updates = TestMapsObjectUpdate.from( + final updates = TestMapsObjectUpdate.from( previous, current, ); @@ -98,43 +98,43 @@ void main() { }); test('equality', () async { - const TestMapsObject to1 = TestMapsObject( + const to1 = TestMapsObject( MapsObjectId('id1'), ); - const TestMapsObject to2 = TestMapsObject( + const to2 = TestMapsObject( MapsObjectId('id2'), ); - const TestMapsObject to3 = TestMapsObject( + const to3 = TestMapsObject( MapsObjectId('id3'), ); - const TestMapsObject to3Changed = TestMapsObject( + const to3Changed = TestMapsObject( MapsObjectId('id3'), data: 2, ); - const TestMapsObject to4 = TestMapsObject( + const to4 = TestMapsObject( MapsObjectId('id4'), ); - final Set previous = {to1, to2, to3}; - final Set current1 = { + final previous = {to1, to2, to3}; + final current1 = { to2, to3Changed, to4, }; - final Set current2 = { + final current2 = { to2, to3Changed, to4, }; - final Set current3 = {to2, to4}; - final TestMapsObjectUpdate updates1 = TestMapsObjectUpdate.from( + final current3 = {to2, to4}; + final updates1 = TestMapsObjectUpdate.from( previous, current1, ); - final TestMapsObjectUpdate updates2 = TestMapsObjectUpdate.from( + final updates2 = TestMapsObjectUpdate.from( previous, current2, ); - final TestMapsObjectUpdate updates3 = TestMapsObjectUpdate.from( + final updates3 = TestMapsObjectUpdate.from( previous, current3, ); @@ -143,29 +143,29 @@ void main() { }); test('hashCode', () async { - const TestMapsObject to1 = TestMapsObject( + const to1 = TestMapsObject( MapsObjectId('id1'), ); - const TestMapsObject to2 = TestMapsObject( + const to2 = TestMapsObject( MapsObjectId('id2'), ); - const TestMapsObject to3 = TestMapsObject( + const to3 = TestMapsObject( MapsObjectId('id3'), ); - const TestMapsObject to3Changed = TestMapsObject( + const to3Changed = TestMapsObject( MapsObjectId('id3'), data: 2, ); - const TestMapsObject to4 = TestMapsObject( + const to4 = TestMapsObject( MapsObjectId('id4'), ); - final Set previous = {to1, to2, to3}; - final Set current = { + final previous = {to1, to2, to3}; + final current = { to2, to3Changed, to4, }; - final TestMapsObjectUpdate updates = TestMapsObjectUpdate.from( + final updates = TestMapsObjectUpdate.from( previous, current, ); @@ -180,29 +180,29 @@ void main() { }); test('toString', () async { - const TestMapsObject to1 = TestMapsObject( + const to1 = TestMapsObject( MapsObjectId('id1'), ); - const TestMapsObject to2 = TestMapsObject( + const to2 = TestMapsObject( MapsObjectId('id2'), ); - const TestMapsObject to3 = TestMapsObject( + const to3 = TestMapsObject( MapsObjectId('id3'), ); - const TestMapsObject to3Changed = TestMapsObject( + const to3Changed = TestMapsObject( MapsObjectId('id3'), data: 2, ); - const TestMapsObject to4 = TestMapsObject( + const to4 = TestMapsObject( MapsObjectId('id4'), ); - final Set previous = {to1, to2, to3}; - final Set current = { + final previous = {to1, to2, to3}; + final current = { to2, to3Changed, to4, }; - final TestMapsObjectUpdate updates = TestMapsObjectUpdate.from( + final updates = TestMapsObjectUpdate.from( previous, current, ); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/marker_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/marker_test.dart index 18475b541f8..5b79cf3dc8c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/marker_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/marker_test.dart @@ -10,7 +10,7 @@ void main() { group('$Marker', () { test('constructor defaults', () { - const Marker marker = Marker(markerId: MarkerId('ABC123')); + const marker = Marker(markerId: MarkerId('ABC123')); expect(marker.alpha, equals(1.0)); expect(marker.anchor, equals(const Offset(0.5, 1.0))); @@ -44,7 +44,7 @@ void main() { test('toJson', () { final BitmapDescriptor testDescriptor = BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueCyan); - final Marker marker = Marker( + final marker = Marker( markerId: const MarkerId('ABC123'), alpha: 0.12345, anchor: const Offset(100, 100), @@ -67,7 +67,7 @@ void main() { onDragEnd: (LatLng latLng) {}, ); - final Map json = marker.toJson() as Map; + final json = marker.toJson() as Map; expect(json, { 'markerId': 'ABC123', @@ -90,33 +90,33 @@ void main() { }); }); test('clone', () { - const Marker marker = Marker(markerId: MarkerId('ABC123')); + const marker = Marker(markerId: MarkerId('ABC123')); final Marker clone = marker.clone(); expect(identical(clone, marker), isFalse); expect(clone, equals(marker)); }); test('copyWith', () { - const MarkerId markerId = MarkerId('ABC123'); - const Marker marker = Marker(markerId: markerId); + const markerId = MarkerId('ABC123'); + const marker = Marker(markerId: markerId); final BitmapDescriptor testDescriptor = BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueCyan); - const double testAlphaParam = 0.12345; - const Offset testAnchorParam = Offset(100, 100); + const testAlphaParam = 0.12345; + const testAnchorParam = Offset(100, 100); final bool testConsumeTapEventsParam = !marker.consumeTapEvents; final bool testDraggableParam = !marker.draggable; final bool testFlatParam = !marker.flat; - final BitmapDescriptor testIconParam = testDescriptor; - const InfoWindow testInfoWindowParam = InfoWindow(title: 'Test'); - const LatLng testPositionParam = LatLng(100, 100); + final testIconParam = testDescriptor; + const testInfoWindowParam = InfoWindow(title: 'Test'); + const testPositionParam = LatLng(100, 100); const double testRotationParam = 100; final bool testVisibleParam = !marker.visible; const double testZIndexParam = 100; - const ClusterManagerId testClusterManagerIdParam = ClusterManagerId( + const testClusterManagerIdParam = ClusterManagerId( 'DEF123', ); - final List log = []; + final log = []; final Marker copy = marker.copyWith( alphaParam: testAlphaParam, @@ -184,28 +184,28 @@ void main() { }); test('zIndex param', () { - const Marker marker = Marker(markerId: MarkerId('ABC123'), zIndex: 5.00); + const marker = Marker(markerId: MarkerId('ABC123'), zIndex: 5.00); expect(marker.zIndexInt, 5); expect(marker.zIndex, 5.00); }); test('zIndexInt param', () { - const Marker marker = Marker(markerId: MarkerId('ABC123'), zIndexInt: 5); + const marker = Marker(markerId: MarkerId('ABC123'), zIndexInt: 5); expect(marker.zIndexInt, 5); expect(marker.zIndex, 5.00); }); test('zIndexInt param copyWith', () { - const Marker marker = Marker(markerId: MarkerId('ABC123'), zIndexInt: 5); + const marker = Marker(markerId: MarkerId('ABC123'), zIndexInt: 5); final Marker copy = marker.copyWith(zIndexIntParam: 10); expect(copy.zIndexInt, 10); expect(copy.zIndex, 10.0); }); test('zIndex param copyWith', () { - const Marker marker = Marker(markerId: MarkerId('ABC123'), zIndexInt: 5); + const marker = Marker(markerId: MarkerId('ABC123'), zIndexInt: 5); final Marker copy = marker.copyWith(zIndexParam: 10.0); expect(copy.zIndexInt, 10); expect(copy.zIndex, 10.0); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_overlay_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_overlay_test.dart index c60d4d8b4d8..e4092ac385e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_overlay_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_overlay_test.dart @@ -17,22 +17,22 @@ void main() { group('tile overlay id tests', () { test('equality', () async { - const TileOverlayId id1 = TileOverlayId('1'); - const TileOverlayId id2 = TileOverlayId('1'); - const TileOverlayId id3 = TileOverlayId('2'); + const id1 = TileOverlayId('1'); + const id2 = TileOverlayId('1'); + const id3 = TileOverlayId('2'); expect(id1, id2); expect(id1, isNot(id3)); }); test('toString', () async { - const TileOverlayId id1 = TileOverlayId('1'); + const id1 = TileOverlayId('1'); expect(id1.toString(), 'TileOverlayId(1)'); }); }); group('tile overlay tests', () { test('toJson returns correct format', () async { - const TileOverlay tileOverlay = TileOverlay( + const tileOverlay = TileOverlay( tileOverlayId: TileOverlayId('id'), fadeIn: false, transparency: 0.1, @@ -70,7 +70,7 @@ void main() { test('equality', () async { final TileProvider tileProvider = _TestTileProvider(); - final TileOverlay tileOverlay1 = TileOverlay( + final tileOverlay1 = TileOverlay( tileOverlayId: const TileOverlayId('id1'), fadeIn: false, tileProvider: tileProvider, @@ -79,7 +79,7 @@ void main() { visible: false, tileSize: 128, ); - final TileOverlay tileOverlaySameValues = TileOverlay( + final tileOverlaySameValues = TileOverlay( tileOverlayId: const TileOverlayId('id1'), fadeIn: false, tileProvider: tileProvider, @@ -88,7 +88,7 @@ void main() { visible: false, tileSize: 128, ); - final TileOverlay tileOverlayDifferentId = TileOverlay( + final tileOverlayDifferentId = TileOverlay( tileOverlayId: const TileOverlayId('id2'), fadeIn: false, tileProvider: tileProvider, @@ -97,7 +97,7 @@ void main() { visible: false, tileSize: 128, ); - const TileOverlay tileOverlayDifferentProvider = TileOverlay( + const tileOverlayDifferentProvider = TileOverlay( tileOverlayId: TileOverlayId('id1'), fadeIn: false, transparency: 0.1, @@ -113,7 +113,7 @@ void main() { test('clone', () async { final TileProvider tileProvider = _TestTileProvider(); // Set non-default values for every parameter. - final TileOverlay tileOverlay = TileOverlay( + final tileOverlay = TileOverlay( tileOverlayId: const TileOverlayId('id1'), fadeIn: false, tileProvider: tileProvider, @@ -127,8 +127,8 @@ void main() { test('hashCode', () async { final TileProvider tileProvider = _TestTileProvider(); - const TileOverlayId id = TileOverlayId('id1'); - final TileOverlay tileOverlay = TileOverlay( + const id = TileOverlayId('id1'); + final tileOverlay = TileOverlay( tileOverlayId: id, fadeIn: false, tileProvider: tileProvider, diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_overlay_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_overlay_updates_test.dart index b7f91c06c75..6bb0551ac42 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_overlay_updates_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_overlay_updates_test.dart @@ -12,45 +12,45 @@ void main() { group('tile overlay updates tests', () { test('Correctly set toRemove, toAdd and toChange', () async { - const TileOverlay to1 = TileOverlay(tileOverlayId: TileOverlayId('id1')); - const TileOverlay to2 = TileOverlay(tileOverlayId: TileOverlayId('id2')); - const TileOverlay to3 = TileOverlay(tileOverlayId: TileOverlayId('id3')); - const TileOverlay to3Changed = TileOverlay( + const to1 = TileOverlay(tileOverlayId: TileOverlayId('id1')); + const to2 = TileOverlay(tileOverlayId: TileOverlayId('id2')); + const to3 = TileOverlay(tileOverlayId: TileOverlayId('id3')); + const to3Changed = TileOverlay( tileOverlayId: TileOverlayId('id3'), transparency: 0.5, ); - const TileOverlay to4 = TileOverlay(tileOverlayId: TileOverlayId('id4')); - final Set previous = {to1, to2, to3}; - final Set current = {to2, to3Changed, to4}; - final TileOverlayUpdates updates = TileOverlayUpdates.from( + const to4 = TileOverlay(tileOverlayId: TileOverlayId('id4')); + final previous = {to1, to2, to3}; + final current = {to2, to3Changed, to4}; + final updates = TileOverlayUpdates.from( previous, current, ); - final Set toRemove = { + final toRemove = { const TileOverlayId('id1'), }; expect(updates.tileOverlayIdsToRemove, toRemove); - final Set toAdd = {to4}; + final toAdd = {to4}; expect(updates.tileOverlaysToAdd, toAdd); - final Set toChange = {to3Changed}; + final toChange = {to3Changed}; expect(updates.tileOverlaysToChange, toChange); }); test('toJson', () async { - const TileOverlay to1 = TileOverlay(tileOverlayId: TileOverlayId('id1')); - const TileOverlay to2 = TileOverlay(tileOverlayId: TileOverlayId('id2')); - const TileOverlay to3 = TileOverlay(tileOverlayId: TileOverlayId('id3')); - const TileOverlay to3Changed = TileOverlay( + const to1 = TileOverlay(tileOverlayId: TileOverlayId('id1')); + const to2 = TileOverlay(tileOverlayId: TileOverlayId('id2')); + const to3 = TileOverlay(tileOverlayId: TileOverlayId('id3')); + const to3Changed = TileOverlay( tileOverlayId: TileOverlayId('id3'), transparency: 0.5, ); - const TileOverlay to4 = TileOverlay(tileOverlayId: TileOverlayId('id4')); - final Set previous = {to1, to2, to3}; - final Set current = {to2, to3Changed, to4}; - final TileOverlayUpdates updates = TileOverlayUpdates.from( + const to4 = TileOverlay(tileOverlayId: TileOverlayId('id4')); + final previous = {to1, to2, to3}; + final current = {to2, to3Changed, to4}; + final updates = TileOverlayUpdates.from( previous, current, ); @@ -68,27 +68,27 @@ void main() { }); test('equality', () async { - const TileOverlay to1 = TileOverlay(tileOverlayId: TileOverlayId('id1')); - const TileOverlay to2 = TileOverlay(tileOverlayId: TileOverlayId('id2')); - const TileOverlay to3 = TileOverlay(tileOverlayId: TileOverlayId('id3')); - const TileOverlay to3Changed = TileOverlay( + const to1 = TileOverlay(tileOverlayId: TileOverlayId('id1')); + const to2 = TileOverlay(tileOverlayId: TileOverlayId('id2')); + const to3 = TileOverlay(tileOverlayId: TileOverlayId('id3')); + const to3Changed = TileOverlay( tileOverlayId: TileOverlayId('id3'), transparency: 0.5, ); - const TileOverlay to4 = TileOverlay(tileOverlayId: TileOverlayId('id4')); - final Set previous = {to1, to2, to3}; - final Set current1 = {to2, to3Changed, to4}; - final Set current2 = {to2, to3Changed, to4}; - final Set current3 = {to2, to4}; - final TileOverlayUpdates updates1 = TileOverlayUpdates.from( + const to4 = TileOverlay(tileOverlayId: TileOverlayId('id4')); + final previous = {to1, to2, to3}; + final current1 = {to2, to3Changed, to4}; + final current2 = {to2, to3Changed, to4}; + final current3 = {to2, to4}; + final updates1 = TileOverlayUpdates.from( previous, current1, ); - final TileOverlayUpdates updates2 = TileOverlayUpdates.from( + final updates2 = TileOverlayUpdates.from( previous, current2, ); - final TileOverlayUpdates updates3 = TileOverlayUpdates.from( + final updates3 = TileOverlayUpdates.from( previous, current3, ); @@ -97,17 +97,17 @@ void main() { }); test('hashCode', () async { - const TileOverlay to1 = TileOverlay(tileOverlayId: TileOverlayId('id1')); - const TileOverlay to2 = TileOverlay(tileOverlayId: TileOverlayId('id2')); - const TileOverlay to3 = TileOverlay(tileOverlayId: TileOverlayId('id3')); - const TileOverlay to3Changed = TileOverlay( + const to1 = TileOverlay(tileOverlayId: TileOverlayId('id1')); + const to2 = TileOverlay(tileOverlayId: TileOverlayId('id2')); + const to3 = TileOverlay(tileOverlayId: TileOverlayId('id3')); + const to3Changed = TileOverlay( tileOverlayId: TileOverlayId('id3'), transparency: 0.5, ); - const TileOverlay to4 = TileOverlay(tileOverlayId: TileOverlayId('id4')); - final Set previous = {to1, to2, to3}; - final Set current = {to2, to3Changed, to4}; - final TileOverlayUpdates updates = TileOverlayUpdates.from( + const to4 = TileOverlay(tileOverlayId: TileOverlayId('id4')); + final previous = {to1, to2, to3}; + final current = {to2, to3Changed, to4}; + final updates = TileOverlayUpdates.from( previous, current, ); @@ -122,17 +122,17 @@ void main() { }); test('toString', () async { - const TileOverlay to1 = TileOverlay(tileOverlayId: TileOverlayId('id1')); - const TileOverlay to2 = TileOverlay(tileOverlayId: TileOverlayId('id2')); - const TileOverlay to3 = TileOverlay(tileOverlayId: TileOverlayId('id3')); - const TileOverlay to3Changed = TileOverlay( + const to1 = TileOverlay(tileOverlayId: TileOverlayId('id1')); + const to2 = TileOverlay(tileOverlayId: TileOverlayId('id2')); + const to3 = TileOverlay(tileOverlayId: TileOverlayId('id3')); + const to3Changed = TileOverlay( tileOverlayId: TileOverlayId('id3'), transparency: 0.5, ); - const TileOverlay to4 = TileOverlay(tileOverlayId: TileOverlayId('id4')); - final Set previous = {to1, to2, to3}; - final Set current = {to2, to3Changed, to4}; - final TileOverlayUpdates updates = TileOverlayUpdates.from( + const to4 = TileOverlay(tileOverlayId: TileOverlayId('id4')); + final previous = {to1, to2, to3}; + final current = {to2, to3Changed, to4}; + final updates = TileOverlayUpdates.from( previous, current, ); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_test.dart index 1c0e5359b85..4307a3597fc 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/tile_test.dart @@ -12,14 +12,14 @@ void main() { group('tile tests', () { test('toJson returns correct format', () async { - final Uint8List data = Uint8List.fromList([0, 1]); - final Tile tile = Tile(100, 200, data); + final data = Uint8List.fromList([0, 1]); + final tile = Tile(100, 200, data); final Object json = tile.toJson(); expect(json, {'width': 100, 'height': 200, 'data': data}); }); test('toJson handles null data', () async { - const Tile tile = Tile(0, 0, null); + const tile = Tile(0, 0, null); final Object json = tile.toJson(); expect(json, {'width': 0, 'height': 0}); }); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/utils/cluster_manager_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/utils/cluster_manager_test.dart index 0f096a75307..4bb0d908feb 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/utils/cluster_manager_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/utils/cluster_manager_test.dart @@ -8,11 +8,11 @@ import 'package:google_maps_flutter_platform_interface/src/types/types.dart'; void main() { group('keyByClusterManagerId', () { test('returns a Map keyed by clusterManagerId', () { - const ClusterManagerId id1 = ClusterManagerId('id1'); - const ClusterManagerId id2 = ClusterManagerId('id2'); - const ClusterManagerId id3 = ClusterManagerId('id3'); + const id1 = ClusterManagerId('id1'); + const id2 = ClusterManagerId('id2'); + const id3 = ClusterManagerId('id3'); - final List clusterManagers = [ + final clusterManagers = [ const ClusterManager(clusterManagerId: id1), const ClusterManager(clusterManagerId: id2), const ClusterManager(clusterManagerId: id3), diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/utils/map_configuration_serialization_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/utils/map_configuration_serialization_test.dart index b52b977bb99..a4d72291c28 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/utils/map_configuration_serialization_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/utils/map_configuration_serialization_test.dart @@ -11,7 +11,7 @@ const String _kMapId = '000000000000000'; // Dummy map ID. void main() { test('empty serialization', () async { - const MapConfiguration config = MapConfiguration(); + const config = MapConfiguration(); final Map json = jsonForMapConfiguration(config); @@ -19,7 +19,7 @@ void main() { }); test('complete serialization', () async { - final MapConfiguration config = MapConfiguration( + final config = MapConfiguration( compassEnabled: false, mapToolbarEnabled: false, cameraTargetBounds: CameraTargetBounds( @@ -84,7 +84,7 @@ void main() { }); test('mapId preferred over cloudMapId', () { - const MapConfiguration config = MapConfiguration( + const config = MapConfiguration( mapId: 'map-id', cloudMapId: 'cloud-map-id', ); @@ -93,7 +93,7 @@ void main() { }); test('mapId falls back to cloudMapId', () { - const MapConfiguration config = MapConfiguration( + const config = MapConfiguration( cloudMapId: 'cloud-map-id', ); final Map json = jsonForMapConfiguration(config); diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/cloud_map_styles_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/cloud_map_styles_test.dart index 2c843752934..9b70b89079b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/cloud_map_styles_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/cloud_map_styles_test.dart @@ -29,7 +29,7 @@ void main() { testWidgets('cloudMapId present => mapId set & styles omitted', ( WidgetTester tester, ) async { - const MapConfiguration testMapConfig = MapConfiguration( + const testMapConfig = MapConfiguration( mapId: 'test-cloud-map-id', ); @@ -37,7 +37,7 @@ void main() { const Directionality(textDirection: TextDirection.ltr, child: SizedBox()), ); - final StreamController> stream = + final stream = StreamController>(); addTearDown(() { // Stream is closed by controller.dispose() @@ -45,7 +45,7 @@ void main() { gmaps.MapOptions? captured; - final GoogleMapController controller = GoogleMapController( + final controller = GoogleMapController( mapId: 1, // Internal controller ID streamController: stream, widgetConfiguration: cfg(), @@ -58,7 +58,7 @@ void main() { }, ); - final List styles = [ + final styles = [ gmaps.MapTypeStyle() ..featureType = 'road' ..elementType = 'geometry', @@ -84,14 +84,14 @@ void main() { const Directionality(textDirection: TextDirection.ltr, child: SizedBox()), ); - final StreamController> stream = + final stream = StreamController>(); addTearDown(() { // Stream is closed by controller.dispose() }); gmaps.MapOptions? captured; - final GoogleMapController controller = GoogleMapController( + final controller = GoogleMapController( mapId: 2, // Internal controller ID streamController: stream, widgetConfiguration: cfg(), @@ -103,7 +103,7 @@ void main() { }, ); - final List styles = [ + final styles = [ gmaps.MapTypeStyle() ..featureType = 'poi' ..elementType = 'labels', diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_controller_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_controller_test.dart index ce102173d4c..8c3dd5ba148 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_controller_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_controller_test.dart @@ -50,7 +50,7 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('GoogleMapController', () { - const int mapId = 33930; + const mapId = 33930; late GoogleMapController controller; late StreamController> stream; @@ -374,7 +374,7 @@ void main() { }); testWidgets('renders initial geometry', (WidgetTester tester) async { - final MapObjects mapObjects = MapObjects( + final mapObjects = MapObjects( circles: { const Circle(circleId: CircleId('circle-1'), zIndex: 1234), }, @@ -614,7 +614,7 @@ void main() { testWidgets('translates cameraTargetBounds option', ( WidgetTester tester, ) async { - final LatLngBounds mockLatLngBounds = LatLngBounds( + final mockLatLngBounds = LatLngBounds( southwest: const LatLng(20, 30), northeast: const LatLng(25, 35), ); @@ -670,7 +670,7 @@ void main() { testWidgets('translates style option', (WidgetTester tester) async { gmaps.MapOptions? capturedOptions; - const String style = ''' + const style = ''' [{ "featureType": "poi.park", "elementType": "labels.text.fill", @@ -722,7 +722,7 @@ void main() { ) async { gmaps.MapOptions? initialCapturedOptions; gmaps.MapOptions? updatedCapturedOptions; - const String style = ''' + const style = ''' [{ "featureType": "poi.park", "elementType": "labels.text.fill", @@ -820,7 +820,7 @@ void main() { }); testWidgets('can update style', (WidgetTester tester) async { - const String style = ''' + const style = ''' [{ "featureType": "poi.park", "elementType": "labels.text.fill", @@ -846,7 +846,7 @@ void main() { group('viewport getters', () { testWidgets('getVisibleRegion', (WidgetTester tester) async { final gmaps.LatLng gmCenter = map.center; - final LatLng center = LatLng( + final center = LatLng( gmCenter.lat.toDouble(), gmCenter.lng.toDouble(), ); @@ -878,15 +878,15 @@ void main() { // These are the methods that get forwarded to other controllers, so we just verify calls. group('Pass-through methods', () { testWidgets('updateCircles', (WidgetTester tester) async { - final MockCirclesController mock = MockCirclesController(); + final mock = MockCirclesController(); controller = createController()..debugSetOverrides(circles: mock); - final Set previous = { + final previous = { const Circle(circleId: CircleId('to-be-updated')), const Circle(circleId: CircleId('to-be-removed')), }; - final Set current = { + final current = { const Circle(circleId: CircleId('to-be-updated'), visible: false), const Circle(circleId: CircleId('to-be-added')), }; @@ -907,10 +907,10 @@ void main() { }); testWidgets('updateHeatmaps', (WidgetTester tester) async { - final MockHeatmapsController mock = MockHeatmapsController(); + final mock = MockHeatmapsController(); controller.debugSetOverrides(heatmaps: mock); - const List heatmapPoints = [ + const heatmapPoints = [ WeightedLatLng(LatLng(37.782, -122.447)), WeightedLatLng(LatLng(37.782, -122.445)), WeightedLatLng(LatLng(37.782, -122.443)), @@ -927,7 +927,7 @@ void main() { WeightedLatLng(LatLng(37.785, -122.435)), ]; - final Set previous = { + final previous = { const Heatmap( heatmapId: HeatmapId('to-be-updated'), data: heatmapPoints, @@ -940,7 +940,7 @@ void main() { ), }; - final Set current = { + final current = { const Heatmap( heatmapId: HeatmapId('to-be-updated'), data: heatmapPoints, @@ -981,15 +981,15 @@ void main() { }); testWidgets('updateMarkers', (WidgetTester tester) async { - final MockMarkersController mock = MockMarkersController(); + final mock = MockMarkersController(); controller = createController()..debugSetOverrides(markers: mock); - final Set previous = { + final previous = { const Marker(markerId: MarkerId('to-be-updated')), const Marker(markerId: MarkerId('to-be-removed')), }; - final Set current = { + final current = { const Marker(markerId: MarkerId('to-be-updated'), visible: false), const Marker(markerId: MarkerId('to-be-added')), }; @@ -1010,15 +1010,15 @@ void main() { }); testWidgets('updatePolygons', (WidgetTester tester) async { - final MockPolygonsController mock = MockPolygonsController(); + final mock = MockPolygonsController(); controller = createController()..debugSetOverrides(polygons: mock); - final Set previous = { + final previous = { const Polygon(polygonId: PolygonId('to-be-updated')), const Polygon(polygonId: PolygonId('to-be-removed')), }; - final Set current = { + final current = { const Polygon(polygonId: PolygonId('to-be-updated'), visible: false), const Polygon(polygonId: PolygonId('to-be-added')), }; @@ -1044,15 +1044,15 @@ void main() { }); testWidgets('updatePolylines', (WidgetTester tester) async { - final MockPolylinesController mock = MockPolylinesController(); + final mock = MockPolylinesController(); controller = createController()..debugSetOverrides(polylines: mock); - final Set previous = { + final previous = { const Polyline(polylineId: PolylineId('to-be-updated')), const Polyline(polylineId: PolylineId('to-be-removed')), }; - final Set current = { + final current = { const Polyline( polylineId: PolylineId('to-be-updated'), visible: false, @@ -1081,7 +1081,7 @@ void main() { }); testWidgets('updateTileOverlays', (WidgetTester tester) async { - final MockTileOverlaysController mock = MockTileOverlaysController(); + final mock = MockTileOverlaysController(); controller = createController( mapObjects: MapObjects( tileOverlays: { @@ -1120,45 +1120,45 @@ void main() { }); testWidgets('updateGroundOverlays', (WidgetTester tester) async { - final MockGroundOverlaysController mock = + final mock = MockGroundOverlaysController(); controller = createController() ..debugSetOverrides(groundOverlays: mock); - final LatLngBounds bounds = LatLngBounds( + final bounds = LatLngBounds( northeast: const LatLng(100, 0), southwest: const LatLng(0, 100), ); - const LatLng position = LatLng(50, 50); - final AssetMapBitmap image = AssetMapBitmap( + const position = LatLng(50, 50); + final image = AssetMapBitmap( 'assets/red_square.png', imagePixelRatio: 1.0, bitmapScaling: MapBitmapScaling.none, ); - final GroundOverlay groundOverlayToBeUpdated = GroundOverlay.fromBounds( + final groundOverlayToBeUpdated = GroundOverlay.fromBounds( groundOverlayId: const GroundOverlayId('to-be-updated'), image: image, bounds: bounds, ); - final GroundOverlay groundOverlayToBeRemoved = + final groundOverlayToBeRemoved = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('to-be-removed'), image: image, position: position, ); - final GroundOverlay groundOverlayToBeAdded = GroundOverlay.fromPosition( + final groundOverlayToBeAdded = GroundOverlay.fromPosition( groundOverlayId: const GroundOverlayId('to-be-added'), image: image, position: position, ); - final Set previous = { + final previous = { groundOverlayToBeUpdated, groundOverlayToBeRemoved, }; - final Set current = { + final current = { groundOverlayToBeUpdated.copyWith(visibleParam: false), groundOverlayToBeAdded, }; @@ -1181,8 +1181,8 @@ void main() { }); testWidgets('infoWindow visibility', (WidgetTester tester) async { - final MockMarkersController mock = MockMarkersController(); - const MarkerId markerId = MarkerId('marker-with-infowindow'); + final mock = MockMarkersController(); + const markerId = MarkerId('marker-with-infowindow'); when(mock.isInfoWindowShown(markerId)).thenReturn(true); controller = createController()..debugSetOverrides(markers: mock); diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_plugin_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_plugin_test.dart index a70ef4e73c9..04ddbbced16 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_plugin_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_plugin_test.dart @@ -26,7 +26,7 @@ void main() { late MockGoogleMapController controller; late GoogleMapsPlugin plugin; late Completer reportedMapIdCompleter; - int numberOnPlatformViewCreatedCalls = 0; + var numberOnPlatformViewCreatedCalls = 0; void onPlatformViewCreated(int id) { reportedMapIdCompleter.complete(id); @@ -67,15 +67,15 @@ void main() { }); group('buildView', () { - const int testMapId = 33930; - const CameraPosition initialCameraPosition = CameraPosition( + const testMapId = 33930; + const initialCameraPosition = CameraPosition( target: LatLng(0, 0), ); testWidgets( 'returns an HtmlElementView and caches the controller for later', (WidgetTester tester) async { - final Map cache = + final cache = {}; plugin.debugSetMapById(cache); @@ -112,7 +112,7 @@ void main() { testWidgets('returns cached instance if it already exists', ( WidgetTester tester, ) async { - const HtmlElementView expected = HtmlElementView( + const expected = HtmlElementView( viewType: 'only-for-testing', ); when(controller.widget).thenReturn(expected); @@ -135,7 +135,7 @@ void main() { testWidgets( 'asynchronously reports onPlatformViewCreated the first time it happens', (WidgetTester tester) async { - final Map cache = + final cache = {}; plugin.debugSetMapById(cache); @@ -175,7 +175,7 @@ void main() { }); group('setMapStyles', () { - const String mapStyle = ''' + const mapStyle = ''' [{ "featureType": "poi.park", "elementType": "labels.text.fill", @@ -193,7 +193,7 @@ void main() { controller.updateStyles(captureThat(isList)), ).captured[0]; - final List styles = + final styles = captured as List; expect(styles.length, 1); // Let's peek inside the styles... @@ -218,13 +218,13 @@ void main() { // These methods only pass-through values from the plugin to the controller // so we verify them all together here... group('Pass-through methods:', () { - const int mapId = 0; + const mapId = 0; setUp(() { plugin.debugSetMapById({mapId: controller}); }); // Options testWidgets('updateMapConfiguration', (WidgetTester tester) async { - const MapConfiguration configuration = MapConfiguration( + const configuration = MapConfiguration( mapType: MapType.satellite, ); @@ -234,7 +234,7 @@ void main() { }); // Geometry testWidgets('updateMarkers', (WidgetTester tester) async { - final MarkerUpdates expectedUpdates = MarkerUpdates.from( + final expectedUpdates = MarkerUpdates.from( const {}, const {}, ); @@ -244,7 +244,7 @@ void main() { verify(controller.updateMarkers(expectedUpdates)); }); testWidgets('updatePolygons', (WidgetTester tester) async { - final PolygonUpdates expectedUpdates = PolygonUpdates.from( + final expectedUpdates = PolygonUpdates.from( const {}, const {}, ); @@ -254,7 +254,7 @@ void main() { verify(controller.updatePolygons(expectedUpdates)); }); testWidgets('updatePolylines', (WidgetTester tester) async { - final PolylineUpdates expectedUpdates = PolylineUpdates.from( + final expectedUpdates = PolylineUpdates.from( const {}, const {}, ); @@ -264,7 +264,7 @@ void main() { verify(controller.updatePolylines(expectedUpdates)); }); testWidgets('updateCircles', (WidgetTester tester) async { - final CircleUpdates expectedUpdates = CircleUpdates.from( + final expectedUpdates = CircleUpdates.from( const {}, const {}, ); @@ -274,7 +274,7 @@ void main() { verify(controller.updateCircles(expectedUpdates)); }); testWidgets('updateHeatmaps', (WidgetTester tester) async { - final HeatmapUpdates expectedUpdates = HeatmapUpdates.from( + final expectedUpdates = HeatmapUpdates.from( const {}, const {}, ); @@ -285,7 +285,7 @@ void main() { }); // Tile Overlays testWidgets('updateTileOverlays', (WidgetTester tester) async { - final Set expectedOverlays = { + final expectedOverlays = { const TileOverlay(tileOverlayId: TileOverlayId('overlay')), }; @@ -297,7 +297,7 @@ void main() { verify(controller.updateTileOverlays(expectedOverlays)); }); testWidgets('clearTileCache', (WidgetTester tester) async { - const TileOverlayId tileOverlayId = TileOverlayId('Dory'); + const tileOverlayId = TileOverlayId('Dory'); await plugin.clearTileCache(tileOverlayId, mapId: mapId); @@ -348,7 +348,7 @@ void main() { (_) async => const ScreenCoordinate(x: 320, y: 240), // fake return ); - const LatLng latLng = LatLng(43.3613, -5.8499); + const latLng = LatLng(43.3613, -5.8499); await plugin.getScreenCoordinate(latLng, mapId: mapId); @@ -360,7 +360,7 @@ void main() { (_) async => const LatLng(43.3613, -5.8499), // fake return ); - const ScreenCoordinate coordinates = ScreenCoordinate(x: 19, y: 26); + const coordinates = ScreenCoordinate(x: 19, y: 26); await plugin.getLatLng(coordinates, mapId: mapId); @@ -369,7 +369,7 @@ void main() { // InfoWindows testWidgets('showMarkerInfoWindow', (WidgetTester tester) async { - const MarkerId markerId = MarkerId('testing-123'); + const markerId = MarkerId('testing-123'); await plugin.showMarkerInfoWindow(markerId, mapId: mapId); @@ -377,7 +377,7 @@ void main() { }); testWidgets('hideMarkerInfoWindow', (WidgetTester tester) async { - const MarkerId markerId = MarkerId('testing-123'); + const markerId = MarkerId('testing-123'); await plugin.hideMarkerInfoWindow(markerId, mapId: mapId); @@ -385,7 +385,7 @@ void main() { }); testWidgets('isMarkerInfoWindowShown', (WidgetTester tester) async { - const MarkerId markerId = MarkerId('testing-123'); + const markerId = MarkerId('testing-123'); when(controller.isInfoWindowShown(markerId)).thenReturn(true); @@ -397,7 +397,7 @@ void main() { // Verify all event streams are filtered correctly from the main one... group('Event Streams', () { - const int mapId = 0; + const mapId = 0; late StreamController> streamController; setUp(() { streamController = StreamController>.broadcast(); @@ -427,7 +427,7 @@ void main() { // Camera events testWidgets('onCameraMoveStarted', (WidgetTester tester) async { - final CameraMoveStartedEvent event = CameraMoveStartedEvent(mapId); + final event = CameraMoveStartedEvent(mapId); final Stream stream = plugin .onCameraMoveStarted(mapId: mapId); @@ -435,7 +435,7 @@ void main() { await testStreamFiltering(stream, event); }); testWidgets('onCameraMoveStarted', (WidgetTester tester) async { - final CameraMoveEvent event = CameraMoveEvent( + final event = CameraMoveEvent( mapId, const CameraPosition(target: LatLng(43.3790, -5.8660)), ); @@ -447,7 +447,7 @@ void main() { await testStreamFiltering(stream, event); }); testWidgets('onCameraIdle', (WidgetTester tester) async { - final CameraIdleEvent event = CameraIdleEvent(mapId); + final event = CameraIdleEvent(mapId); final Stream stream = plugin.onCameraIdle( mapId: mapId, @@ -457,7 +457,7 @@ void main() { }); // Marker events testWidgets('onMarkerTap', (WidgetTester tester) async { - final MarkerTapEvent event = MarkerTapEvent( + final event = MarkerTapEvent( mapId, const MarkerId('test-123'), ); @@ -467,7 +467,7 @@ void main() { await testStreamFiltering(stream, event); }); testWidgets('onInfoWindowTap', (WidgetTester tester) async { - final InfoWindowTapEvent event = InfoWindowTapEvent( + final event = InfoWindowTapEvent( mapId, const MarkerId('test-123'), ); @@ -479,7 +479,7 @@ void main() { await testStreamFiltering(stream, event); }); testWidgets('onMarkerDragStart', (WidgetTester tester) async { - final MarkerDragStartEvent event = MarkerDragStartEvent( + final event = MarkerDragStartEvent( mapId, const LatLng(43.3677, -5.8372), const MarkerId('test-123'), @@ -492,7 +492,7 @@ void main() { await testStreamFiltering(stream, event); }); testWidgets('onMarkerDrag', (WidgetTester tester) async { - final MarkerDragEvent event = MarkerDragEvent( + final event = MarkerDragEvent( mapId, const LatLng(43.3677, -5.8372), const MarkerId('test-123'), @@ -505,7 +505,7 @@ void main() { await testStreamFiltering(stream, event); }); testWidgets('onMarkerDragEnd', (WidgetTester tester) async { - final MarkerDragEndEvent event = MarkerDragEndEvent( + final event = MarkerDragEndEvent( mapId, const LatLng(43.3677, -5.8372), const MarkerId('test-123'), @@ -519,7 +519,7 @@ void main() { }); // Geometry testWidgets('onPolygonTap', (WidgetTester tester) async { - final PolygonTapEvent event = PolygonTapEvent( + final event = PolygonTapEvent( mapId, const PolygonId('test-123'), ); @@ -531,7 +531,7 @@ void main() { await testStreamFiltering(stream, event); }); testWidgets('onPolylineTap', (WidgetTester tester) async { - final PolylineTapEvent event = PolylineTapEvent( + final event = PolylineTapEvent( mapId, const PolylineId('test-123'), ); @@ -543,7 +543,7 @@ void main() { await testStreamFiltering(stream, event); }); testWidgets('onCircleTap', (WidgetTester tester) async { - final CircleTapEvent event = CircleTapEvent( + final event = CircleTapEvent( mapId, const CircleId('test-123'), ); @@ -554,7 +554,7 @@ void main() { }); // Map taps testWidgets('onTap', (WidgetTester tester) async { - final MapTapEvent event = MapTapEvent( + final event = MapTapEvent( mapId, const LatLng(43.3597, -5.8458), ); @@ -564,7 +564,7 @@ void main() { await testStreamFiltering(stream, event); }); testWidgets('onLongPress', (WidgetTester tester) async { - final MapLongPressEvent event = MapLongPressEvent( + final event = MapLongPressEvent( mapId, const LatLng(43.3608, -5.8425), ); diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/marker_clustering_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/marker_clustering_test.dart index c2c650156b1..caf2c3b345a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/marker_clustering_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/marker_clustering_test.dart @@ -19,23 +19,23 @@ void main() { final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; - const LatLng mapCenter = LatLng(20, 20); - const CameraPosition initialCameraPosition = CameraPosition( + const mapCenter = LatLng(20, 20); + const initialCameraPosition = CameraPosition( target: mapCenter, ); group('MarkersController', () { - const int testMapId = 33930; + const testMapId = 33930; testWidgets('Marker clustering', (WidgetTester tester) async { - const ClusterManagerId clusterManagerId = ClusterManagerId('cluster 1'); + const clusterManagerId = ClusterManagerId('cluster 1'); - final Set clusterManagers = { + final clusterManagers = { const ClusterManager(clusterManagerId: clusterManagerId), }; // Create the marker with clusterManagerId. - final Set initialMarkers = { + final initialMarkers = { const Marker( markerId: MarkerId('1'), position: mapCenter, @@ -48,7 +48,7 @@ void main() { ), }; - final Completer mapIdCompleter = Completer(); + final mapIdCompleter = Completer(); await _pumpMap( tester, @@ -87,11 +87,11 @@ void main() { // Copy only the first marker with null clusterManagerId. // This means that both markers should be removed from the cluster. - final Set updatedMarkers = { + final updatedMarkers = { _copyMarkerWithClusterManagerId(initialMarkers.first, null), }; - final MarkerUpdates markerUpdates = MarkerUpdates.from( + final markerUpdates = MarkerUpdates.from( initialMarkers, updatedMarkers, ); @@ -128,7 +128,7 @@ Future waitForValueMatchingPredicate( bool Function(T) predicate, { int maxTries = 100, }) async { - for (int i = 0; i < maxTries; i++) { + for (var i = 0; i < maxTries; i++) { final T value = await getValue(); if (predicate(value)) { return value; diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/marker_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/marker_test.dart index ad74c151d64..43f2aabf730 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/marker_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/marker_test.dart @@ -102,8 +102,8 @@ void main() { }); testWidgets('update', (WidgetTester tester) async { - final MarkerController controller = MarkerController(marker: marker); - final gmaps.MarkerOptions options = gmaps.MarkerOptions() + final controller = MarkerController(marker: marker); + final options = gmaps.MarkerOptions() ..draggable = true ..position = gmaps.LatLng(42, 54); @@ -119,7 +119,7 @@ void main() { testWidgets('infoWindow null, showInfoWindow.', ( WidgetTester tester, ) async { - final MarkerController controller = MarkerController(marker: marker); + final controller = MarkerController(marker: marker); controller.showInfoWindow(); @@ -127,10 +127,10 @@ void main() { }); testWidgets('showInfoWindow', (WidgetTester tester) async { - final gmaps.InfoWindow infoWindow = gmaps.InfoWindow(); - final gmaps.Map map = gmaps.Map(createDivElement()); + final infoWindow = gmaps.InfoWindow(); + final map = gmaps.Map(createDivElement()); marker.set('map', map); - final MarkerController controller = MarkerController( + final controller = MarkerController( marker: marker, infoWindow: infoWindow, ); @@ -142,10 +142,10 @@ void main() { }); testWidgets('hideInfoWindow', (WidgetTester tester) async { - final gmaps.InfoWindow infoWindow = gmaps.InfoWindow(); - final gmaps.Map map = gmaps.Map(createDivElement()); + final infoWindow = gmaps.InfoWindow(); + final map = gmaps.Map(createDivElement()); marker.set('map', map); - final MarkerController controller = MarkerController( + final controller = MarkerController( marker: marker, infoWindow: infoWindow, ); @@ -160,8 +160,8 @@ void main() { late MarkerController controller; setUp(() { - final gmaps.InfoWindow infoWindow = gmaps.InfoWindow(); - final gmaps.Map map = gmaps.Map(createDivElement()); + final infoWindow = gmaps.InfoWindow(); + final map = gmaps.Map(createDivElement()); marker.set('map', map); controller = MarkerController(marker: marker, infoWindow: infoWindow); }); @@ -175,7 +175,7 @@ void main() { testWidgets('cannot call update after remove', ( WidgetTester tester, ) async { - final gmaps.MarkerOptions options = gmaps.MarkerOptions() + final options = gmaps.MarkerOptions() ..draggable = true; controller.remove(); diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/markers_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/markers_test.dart index b8f60ee24cd..e755f4cb0c0 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/markers_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/markers_test.dart @@ -43,7 +43,7 @@ void main() { }); testWidgets('addMarkers', (WidgetTester tester) async { - final Set markers = { + final markers = { const Marker(markerId: MarkerId('1')), const Marker(markerId: MarkerId('2')), }; @@ -60,7 +60,7 @@ void main() { gmaps.Marker? marker; gmaps.LatLng? position; - final Set markers = { + final markers = { const Marker(markerId: MarkerId('1')), }; await controller.addMarkers(markers); @@ -76,7 +76,7 @@ void main() { expect(position.lng, equals(0)); // Update the marker with draggable and position - final Set updatedMarkers = { + final updatedMarkers = { const Marker( markerId: MarkerId('1'), draggable: true, @@ -102,7 +102,7 @@ void main() { gmaps.Marker? marker; gmaps.LatLng? position; - final Set markers = { + final markers = { const Marker(markerId: MarkerId('1'), position: LatLng(42, 54)), }; await controller.addMarkers(markers); @@ -117,7 +117,7 @@ void main() { expect(position.lng, equals(54)); // Update the marker without position - final Set updatedMarkers = { + final updatedMarkers = { const Marker(markerId: MarkerId('1'), draggable: true), }; await controller.changeMarkers(updatedMarkers); @@ -135,7 +135,7 @@ void main() { ); testWidgets('removeMarkers', (WidgetTester tester) async { - final Set markers = { + final markers = { const Marker(markerId: MarkerId('1')), const Marker(markerId: MarkerId('2')), const Marker(markerId: MarkerId('3')), @@ -146,7 +146,7 @@ void main() { expect(controller.markers.length, 3); // Remove some markers... - final Set markerIdsToRemove = { + final markerIdsToRemove = { const MarkerId('1'), const MarkerId('3'), }; @@ -160,7 +160,7 @@ void main() { }); testWidgets('InfoWindow show/hide', (WidgetTester tester) async { - final Set markers = { + final markers = { const Marker( markerId: MarkerId('1'), infoWindow: InfoWindow(title: 'Title', snippet: 'Snippet'), @@ -184,7 +184,7 @@ void main() { testWidgets('only single InfoWindow is visible', ( WidgetTester tester, ) async { - final Set markers = { + final markers = { const Marker( markerId: MarkerId('1'), infoWindow: InfoWindow(title: 'Title', snippet: 'Snippet'), @@ -213,7 +213,7 @@ void main() { testWidgets('markers with custom asset icon work', ( WidgetTester tester, ) async { - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: AssetMapBitmap('assets/red_square.png', imagePixelRatio: 1.0), @@ -223,7 +223,7 @@ void main() { await controller.addMarkers(markers); expect(controller.markers.length, 1); - final gmaps.Icon? icon = + final icon = controller.markers[const MarkerId('1')]?.marker?.icon as gmaps.Icon?; expect(icon, isNotNull); @@ -243,7 +243,7 @@ void main() { testWidgets('markers with custom asset icon and pixelratio work', ( WidgetTester tester, ) async { - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: AssetMapBitmap('assets/red_square.png', imagePixelRatio: 2.0), @@ -253,7 +253,7 @@ void main() { await controller.addMarkers(markers); expect(controller.markers.length, 1); - final gmaps.Icon? icon = + final icon = controller.markers[const MarkerId('1')]?.marker?.icon as gmaps.Icon?; expect(icon, isNotNull); @@ -273,7 +273,7 @@ void main() { testWidgets('markers with custom asset icon with width and height work', ( WidgetTester tester, ) async { - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: AssetMapBitmap( @@ -288,7 +288,7 @@ void main() { await controller.addMarkers(markers); expect(controller.markers.length, 1); - final gmaps.Icon? icon = + final icon = controller.markers[const MarkerId('1')]?.marker?.icon as gmaps.Icon?; expect(icon, isNotNull); @@ -309,7 +309,7 @@ void main() { testWidgets('markers with missing asset icon should not set size', ( WidgetTester tester, ) async { - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: AssetMapBitmap( @@ -322,7 +322,7 @@ void main() { await controller.addMarkers(markers); expect(controller.markers.length, 1); - final gmaps.Icon? icon = + final icon = controller.markers[const MarkerId('1')]?.marker?.icon as gmaps.Icon?; expect(icon, isNotNull); @@ -339,7 +339,7 @@ void main() { WidgetTester tester, ) async { final Uint8List bytes = const Base64Decoder().convert(iconImageBase64); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: BytesMapBitmap( @@ -352,7 +352,7 @@ void main() { await controller.addMarkers(markers); expect(controller.markers.length, 1); - final gmaps.Icon? icon = + final icon = controller.markers[const MarkerId('1')]?.marker?.icon as gmaps.Icon?; expect(icon, isNotNull); @@ -384,7 +384,7 @@ void main() { WidgetTester tester, ) async { final Uint8List bytes = const Base64Decoder().convert(iconImageBase64); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: BytesMapBitmap(bytes, imagePixelRatio: 1), @@ -394,7 +394,7 @@ void main() { await controller.addMarkers(markers); expect(controller.markers.length, 1); - final gmaps.Icon? icon = + final icon = controller.markers[const MarkerId('1')]?.marker?.icon as gmaps.Icon?; expect(icon, isNotNull); @@ -415,7 +415,7 @@ void main() { WidgetTester tester, ) async { final Uint8List bytes = const Base64Decoder().convert(iconImageBase64); - final Set markers = { + final markers = { Marker( markerId: const MarkerId('1'), icon: BytesMapBitmap(bytes, width: 20, height: 30), @@ -425,7 +425,7 @@ void main() { await controller.addMarkers(markers); expect(controller.markers.length, 1); - final gmaps.Icon? icon = + final icon = controller.markers[const MarkerId('1')]?.marker?.icon as gmaps.Icon?; expect(icon, isNotNull); @@ -442,7 +442,7 @@ void main() { testWidgets('InfoWindow snippet can have links', ( WidgetTester tester, ) async { - final Set markers = { + final markers = { const Marker( markerId: MarkerId('1'), infoWindow: InfoWindow( @@ -455,7 +455,7 @@ void main() { await controller.addMarkers(markers); expect(controller.markers.length, 1); - final HTMLElement? content = + final content = controller.markers[const MarkerId('1')]?.infoWindow?.content as HTMLElement?; expect(content, isNotNull); @@ -472,7 +472,7 @@ void main() { // https://github.com/flutter/flutter/issues/67289 testWidgets('InfoWindow content is clickable', (WidgetTester tester) async { - final Set markers = { + final markers = { const Marker( markerId: MarkerId('1'), infoWindow: InfoWindow( @@ -485,7 +485,7 @@ void main() { await controller.addMarkers(markers); expect(controller.markers.length, 1); - final HTMLElement? content = + final content = controller.markers[const MarkerId('1')]?.infoWindow?.content as HTMLElement?; @@ -500,27 +500,27 @@ void main() { testWidgets('markers with anchor work', (WidgetTester tester) async { const double width = 20; const double height = 30; - const Offset defaultOffset = Offset(0.5, 1); - const Offset anchorOffset = Offset(0, 0.5); + const defaultOffset = Offset(0.5, 1); + const anchorOffset = Offset(0, 0.5); final Uint8List bytes = const Base64Decoder().convert(iconImageBase64); - final Marker marker1 = Marker( + final marker1 = Marker( markerId: const MarkerId('1'), icon: BytesMapBitmap(bytes, width: width, height: height), ); - final Marker marker2 = Marker( + final marker2 = Marker( markerId: const MarkerId('2'), icon: BytesMapBitmap(bytes, width: width, height: height), anchor: anchorOffset, ); - final Set markers = {marker1, marker2}; + final markers = {marker1, marker2}; await controller.addMarkers(markers); expect(controller.markers.length, 2); - final gmaps.Icon? icon1 = + final icon1 = controller.markers[const MarkerId('1')]?.marker?.icon as gmaps.Icon?; expect(icon1, isNotNull); - final gmaps.Icon? icon2 = + final icon2 = controller.markers[const MarkerId('2')]?.marker?.icon as gmaps.Icon?; expect(icon2, isNotNull); @@ -535,9 +535,9 @@ void main() { testWidgets('interpret correct zIndex in convertsion', ( WidgetTester tester, ) async { - const MarkerId markerId = MarkerId('1'); + const markerId = MarkerId('1'); - final Set markers = { + final markers = { const Marker(markerId: markerId, zIndexInt: 4), }; diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/overlay_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/overlay_test.dart index d657c97e866..16a42d85b03 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/overlay_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/overlay_test.dart @@ -34,10 +34,10 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('TileOverlayController', () { - const TileOverlayId id = TileOverlayId(''); + const id = TileOverlayId(''); testWidgets('minimal initialization', (WidgetTester tester) async { - final TileOverlayController controller = TileOverlayController( + final controller = TileOverlayController( tileOverlay: const TileOverlay(tileOverlayId: id), ); @@ -51,14 +51,14 @@ void main() { }); testWidgets('produces image tiles', (WidgetTester tester) async { - final TileOverlayController controller = TileOverlayController( + final controller = TileOverlayController( tileOverlay: const TileOverlay( tileOverlayId: id, tileProvider: TestTileProvider(), ), ); - final HTMLImageElement img = + final img = controller.gmMapType.getTile(gmaps.Point(0, 0), 0, document)! as HTMLImageElement; expect(img.naturalWidth, 0); @@ -75,14 +75,14 @@ void main() { }); testWidgets('update', (WidgetTester tester) async { - final TileOverlayController controller = TileOverlayController( + final controller = TileOverlayController( tileOverlay: const TileOverlay( tileOverlayId: id, tileProvider: NoTileProvider(), ), ); { - final HTMLImageElement img = + final img = controller.gmMapType.getTile(gmaps.Point(0, 0), 0, document)! as HTMLImageElement; await null; // let `getTile` `then` complete @@ -97,7 +97,7 @@ void main() { const TileOverlay(tileOverlayId: id, tileProvider: TestTileProvider()), ); { - final HTMLImageElement img = + final img = controller.gmMapType.getTile(gmaps.Point(0, 0), 0, document)! as HTMLImageElement; diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/overlays_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/overlays_test.dart index 208d85f7883..c25b257a746 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/overlays_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/overlays_test.dart @@ -22,7 +22,7 @@ import 'package:web/web.dart'; import 'overlays_test.mocks.dart'; MockTileProvider neverTileProvider() { - final MockTileProvider tileProvider = MockTileProvider(); + final tileProvider = MockTileProvider(); when( tileProvider.getTile(any, any, any), ).thenAnswer((_) => Completer().future); @@ -145,7 +145,7 @@ void main() { }); testWidgets('clearTileCache', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( MaterialApp( diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/projection_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/projection_test.dart index b3a61c4419d..987733aa521 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/projection_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/projection_test.dart @@ -28,9 +28,9 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('Methods that require a proper Projection', () { - const LatLng center = LatLng(43.3078, -5.6958); - const Size size = Size(320, 240); - const CameraPosition initialCamera = CameraPosition( + const center = LatLng(43.3078, -5.6958); + const size = Size(320, 240); + const initialCamera = CameraPosition( target: center, zoom: 14, ); @@ -77,13 +77,13 @@ void main() { ); testWidgets('addPadding', (WidgetTester tester) async { - const LatLng initialMapCenter = LatLng(0, 0); + const initialMapCenter = LatLng(0, 0); const double initialZoomLevel = 5; - const CameraPosition initialCameraPosition = CameraPosition( + const initialCameraPosition = CameraPosition( target: initialMapCenter, zoom: initialZoomLevel, ); - final LatLngBounds zeroLatLngBounds = LatLngBounds( + final zeroLatLngBounds = LatLngBounds( southwest: const LatLng(0, 0), northeast: const LatLng(0, 0), ); @@ -109,7 +109,7 @@ void main() { expect(firstVisibleRegion, isNot(zeroLatLngBounds)); expect(firstVisibleRegion.contains(initialMapCenter), isTrue); - const double padding = 0.1; + const padding = 0.1; await controller.moveCamera( CameraUpdate.newLatLngBounds(firstVisibleRegion, padding), ); @@ -171,7 +171,7 @@ void main() { final GoogleMapController controller = await controllerCompleter.future; final LatLngBounds bounds = await controller.getVisibleRegion(); - final LatLng northWest = LatLng( + final northWest = LatLng( bounds.northeast.latitude, bounds.southwest.longitude, ); @@ -196,7 +196,7 @@ void main() { await controllerCompleter.future; final LatLngBounds bounds = await controller.getVisibleRegion(); - final LatLng southEast = LatLng( + final southEast = LatLng( bounds.southwest.latitude, bounds.northeast.longitude, ); @@ -249,7 +249,7 @@ void main() { final GoogleMapController controller = await controllerCompleter.future; final LatLngBounds bounds = await controller.getVisibleRegion(); - final LatLng northWest = LatLng( + final northWest = LatLng( bounds.northeast.latitude, bounds.southwest.longitude, ); @@ -280,7 +280,7 @@ void main() { final GoogleMapController controller = await controllerCompleter.future; final LatLngBounds bounds = await controller.getVisibleRegion(); - final LatLng southEast = LatLng( + final southEast = LatLng( bounds.southwest.latitude, bounds.northeast.longitude, ); diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/shape_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/shape_test.dart index 2816fa9c2d3..0a9fe426ef2 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/shape_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/shape_test.dart @@ -51,8 +51,8 @@ void main() { }); testWidgets('update', (WidgetTester tester) async { - final CircleController controller = CircleController(circle: circle); - final gmaps.CircleOptions options = gmaps.CircleOptions() + final controller = CircleController(circle: circle); + final options = gmaps.CircleOptions() ..draggable = true; expect(circle.isDraggableDefined(), isFalse); @@ -78,7 +78,7 @@ void main() { testWidgets('cannot call update after remove', ( WidgetTester tester, ) async { - final gmaps.CircleOptions options = gmaps.CircleOptions() + final options = gmaps.CircleOptions() ..draggable = true; controller.remove(); @@ -108,8 +108,8 @@ void main() { }); testWidgets('update', (WidgetTester tester) async { - final PolygonController controller = PolygonController(polygon: polygon); - final gmaps.PolygonOptions options = gmaps.PolygonOptions() + final controller = PolygonController(polygon: polygon); + final options = gmaps.PolygonOptions() ..draggable = true; expect(polygon.isDraggableDefined(), isFalse); @@ -135,7 +135,7 @@ void main() { testWidgets('cannot call update after remove', ( WidgetTester tester, ) async { - final gmaps.PolygonOptions options = gmaps.PolygonOptions() + final options = gmaps.PolygonOptions() ..draggable = true; controller.remove(); @@ -169,10 +169,10 @@ void main() { }); testWidgets('update', (WidgetTester tester) async { - final PolylineController controller = PolylineController( + final controller = PolylineController( polyline: polyline, ); - final gmaps.PolylineOptions options = gmaps.PolylineOptions() + final options = gmaps.PolylineOptions() ..draggable = true; expect(polyline.isDraggableDefined(), isFalse); @@ -198,7 +198,7 @@ void main() { testWidgets('cannot call update after remove', ( WidgetTester tester, ) async { - final gmaps.PolylineOptions options = gmaps.PolylineOptions() + final options = gmaps.PolylineOptions() ..draggable = true; controller.remove(); @@ -218,8 +218,8 @@ void main() { }); testWidgets('update', (WidgetTester tester) async { - final HeatmapController controller = HeatmapController(heatmap: heatmap); - final visualization.HeatmapLayerOptions options = + final controller = HeatmapController(heatmap: heatmap); + final options = visualization.HeatmapLayerOptions() ..data = [gmaps.LatLng(0, 0)].toJS; @@ -246,7 +246,7 @@ void main() { testWidgets('cannot call update after remove', ( WidgetTester tester, ) async { - final visualization.HeatmapLayerOptions options = + final options = visualization.HeatmapLayerOptions()..dissipating = true; controller.remove(); diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/shapes_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/shapes_test.dart index 8aa5fb52e49..44a5feb7b21 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/shapes_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/shapes_test.dart @@ -46,7 +46,7 @@ void main() { }); testWidgets('addCircles', (WidgetTester tester) async { - final Set circles = { + final circles = { const Circle(circleId: CircleId('1')), const Circle(circleId: CircleId('2')), }; @@ -60,14 +60,14 @@ void main() { }); testWidgets('changeCircles', (WidgetTester tester) async { - final Set circles = { + final circles = { const Circle(circleId: CircleId('1')), }; controller.addCircles(circles); expect(controller.circles[const CircleId('1')]?.circle?.visible, isTrue); - final Set updatedCircles = { + final updatedCircles = { const Circle(circleId: CircleId('1'), visible: false), }; controller.changeCircles(updatedCircles); @@ -77,7 +77,7 @@ void main() { }); testWidgets('removeCircles', (WidgetTester tester) async { - final Set circles = { + final circles = { const Circle(circleId: CircleId('1')), const Circle(circleId: CircleId('2')), const Circle(circleId: CircleId('3')), @@ -88,7 +88,7 @@ void main() { expect(controller.circles.length, 3); // Remove some circles... - final Set circleIdsToRemove = { + final circleIdsToRemove = { const CircleId('1'), const CircleId('3'), }; @@ -102,7 +102,7 @@ void main() { }); testWidgets('Converts colors to CSS', (WidgetTester tester) async { - final Set circles = { + final circles = { const Circle( circleId: CircleId('1'), fillColor: Color(0x7FFABADA), @@ -129,7 +129,7 @@ void main() { testWidgets('addCircles sets clickable according to consumeTapEvents', ( WidgetTester tester, ) async { - final Set circles = { + final circles = { const Circle(circleId: CircleId('1'), consumeTapEvents: true), const Circle(circleId: CircleId('2')), }; @@ -162,7 +162,7 @@ void main() { }); testWidgets('addPolygons', (WidgetTester tester) async { - final Set polygons = { + final polygons = { const Polygon(polygonId: PolygonId('1')), const Polygon(polygonId: PolygonId('2')), }; @@ -176,7 +176,7 @@ void main() { }); testWidgets('changePolygons', (WidgetTester tester) async { - final Set polygons = { + final polygons = { const Polygon(polygonId: PolygonId('1')), }; controller.addPolygons(polygons); @@ -187,7 +187,7 @@ void main() { ); // Update the polygon - final Set updatedPolygons = { + final updatedPolygons = { const Polygon(polygonId: PolygonId('1'), visible: false), }; controller.changePolygons(updatedPolygons); @@ -200,7 +200,7 @@ void main() { }); testWidgets('removePolygons', (WidgetTester tester) async { - final Set polygons = { + final polygons = { const Polygon(polygonId: PolygonId('1')), const Polygon(polygonId: PolygonId('2')), const Polygon(polygonId: PolygonId('3')), @@ -211,7 +211,7 @@ void main() { expect(controller.polygons.length, 3); // Remove some polygons... - final Set polygonIdsToRemove = { + final polygonIdsToRemove = { const PolygonId('1'), const PolygonId('3'), }; @@ -225,7 +225,7 @@ void main() { }); testWidgets('Converts colors to CSS', (WidgetTester tester) async { - final Set polygons = { + final polygons = { const Polygon( polygonId: PolygonId('1'), fillColor: Color(0x7FFABADA), @@ -250,7 +250,7 @@ void main() { }); testWidgets('Handle Polygons with holes', (WidgetTester tester) async { - final Set polygons = { + final polygons = { const Polygon( polygonId: PolygonId('BermudaTriangle'), points: [ @@ -276,7 +276,7 @@ void main() { }); testWidgets('Polygon with hole has a hole', (WidgetTester tester) async { - final Set polygons = { + final polygons = { const Polygon( polygonId: PolygonId('BermudaTriangle'), points: [ @@ -297,7 +297,7 @@ void main() { controller.addPolygons(polygons); final gmaps.Polygon? polygon = controller.polygons.values.first.polygon; - final gmaps.LatLng pointInHole = gmaps.LatLng(28.632, -68.401); + final pointInHole = gmaps.LatLng(28.632, -68.401); expect(geometry.poly.containsLocation(pointInHole, polygon!), false); }); @@ -305,7 +305,7 @@ void main() { testWidgets('Hole Path gets reversed to display correctly', ( WidgetTester tester, ) async { - final Set polygons = { + final polygons = { const Polygon( polygonId: PolygonId('BermudaTriangle'), points: [ @@ -336,7 +336,7 @@ void main() { testWidgets('addPolygons sets clickable according to consumeTapEvents', ( WidgetTester tester, ) async { - final Set polygons = { + final polygons = { const Polygon(polygonId: PolygonId('1'), consumeTapEvents: true), const Polygon(polygonId: PolygonId('2')), }; @@ -369,7 +369,7 @@ void main() { }); testWidgets('addPolylines', (WidgetTester tester) async { - final Set polylines = { + final polylines = { const Polyline(polylineId: PolylineId('1')), const Polyline(polylineId: PolylineId('2')), }; @@ -383,14 +383,14 @@ void main() { }); testWidgets('changePolylines', (WidgetTester tester) async { - final Set polylines = { + final polylines = { const Polyline(polylineId: PolylineId('1')), }; controller.addPolylines(polylines); expect(controller.lines[const PolylineId('1')]?.line?.visible, isTrue); - final Set updatedPolylines = { + final updatedPolylines = { const Polyline(polylineId: PolylineId('1'), visible: false), }; controller.changePolylines(updatedPolylines); @@ -400,7 +400,7 @@ void main() { }); testWidgets('removePolylines', (WidgetTester tester) async { - final Set polylines = { + final polylines = { const Polyline(polylineId: PolylineId('1')), const Polyline(polylineId: PolylineId('2')), const Polyline(polylineId: PolylineId('3')), @@ -411,7 +411,7 @@ void main() { expect(controller.lines.length, 3); // Remove some polylines... - final Set polylineIdsToRemove = { + final polylineIdsToRemove = { const PolylineId('1'), const PolylineId('3'), }; @@ -425,7 +425,7 @@ void main() { }); testWidgets('Converts colors to CSS', (WidgetTester tester) async { - final Set lines = { + final lines = { const Polyline(polylineId: PolylineId('1'), color: Color(0x7FFABADA)), }; @@ -443,7 +443,7 @@ void main() { testWidgets('addPolylines sets clickable according to consumeTapEvents', ( WidgetTester tester, ) async { - final Set polylines = { + final polylines = { const Polyline(polylineId: PolylineId('1'), consumeTapEvents: true), const Polyline(polylineId: PolylineId('2')), }; @@ -468,7 +468,7 @@ void main() { group('HeatmapsController', () { late HeatmapsController controller; - const List heatmapPoints = [ + const heatmapPoints = [ WeightedLatLng(LatLng(37.782, -122.447)), WeightedLatLng(LatLng(37.782, -122.445)), WeightedLatLng(LatLng(37.782, -122.443)), @@ -491,7 +491,7 @@ void main() { }); testWidgets('addHeatmaps', (WidgetTester tester) async { - final Set heatmaps = { + final heatmaps = { const Heatmap( heatmapId: HeatmapId('1'), data: heatmapPoints, @@ -513,7 +513,7 @@ void main() { }); testWidgets('changeHeatmaps', (WidgetTester tester) async { - final Set heatmaps = { + final heatmaps = { const Heatmap( heatmapId: HeatmapId('1'), data: [], @@ -527,7 +527,7 @@ void main() { hasLength(0), ); - final Set updatedHeatmaps = { + final updatedHeatmaps = { const Heatmap( heatmapId: HeatmapId('1'), data: [WeightedLatLng(LatLng(0, 0))], @@ -544,7 +544,7 @@ void main() { }); testWidgets('removeHeatmaps', (WidgetTester tester) async { - final Set heatmaps = { + final heatmaps = { const Heatmap( heatmapId: HeatmapId('1'), data: heatmapPoints, @@ -567,7 +567,7 @@ void main() { expect(controller.heatmaps.length, 3); // Remove some polylines... - final Set heatmapIdsToRemove = { + final heatmapIdsToRemove = { const HeatmapId('1'), const HeatmapId('3'), }; @@ -581,7 +581,7 @@ void main() { }); testWidgets('Converts colors to CSS', (WidgetTester tester) async { - final Set heatmaps = { + final heatmaps = { const Heatmap( heatmapId: HeatmapId('1'), data: heatmapPoints, 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 325489f0637..aa94f0adb24 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,8 +30,8 @@ class CirclesController extends GeometryController { void _addCircle(Circle circle) { final gmaps.CircleOptions circleOptions = _circleOptionsFromCircle(circle); - final gmaps.Circle gmCircle = gmaps.Circle(circleOptions)..map = googleMap; - final CircleController controller = CircleController( + final gmCircle = gmaps.Circle(circleOptions)..map = googleMap; + final controller = CircleController( circle: gmCircle, consumeTapEvents: circle.consumeTapEvents, onTap: () { 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 b647d95a988..899c7fc3cea 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 @@ -62,7 +62,7 @@ gmaps.MapOptions _configurationAndStyleToGmapsOptions( MapConfiguration configuration, List styles, ) { - final gmaps.MapOptions options = gmaps.MapOptions(); + final options = gmaps.MapOptions(); if (configuration.mapType != null) { options.mapTypeId = _gmapTypeIDForPluginType(configuration.mapType!); @@ -182,7 +182,7 @@ bool _isJsonMapStyle(Map value) { // Converts an incoming JSON-encoded Style info, into the correct gmaps array. List _mapStyles(String? mapStyleJson) { - List styles = []; + var styles = []; if (mapStyleJson != null) { try { styles = @@ -191,7 +191,7 @@ List _mapStyles(String? mapStyleJson) { reviver: (Object? key, Object? value) { if (value is Map && _isJsonMapStyle(value as Map)) { - List stylers = []; + var stylers = []; if (value['stylers'] != null) { stylers = (value['stylers']! as List) .whereType>() @@ -273,7 +273,7 @@ gmaps.InfoWindowOptions? _infoWindowOptionsFromMarker(Marker marker) { ..id = 'gmaps-marker-${marker.markerId.value}-infowindow'; if (markerTitle.isNotEmpty) { - final HTMLHeadingElement title = + final title = (document.createElement('h3') as HTMLHeadingElement) ..className = 'infowindow-title' ..innerText = markerTitle; @@ -322,7 +322,7 @@ gmaps.InfoWindowOptions? _infoWindowOptionsFromMarker(Marker marker) { gmaps.Size? _gmSizeFromIconConfig(List iconConfig, int sizeIndex) { gmaps.Size? size; if (iconConfig.length >= sizeIndex + 1) { - final List? rawIconSize = iconConfig[sizeIndex] as List?; + final rawIconSize = iconConfig[sizeIndex] as List?; if (rawIconSize != null) { size = gmaps.Size(rawIconSize[0]! as double, rawIconSize[1]! as double); } @@ -332,7 +332,7 @@ gmaps.Size? _gmSizeFromIconConfig(List iconConfig, int sizeIndex) { /// Sets the size of the Google Maps icon. void _setIconSize({required Size size, required gmaps.Icon icon}) { - final gmaps.Size gmapsSize = gmaps.Size(size.width, size.height); + final gmapsSize = gmaps.Size(size.width, size.height); icon.size = gmapsSize; icon.scaledSize = gmapsSize; } @@ -342,7 +342,7 @@ void _setIconAnchor({ required Offset anchor, required gmaps.Icon icon, }) { - final gmaps.Point gmapsAnchor = gmaps.Point( + final gmapsAnchor = gmaps.Point( size.width * anchor.dx, size.height * anchor.dy, ); @@ -400,7 +400,7 @@ Future _getBitmapSize(MapBitmap mapBitmap, String url) async { /// /// This method attempts to fetch the image size for a given [url]. Future _fetchBitmapSize(String url) async { - final HTMLImageElement image = HTMLImageElement()..src = url; + final image = HTMLImageElement()..src = url; // Wait for the onLoad or onError event. await Future.any(>[image.onLoad.first, image.onError.first]); @@ -451,7 +451,7 @@ Future _gmIconFromBitmapDescriptor( // The following code is for the deprecated BitmapDescriptor.fromBytes // and BitmapDescriptor.fromAssetImage. - final List iconConfig = bitmapDescriptor.toJson() as List; + final iconConfig = bitmapDescriptor.toJson() as List; if (iconConfig[0] == 'fromAssetImage') { assert(iconConfig.length >= 2); // iconConfig[2] contains the DPIs of the screen, but that information is @@ -467,7 +467,7 @@ Future _gmIconFromBitmapDescriptor( } } else if (iconConfig[0] == 'fromBytes') { // Grab the bytes, and put them into a blob - final List bytes = iconConfig[1]! as List; + final bytes = iconConfig[1]! as List; // Create a Blob from bytes, but let the browser figure out the encoding final Blob blob; @@ -516,7 +516,7 @@ Future _markerOptionsFromMarker( } gmaps.CircleOptions _circleOptionsFromCircle(Circle circle) { - final gmaps.CircleOptions circleOptions = gmaps.CircleOptions() + final circleOptions = gmaps.CircleOptions() ..strokeColor = _getCssColor(circle.strokeColor) ..strokeOpacity = _getCssOpacity(circle.strokeColor) ..strokeWeight = circle.strokeWidth @@ -534,7 +534,7 @@ visualization.HeatmapLayerOptions _heatmapOptionsFromHeatmap(Heatmap heatmap) { final Iterable? gradientColors = heatmap.gradient?.colors.map( (HeatmapGradientColor e) => e.color, ); - final visualization.HeatmapLayerOptions heatmapOptions = + final heatmapOptions = visualization.HeatmapLayerOptions() ..data = heatmap.data .map( @@ -569,9 +569,9 @@ gmaps.PolygonOptions _polygonOptionsFromPolygon( final bool isClockwisePolygon = _isPolygonClockwise(path); - final List> paths = >[path]; + final paths = >[path]; - for (int i = 0; i < polygon.holes.length; i++) { + for (var i = 0; i < polygon.holes.length; i++) { final List hole = polygon.holes[i]; final List correctHole = _ensureHoleHasReverseWinding( hole, @@ -630,8 +630,8 @@ List _ensureHoleHasReverseWinding( /// the `path` is a transformed version of [Polygon.points] or each of the /// [Polygon.holes], guaranteeing that `lat` and `lng` can be accessed with `!`. bool _isPolygonClockwise(List path) { - double direction = 0.0; - for (int i = 0; i < path.length; i++) { + var direction = 0.0; + for (var i = 0; i < path.length; i++) { direction = direction + ((path[(i + 1) % path.length].lat - path[i].lat) * @@ -677,7 +677,7 @@ void _applyCameraUpdate(gmaps.Map map, CameraUpdate update) { return value as List; } - final List json = update.toJson() as List; + final json = update.toJson() as List; switch (json[0]) { case 'newCameraPosition': final Map position = asJsonObject(json[1]); @@ -697,7 +697,7 @@ void _applyCameraUpdate(gmaps.Map map, CameraUpdate update) { final List latLngPair = asJsonList(json[1]); final List latLng1 = asJsonList(latLngPair[0]); final List latLng2 = asJsonList(latLngPair[1]); - final double padding = json[2] as double; + final padding = json[2] as double; map.fitBounds( gmaps.LatLngBounds( gmaps.LatLng(latLng1[0]! as num, latLng1[1]! as num), @@ -749,7 +749,7 @@ String urlFromMapBitmap(MapBitmap mapBitmap) { (final BytesMapBitmap bytesMapBitmap) => _bitmapBlobUrlCache.putIfAbsent( bytesMapBitmap.byteData.hashCode, () { - final Blob blob = Blob( + final blob = Blob( [bytesMapBitmap.byteData.toJS].toJS, ); return URL.createObjectURL(blob as JSObject); @@ -792,7 +792,7 @@ gmaps.LatLng _pixelToLatLng(gmaps.Map map, int x, int y) { final int scale = 1 << (zoom.toInt()); // 2 ^ zoom - final gmaps.Point point = gmaps.Point( + final point = gmaps.Point( (x / scale) + bottomLeft.x, (y / scale) + topRight.y, ); diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/google_maps_controller.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/google_maps_controller.dart index b7ee0ebc0e7..eb65f510468 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/google_maps_controller.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/google_maps_controller.dart @@ -605,7 +605,7 @@ class GoogleMapController { /// Updates the set of [TileOverlay]s. void updateTileOverlays(Set newOverlays) { - final MapsObjectUpdates updates = + final updates = MapsObjectUpdates.from( _tileOverlays, newOverlays, 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 4f0058b4aec..dc517af1d4b 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 @@ -334,10 +334,10 @@ class GoogleMapsPlugin extends GoogleMapsFlutterPlatform { return _mapById[creationId]!.widget!; } - final StreamController> controller = + final controller = StreamController>.broadcast(); - final GoogleMapController mapController = GoogleMapController( + final mapController = GoogleMapController( mapId: creationId, streamController: controller, widgetConfiguration: widgetConfiguration, diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/ground_overlays.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/ground_overlays.dart index ca2ca74c5dc..0607ec9932d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/ground_overlays.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/ground_overlays.dart @@ -39,19 +39,19 @@ class GroundOverlaysController extends GeometryController { groundOverlay.bounds!, ); - final gmaps.GroundOverlayOptions groundOverlayOptions = + final groundOverlayOptions = gmaps.GroundOverlayOptions() ..opacity = 1.0 - groundOverlay.transparency ..clickable = groundOverlay.clickable ..map = groundOverlay.visible ? googleMap : null; - final gmaps.GroundOverlay overlay = gmaps.GroundOverlay( + final overlay = gmaps.GroundOverlay( urlFromMapBitmap(groundOverlay.image), bounds, groundOverlayOptions, ); - final GroundOverlayController controller = GroundOverlayController( + final controller = GroundOverlayController( groundOverlay: overlay, onTap: () { _onGroundOverlayTap(groundOverlay.groundOverlayId); diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/heatmaps.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/heatmaps.dart index 047a346c9fc..5e41b21b1a6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/heatmaps.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/heatmaps.dart @@ -27,11 +27,11 @@ class HeatmapsController extends GeometryController { void _addHeatmap(Heatmap heatmap) { final visualization.HeatmapLayerOptions heatmapOptions = _heatmapOptionsFromHeatmap(heatmap); - final visualization.HeatmapLayer gmHeatmap = visualization.HeatmapLayer( + final gmHeatmap = visualization.HeatmapLayer( heatmapOptions, ); gmHeatmap.map = googleMap; - final HeatmapController controller = HeatmapController(heatmap: gmHeatmap); + final controller = HeatmapController(heatmap: gmHeatmap); _heatmapIdToController[heatmap.heatmapId] = controller; } @@ -48,7 +48,7 @@ class HeatmapsController extends GeometryController { /// Removes a set of [HeatmapId]s from the cache. void removeHeatmaps(Set heatmapIdsToRemove) { - for (final HeatmapId heatmapId in heatmapIdsToRemove) { + for (final heatmapId in heatmapIdsToRemove) { final HeatmapController? heatmapController = _heatmapIdToController[heatmapId]; heatmapController?.remove(); diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/marker_clustering_js_interop.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/marker_clustering_js_interop.dart index 8d15f3546b3..d5fca430e76 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/marker_clustering_js_interop.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/marker_clustering_js_interop.dart @@ -158,7 +158,7 @@ MarkerClusterer createMarkerClusterer( gmaps.Map map, ClusterClickHandler onClusterClickHandler, ) { - final MarkerClustererOptions options = MarkerClustererOptions( + final options = MarkerClustererOptions( map: map, onClusterClick: onClusterClickHandler, ); 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 2b69cc2e47b..a0dc2e361c4 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 @@ -44,7 +44,7 @@ class MarkersController extends GeometryController { // we make one... if (infoWindowOptions.content != null && infoWindowOptions.content is HTMLElement) { - final HTMLElement content = infoWindowOptions.content! as HTMLElement; + final content = infoWindowOptions.content! as HTMLElement; content.onclick = (JSAny? _) { _onInfoWindowTap(marker.markerId); @@ -60,7 +60,7 @@ class MarkersController extends GeometryController { currentMarker, ); - final gmaps.Marker gmMarker = gmaps.Marker(markerOptions); + final gmMarker = gmaps.Marker(markerOptions); gmMarker.set('markerId', marker.markerId.value.toJS); @@ -70,7 +70,7 @@ class MarkersController extends GeometryController { gmMarker.map = googleMap; } - final MarkerController controller = MarkerController( + final controller = MarkerController( marker: gmMarker, clusterManagerId: marker.clusterManagerId, infoWindow: gmInfoWindow, diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/overlay.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/overlay.dart index 48f0be5c7ef..45d0ae20918 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/overlay.dart @@ -40,7 +40,7 @@ class TileOverlayController { return null; } - final HTMLImageElement img = + final img = ownerDocument!.createElement('img') as HTMLImageElement; img.width = img.height = logicalTileSize; img.hidden = true.toJS; diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/overlays.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/overlays.dart index fa6c24fca8d..30446658efb 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/overlays.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/overlays.dart @@ -43,7 +43,7 @@ class TileOverlaysController extends GeometryController { } void _addTileOverlay(TileOverlay tileOverlay) { - final TileOverlayController controller = TileOverlayController( + final controller = TileOverlayController( tileOverlay: tileOverlay, ); _tileOverlays[tileOverlay.tileOverlayId] = controller; 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 4600cb69ec5..b223f725f64 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 @@ -33,9 +33,9 @@ class PolygonsController extends GeometryController { googleMap, polygon, ); - final gmaps.Polygon gmPolygon = gmaps.Polygon(polygonOptions) + final gmPolygon = gmaps.Polygon(polygonOptions) ..map = googleMap; - final PolygonController controller = PolygonController( + final controller = PolygonController( polygon: gmPolygon, consumeTapEvents: polygon.consumeTapEvents, onTap: () { 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 626d20ca5c8..a5f9f3a53d2 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 @@ -33,9 +33,9 @@ class PolylinesController extends GeometryController { googleMap, polyline, ); - final gmaps.Polyline gmPolyline = gmaps.Polyline(polylineOptions) + final gmPolyline = gmaps.Polyline(polylineOptions) ..map = googleMap; - final PolylineController controller = PolylineController( + final controller = PolylineController( polyline: gmPolyline, consumeTapEvents: polyline.consumeTapEvents, onTap: () { diff --git a/packages/google_sign_in/google_sign_in/example/lib/main.dart b/packages/google_sign_in/google_sign_in/example/lib/main.dart index 401c69e9f5d..024dc926155 100644 --- a/packages/google_sign_in/google_sign_in/example/lib/main.dart +++ b/packages/google_sign_in/google_sign_in/example/lib/main.dart @@ -152,7 +152,7 @@ class _SignInDemoState extends State { } return; } - final Map data = + final data = json.decode(response.body) as Map; final String? namedContact = _pickFirstNamedContact(data); setState(() { @@ -165,8 +165,8 @@ class _SignInDemoState extends State { } String? _pickFirstNamedContact(Map data) { - final List? connections = data['connections'] as List?; - final Map? contact = + final connections = data['connections'] as List?; + final contact = connections?.firstWhere( (dynamic contact) => (contact as Map)['names'] != null, @@ -174,8 +174,8 @@ class _SignInDemoState extends State { ) as Map?; if (contact != null) { - final List names = contact['names'] as List; - final Map? name = + final names = contact['names'] as List; + final name = names.firstWhere( (dynamic name) => (name as Map)['displayName'] != null, 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 8cee5167858..4f647fee6af 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 @@ -97,7 +97,7 @@ class GoogleSignInAccount implements GoogleIdentity { @override String toString() { - final Map data = { + final data = { 'displayName': displayName, 'email': email, 'id': id, @@ -461,7 +461,7 @@ class GoogleSignIn { return null; } - final GoogleSignInAccount account = GoogleSignInAccount._( + final account = GoogleSignInAccount._( result.user, result.authenticationTokens, ); @@ -544,7 +544,7 @@ class GoogleSignIn { try { final AuthenticationResults result = await GoogleSignInPlatform.instance .authenticate(AuthenticateParameters(scopeHint: scopeHint)); - final GoogleSignInAccount account = GoogleSignInAccount._( + final account = GoogleSignInAccount._( result.user, result.authenticationTokens, ); diff --git a/packages/google_sign_in/google_sign_in/lib/src/fife.dart b/packages/google_sign_in/google_sign_in/lib/src/fife.dart index 13e774649f6..06ac759124c 100644 --- a/packages/google_sign_in/google_sign_in/lib/src/fife.dart +++ b/packages/google_sign_in/google_sign_in/lib/src/fife.dart @@ -36,7 +36,7 @@ final RegExp sizeDirective = RegExp(r'^s[0-9]{1,5}(-c)?$'); /// Modified image URLs are recomposed by performing the parsing steps in reverse. String addSizeDirectiveToUrl(String photoUrl, double size) { final Uri profileUri = Uri.parse(photoUrl); - final List pathSegments = List.from(profileUri.pathSegments); + final pathSegments = List.from(profileUri.pathSegments); if (pathSegments.length <= 2) { final String imagePath = pathSegments.last; // Does this have any existing transformation directives? @@ -46,7 +46,7 @@ String addSizeDirectiveToUrl(String photoUrl, double size) { final String baseUrl = imagePath.substring(0, directiveSeparator); final String directive = imagePath.substring(directiveSeparator + 1); // Split the directive by "-" - final Set directives = Set.from(directive.split('-')) + final directives = Set.from(directive.split('-')) // Remove the size directive, if present, and any empty values ..removeWhere((String s) => s.isEmpty || sizeDirective.hasMatch(s)) // Add the size and crop directives 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 c78a82636df..a0a3cd1f1e1 100644 --- a/packages/google_sign_in/google_sign_in/lib/widgets.dart +++ b/packages/google_sign_in/google_sign_in/lib/widgets.dart @@ -74,7 +74,7 @@ class GoogleUserCircleAvatar extends StatelessWidget { // Placeholder to use when there is no photo URL, and while the photo is // loading. Uses the first character of the display name (if it has one), // or the first letter of the email address if it does not. - final List placeholderCharSources = [ + final placeholderCharSources = [ identity.displayName, identity.email, '-', diff --git a/packages/google_sign_in/google_sign_in/test/fife_test.dart b/packages/google_sign_in/google_sign_in/test/fife_test.dart index 39f9546f988..a4000242fa8 100644 --- a/packages/google_sign_in/google_sign_in/test/fife_test.dart +++ b/packages/google_sign_in/google_sign_in/test/fife_test.dart @@ -10,56 +10,56 @@ void main() { const double size = 20; group('Old style URLs', () { - const String base = + const base = 'https://lh3.googleusercontent.com/-ukEAtRyRhw8/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rfhID9XACtdb9q_xK43VSXQvBV11Q.CMID'; - const String expected = '$base/s20-c/photo.jpg'; + const expected = '$base/s20-c/photo.jpg'; test('with directives, sets size', () { - const String url = '$base/s64-c/photo.jpg'; + const url = '$base/s64-c/photo.jpg'; expect(addSizeDirectiveToUrl(url, size), expected); }); test('no directives, sets size and crop', () { - const String url = '$base/photo.jpg'; + const url = '$base/photo.jpg'; expect(addSizeDirectiveToUrl(url, size), expected); }); test('no crop, sets size and crop', () { - const String url = '$base/s64/photo.jpg'; + const url = '$base/s64/photo.jpg'; expect(addSizeDirectiveToUrl(url, size), expected); }); }); group('New style URLs', () { - const String base = + const base = 'https://lh3.googleusercontent.com/a-/AAuE7mC0Lh4F4uDtEaY7hpe-GIsbDpqfMZ3_2UhBQ8Qk'; - const String expected = '$base=c-s20'; + const expected = '$base=c-s20'; test('with directives, sets size', () { - const String url = '$base=s120-c'; + const url = '$base=s120-c'; expect(addSizeDirectiveToUrl(url, size), expected); }); test('no directives, sets size and crop', () { - const String url = base; + const url = base; expect(addSizeDirectiveToUrl(url, size), expected); }); test('no directives, but with an equals sign, sets size and crop', () { - const String url = '$base='; + const url = '$base='; expect(addSizeDirectiveToUrl(url, size), expected); }); test('no crop, adds crop', () { - const String url = '$base=s120'; + const url = '$base=s120'; expect(addSizeDirectiveToUrl(url, size), expected); }); test( 'many directives, sets size and crop, preserves other directives', () { - const String url = '$base=s120-c-fSoften=1,50,0'; - const String expected = '$base=c-fSoften=1,50,0-s20'; + const url = '$base=s120-c-fSoften=1,50,0'; + const expected = '$base=c-fSoften=1,50,0-s20'; expect(addSizeDirectiveToUrl(url, size), expected); }, ); diff --git a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart index d831bdb21d3..d3730f095ad 100644 --- a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart +++ b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart @@ -23,7 +23,7 @@ class TestMockGoogleSignInPlatform extends MockGoogleSignInPlatform @GenerateMocks([GoogleSignInPlatform]) void main() { - const GoogleSignInUserData defaultUser = GoogleSignInUserData( + const defaultUser = GoogleSignInUserData( email: 'john.doe@gmail.com', id: '8162538176523816253123', photoUrl: 'https://lh5.googleusercontent.com/photo.jpg', @@ -48,7 +48,7 @@ void main() { final VerificationResult verification = verify( mockPlatform.init(captureAny), ); - final InitParameters params = verification.captured[0] as InitParameters; + final params = verification.captured[0] as InitParameters; expect(params.clientId, null); expect(params.serverClientId, null); expect(params.nonce, null); @@ -58,10 +58,10 @@ void main() { test('passes all paramaters', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const String clientId = 'clientId'; - const String serverClientId = 'serverClientId'; - const String nonce = 'nonce'; - const String hostedDomain = 'example.com'; + const clientId = 'clientId'; + const serverClientId = 'serverClientId'; + const nonce = 'nonce'; + const hostedDomain = 'example.com'; await googleSignIn.initialize( clientId: clientId, serverClientId: serverClientId, @@ -72,7 +72,7 @@ void main() { final VerificationResult verification = verify( mockPlatform.init(captureAny), ); - final InitParameters params = verification.captured[0] as InitParameters; + final params = verification.captured[0] as InitParameters; expect(params.clientId, clientId); expect(params.serverClientId, serverClientId); expect(params.nonce, nonce); @@ -84,7 +84,7 @@ void main() { test('reports success from attemptLightweightAuthentication', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const String idToken = 'idToken'; + const idToken = 'idToken'; when(mockPlatform.attemptLightweightAuthentication(any)).thenAnswer( (_) async => const AuthenticationResults( user: defaultUser, @@ -99,7 +99,7 @@ void main() { final GoogleSignInAuthenticationEvent event = await eventFuture; expect(event, isA()); - final GoogleSignInAuthenticationEventSignIn signIn = + final signIn = event as GoogleSignInAuthenticationEventSignIn; expect(signIn.user.id, defaultUser.id); expect(signIn.user.authentication.idToken, idToken); @@ -110,14 +110,14 @@ void main() { () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const GoogleSignInException exception = GoogleSignInException( + const exception = GoogleSignInException( code: GoogleSignInExceptionCode.interrupted, ); when( mockPlatform.attemptLightweightAuthentication(any), ).thenThrow(exception); - final Completer errorCompleter = Completer(); + final errorCompleter = Completer(); final StreamSubscription subscription = googleSignIn.authenticationEvents .handleError((Object e) => errorCompleter.complete(e)) @@ -137,14 +137,14 @@ void main() { () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const GoogleSignInException exception = GoogleSignInException( + const exception = GoogleSignInException( code: GoogleSignInExceptionCode.interrupted, ); when( mockPlatform.attemptLightweightAuthentication(any), ).thenAnswer((_) async => throw exception); - final Completer errorCompleter = Completer(); + final errorCompleter = Completer(); final StreamSubscription subscription = googleSignIn.authenticationEvents .handleError((Object e) => errorCompleter.complete(e)) @@ -162,7 +162,7 @@ void main() { test('reports success from authenticate', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const String idToken = 'idToken'; + const idToken = 'idToken'; when(mockPlatform.authenticate(any)).thenAnswer( (_) async => const AuthenticationResults( user: defaultUser, @@ -177,7 +177,7 @@ void main() { final GoogleSignInAuthenticationEvent event = await eventFuture; expect(event, isA()); - final GoogleSignInAuthenticationEventSignIn signIn = + final signIn = event as GoogleSignInAuthenticationEventSignIn; expect(signIn.user.id, defaultUser.id); expect(signIn.user.authentication.idToken, idToken); @@ -186,12 +186,12 @@ void main() { test('reports sync exceptions from authenticate', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const GoogleSignInException exception = GoogleSignInException( + const exception = GoogleSignInException( code: GoogleSignInExceptionCode.interrupted, ); when(mockPlatform.authenticate(any)).thenThrow(exception); - final Completer errorCompleter = Completer(); + final errorCompleter = Completer(); final StreamSubscription subscription = googleSignIn.authenticationEvents .handleError((Object e) => errorCompleter.complete(e)) @@ -210,14 +210,14 @@ void main() { test('reports async exceptions from authenticate', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const GoogleSignInException exception = GoogleSignInException( + const exception = GoogleSignInException( code: GoogleSignInExceptionCode.interrupted, ); when( mockPlatform.authenticate(any), ).thenAnswer((_) async => throw exception); - final Completer errorCompleter = Completer(); + final errorCompleter = Completer(); final StreamSubscription subscription = googleSignIn.authenticationEvents .handleError((Object e) => errorCompleter.complete(e)) @@ -259,7 +259,7 @@ void main() { }); group('supportsAuthenticate', () { - for (final bool support in [true, false]) { + for (final support in [true, false]) { test('reports $support from platform', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; @@ -271,7 +271,7 @@ void main() { }); group('authorizationRequiresUserInteraction', () { - for (final bool support in [true, false]) { + for (final support in [true, false]) { test('reports $support from platform', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; @@ -288,7 +288,7 @@ void main() { test('returns successful authentication', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const String idToken = 'idToken'; + const idToken = 'idToken'; when(mockPlatform.attemptLightweightAuthentication(any)).thenAnswer( (_) async => const AuthenticationResults( user: defaultUser, @@ -310,7 +310,7 @@ void main() { test('reports all exceptions when requested - sync', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const GoogleSignInException exception = GoogleSignInException( + const exception = GoogleSignInException( code: GoogleSignInExceptionCode.canceled, ); when( @@ -337,7 +337,7 @@ void main() { () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const GoogleSignInException exception = GoogleSignInException( + const exception = GoogleSignInException( code: GoogleSignInExceptionCode.clientConfigurationError, ); when( @@ -361,7 +361,7 @@ void main() { test('reports all exceptions when requested - async', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const GoogleSignInException exception = GoogleSignInException( + const exception = GoogleSignInException( code: GoogleSignInExceptionCode.canceled, ); when( @@ -388,7 +388,7 @@ void main() { () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const GoogleSignInException exception = GoogleSignInException( + const exception = GoogleSignInException( code: GoogleSignInExceptionCode.clientConfigurationError, ); when( @@ -438,7 +438,7 @@ void main() { test('passes expected paramaters', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; when(mockPlatform.authenticate(any)).thenAnswer( (_) async => const AuthenticationResults( user: defaultUser, @@ -452,7 +452,7 @@ void main() { final VerificationResult verification = verify( mockPlatform.authenticate(captureAny), ); - final AuthenticateParameters params = + final params = verification.captured[0] as AuthenticateParameters; expect(params.scopeHint, scopes); }); @@ -460,7 +460,7 @@ void main() { test('returns successful authentication', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const String idToken = 'idToken'; + const idToken = 'idToken'; when(mockPlatform.authenticate(any)).thenAnswer( (_) async => const AuthenticationResults( user: defaultUser, @@ -479,7 +479,7 @@ void main() { test('reports exceptions', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const GoogleSignInException exception = GoogleSignInException( + const exception = GoogleSignInException( code: GoogleSignInExceptionCode.interrupted, ); when(mockPlatform.authenticate(any)).thenThrow(exception); @@ -515,13 +515,13 @@ void main() { await googleSignIn.initialize(); final GoogleSignInAccount authentication = await googleSignIn .authenticate(); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; await authentication.authorizationClient.authorizationForScopes(scopes); final VerificationResult verification = verify( mockPlatform.clientAuthorizationTokensForScopes(captureAny), ); - final ClientAuthorizationTokensForScopesParameters params = + final params = verification.captured[0] as ClientAuthorizationTokensForScopesParameters; expect(params.request.scopes, scopes); @@ -537,13 +537,13 @@ void main() { mockPlatform.clientAuthorizationTokensForScopes(any), ).thenAnswer((_) async => null); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; await googleSignIn.authorizationClient.authorizationForScopes(scopes); final VerificationResult verification = verify( mockPlatform.clientAuthorizationTokensForScopes(captureAny), ); - final ClientAuthorizationTokensForScopesParameters params = + final params = verification.captured[0] as ClientAuthorizationTokensForScopesParameters; expect(params.request.scopes, scopes); @@ -555,13 +555,13 @@ void main() { test('reports tokens', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const String accessToken = 'accessToken'; + const accessToken = 'accessToken'; when(mockPlatform.clientAuthorizationTokensForScopes(any)).thenAnswer( (_) async => const ClientAuthorizationTokenData(accessToken: accessToken), ); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; final GoogleSignInClientAuthorization? auth = await googleSignIn .authorizationClient .authorizationForScopes(scopes); @@ -575,7 +575,7 @@ void main() { mockPlatform.clientAuthorizationTokensForScopes(any), ).thenAnswer((_) async => null); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; expect( await googleSignIn.authorizationClient.authorizationForScopes(scopes), null, @@ -601,13 +601,13 @@ void main() { await googleSignIn.initialize(); final GoogleSignInAccount authentication = await googleSignIn .authenticate(); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; await authentication.authorizationClient.authorizeScopes(scopes); final VerificationResult verification = verify( mockPlatform.clientAuthorizationTokensForScopes(captureAny), ); - final ClientAuthorizationTokensForScopesParameters params = + final params = verification.captured[0] as ClientAuthorizationTokensForScopesParameters; expect(params.request.scopes, scopes); @@ -624,13 +624,13 @@ void main() { const ClientAuthorizationTokenData(accessToken: 'accessToken'), ); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; await googleSignIn.authorizationClient.authorizeScopes(scopes); final VerificationResult verification = verify( mockPlatform.clientAuthorizationTokensForScopes(captureAny), ); - final ClientAuthorizationTokensForScopesParameters params = + final params = verification.captured[0] as ClientAuthorizationTokensForScopesParameters; expect(params.request.scopes, scopes); @@ -642,13 +642,13 @@ void main() { test('reports tokens', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const String accessToken = 'accessToken'; + const accessToken = 'accessToken'; when(mockPlatform.clientAuthorizationTokensForScopes(any)).thenAnswer( (_) async => const ClientAuthorizationTokenData(accessToken: accessToken), ); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; final GoogleSignInClientAuthorization auth = await googleSignIn .authorizationClient .authorizeScopes(scopes); @@ -662,7 +662,7 @@ void main() { mockPlatform.clientAuthorizationTokensForScopes(any), ).thenAnswer((_) async => null); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; await expectLater( googleSignIn.authorizationClient.authorizeScopes(scopes), throwsA( @@ -693,13 +693,13 @@ void main() { await googleSignIn.initialize(); final GoogleSignInAccount authentication = await googleSignIn .authenticate(); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; await authentication.authorizationClient.authorizeServer(scopes); final VerificationResult verification = verify( mockPlatform.serverAuthorizationTokensForScopes(captureAny), ); - final ServerAuthorizationTokensForScopesParameters params = + final params = verification.captured[0] as ServerAuthorizationTokensForScopesParameters; expect(params.request.scopes, scopes); @@ -715,13 +715,13 @@ void main() { mockPlatform.serverAuthorizationTokensForScopes(any), ).thenAnswer((_) async => null); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; await googleSignIn.authorizationClient.authorizeServer(scopes); final VerificationResult verification = verify( mockPlatform.serverAuthorizationTokensForScopes(captureAny), ); - final ServerAuthorizationTokensForScopesParameters params = + final params = verification.captured[0] as ServerAuthorizationTokensForScopesParameters; expect(params.request.scopes, scopes); @@ -733,13 +733,13 @@ void main() { test('reports tokens', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const String authCode = 'authCode'; + const authCode = 'authCode'; when(mockPlatform.serverAuthorizationTokensForScopes(any)).thenAnswer( (_) async => const ServerAuthorizationTokenData(serverAuthCode: authCode), ); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; final GoogleSignInServerAuthorization? auth = await googleSignIn .authorizationClient .authorizeServer(scopes); @@ -753,7 +753,7 @@ void main() { mockPlatform.serverAuthorizationTokensForScopes(any), ).thenAnswer((_) async => null); - const List scopes = ['scope1', 'scope2']; + const scopes = ['scope1', 'scope2']; expect( await googleSignIn.authorizationClient.authorizeServer(scopes), null, @@ -765,7 +765,7 @@ void main() { test('passes expected paramaters', () async { final GoogleSignIn googleSignIn = GoogleSignIn.instance; - const String token = 'someAccessToken'; + const token = 'someAccessToken'; await googleSignIn.authorizationClient.clearAuthorizationToken( accessToken: token, ); @@ -773,7 +773,7 @@ void main() { final VerificationResult verification = verify( mockPlatform.clearAuthorizationToken(captureAny), ); - final ClearAuthorizationTokenParams params = + final params = verification.captured[0] as ClearAuthorizationTokenParams; expect(params.accessToken, token); }); diff --git a/packages/google_sign_in/google_sign_in_android/example/lib/main.dart b/packages/google_sign_in/google_sign_in_android/example/lib/main.dart index 8ab6e537868..d0f28eb5cbb 100644 --- a/packages/google_sign_in/google_sign_in_android/example/lib/main.dart +++ b/packages/google_sign_in/google_sign_in_android/example/lib/main.dart @@ -160,7 +160,7 @@ class SignInDemoState extends State { print('People API ${response.statusCode} response: ${response.body}'); return; } - final Map data = + final data = json.decode(response.body) as Map; final int contactCount = (data['connections'] as List?)?.length ?? 0; diff --git a/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart b/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart index de66df6f4ba..f233d4f2a7d 100644 --- a/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart +++ b/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart @@ -346,14 +346,14 @@ final Codec _jwtCodec = json.fuse(utf8).fuse(base64); /// /// See https://stackoverflow.com/a/78064720 String? _idFromIdToken(String idToken) { - final RegExp jwtTokenRegexp = RegExp( + final jwtTokenRegexp = RegExp( r'^(?
[^\.\s]+)\.(?[^\.\s]+)\.(?[^\.\s]+)$', ); final RegExpMatch? match = jwtTokenRegexp.firstMatch(idToken); final String? payload = match?.namedGroup('payload'); if (payload != null) { try { - final Map? contents = + final contents = _jwtCodec.decode(base64.normalize(payload)) as Map?; if (contents != null) { return contents['sub'] as String?; diff --git a/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart b/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart index 2df0394dd14..86488a1d2a1 100644 --- a/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart +++ b/packages/google_sign_in/google_sign_in_android/test/google_sign_in_android_test.dart @@ -65,7 +65,7 @@ void main() { group('attemptLightweightAuthentication', () { test('passes explicit server client ID', () async { - const String serverClientId = 'aServerClient'; + const serverClientId = 'aServerClient'; await googleSignIn.init( const InitParameters(serverClientId: serverClientId), @@ -78,13 +78,13 @@ void main() { final VerificationResult verification = verify( mockApi.getCredential(captureAny), ); - final GetCredentialRequestParams hostParams = + final hostParams = verification.captured[0] as GetCredentialRequestParams; expect(hostParams.serverClientId, serverClientId); }); test('passes JSON server client ID if not overridden', () async { - const String serverClientId = 'aServerClient'; + const serverClientId = 'aServerClient'; when( mockApi.getGoogleServicesJsonServerClientId(), ).thenAnswer((_) async => serverClientId); @@ -100,13 +100,13 @@ void main() { final VerificationResult verification = verify( mockApi.getCredential(captureAny), ); - final GetCredentialRequestParams hostParams = + final hostParams = verification.captured[0] as GetCredentialRequestParams; expect(hostParams.serverClientId, serverClientId); }); test('passes nonce if provided', () async { - const String nonce = 'nonce'; + const nonce = 'nonce'; await googleSignIn.init( const InitParameters(nonce: nonce, serverClientId: 'id'), @@ -118,7 +118,7 @@ void main() { final VerificationResult verification = verify( mockApi.getCredential(captureAny), ); - final GetCredentialRequestParams hostParams = + final hostParams = verification.captured[0] as GetCredentialRequestParams; expect(hostParams.nonce, nonce); }); @@ -177,9 +177,9 @@ void main() { mockApi.getCredential(captureAny), ], ); - final GetCredentialRequestParams firstParams = + final firstParams = verifications[0].captured[0] as GetCredentialRequestParams; - final GetCredentialRequestParams secondParams = + final secondParams = verifications[1].captured[0] as GetCredentialRequestParams; expect(firstParams.useButtonFlow, isFalse); expect(firstParams.googleIdOptionParams.filterToAuthorized, isTrue); @@ -211,7 +211,7 @@ void main() { mockApi.getCredential(captureAny), ); expect(verification.callCount, 1); - final GetCredentialRequestParams params = + final params = verification.captured[0] as GetCredentialRequestParams; expect(params.useButtonFlow, isFalse); expect(params.googleIdOptionParams.filterToAuthorized, isTrue); @@ -222,7 +222,7 @@ void main() { group('authenticate', () { test('passes explicit server client ID', () async { - const String serverClientId = 'aServerClient'; + const serverClientId = 'aServerClient'; await googleSignIn.init( const InitParameters(serverClientId: serverClientId), @@ -233,13 +233,13 @@ void main() { final VerificationResult verification = verify( mockApi.getCredential(captureAny), ); - final GetCredentialRequestParams hostParams = + final hostParams = verification.captured[0] as GetCredentialRequestParams; expect(hostParams.serverClientId, serverClientId); }); test('passes JSON server client ID if not overridden', () async { - const String serverClientId = 'aServerClient'; + const serverClientId = 'aServerClient'; when( mockApi.getGoogleServicesJsonServerClientId(), ).thenAnswer((_) async => serverClientId); @@ -253,13 +253,13 @@ void main() { final VerificationResult verification = verify( mockApi.getCredential(captureAny), ); - final GetCredentialRequestParams hostParams = + final hostParams = verification.captured[0] as GetCredentialRequestParams; expect(hostParams.serverClientId, serverClientId); }); test('passes hosted domain if provided', () async { - const String hostedDomain = 'example.com'; + const hostedDomain = 'example.com'; await googleSignIn.init(const InitParameters(hostedDomain: hostedDomain)); await googleSignIn.authenticate(const AuthenticateParameters()); @@ -267,13 +267,13 @@ void main() { final VerificationResult verification = verify( mockApi.getCredential(captureAny), ); - final GetCredentialRequestParams hostParams = + final hostParams = verification.captured[0] as GetCredentialRequestParams; expect(hostParams.hostedDomain, hostedDomain); }); test('passes nonce if provided', () async { - const String nonce = 'nonce'; + const nonce = 'nonce'; await googleSignIn.init(const InitParameters(nonce: nonce)); await googleSignIn.authenticate(const AuthenticateParameters()); @@ -281,7 +281,7 @@ void main() { final VerificationResult verification = verify( mockApi.getCredential(captureAny), ); - final GetCredentialRequestParams hostParams = + final hostParams = verification.captured[0] as GetCredentialRequestParams; expect(hostParams.nonce, nonce); }); @@ -513,7 +513,7 @@ void main() { group('clientAuthorizationTokensForScopes', () { // Request details used when the details of the request are not relevant to // the test. - const AuthorizationRequestDetails defaultAuthRequest = + const defaultAuthRequest = AuthorizationRequestDetails( scopes: ['a'], userId: null, @@ -522,11 +522,11 @@ void main() { ); test('passes expected values', () async { - const List scopes = ['a', 'b']; - const String userId = '12345'; - const String userEmail = 'user@example.com'; - const bool promptIfUnauthorized = false; - const String hostedDomain = 'example.com'; + const scopes = ['a', 'b']; + const userId = '12345'; + const userEmail = 'user@example.com'; + const promptIfUnauthorized = false; + const hostedDomain = 'example.com'; when( mockApi.authorize(any, promptIfUnauthorized: promptIfUnauthorized), @@ -554,7 +554,7 @@ void main() { promptIfUnauthorized: promptIfUnauthorized, ), ); - final PlatformAuthorizationRequest hostParams = + final hostParams = verification.captured[0] as PlatformAuthorizationRequest; expect(hostParams.scopes, scopes); expect(hostParams.accountEmail, userEmail); @@ -563,8 +563,8 @@ void main() { }); test('passes true promptIfUnauthorized when requested', () async { - const List scopes = ['a', 'b']; - const bool promptIfUnauthorized = true; + const scopes = ['a', 'b']; + const promptIfUnauthorized = true; when( mockApi.authorize(any, promptIfUnauthorized: promptIfUnauthorized), @@ -590,7 +590,7 @@ void main() { }); test('passes success data to caller', () async { - const String accessToken = 'token'; + const accessToken = 'token'; when(mockApi.authorize(any, promptIfUnauthorized: false)).thenAnswer( (_) async => PlatformAuthorizationResult( @@ -726,7 +726,7 @@ void main() { group('serverAuthorizationTokensForScopes', () { // Request details used when the details of the request are not relevant to // the test. - const AuthorizationRequestDetails defaultAuthRequest = + const defaultAuthRequest = AuthorizationRequestDetails( scopes: ['a'], userId: null, @@ -735,12 +735,12 @@ void main() { ); test('serverAuthorizationTokensForScopes passes expected values', () async { - const List scopes = ['a', 'b']; - const String userId = '12345'; - const String userEmail = 'user@example.com'; - const bool promptIfUnauthorized = false; - const String hostedDomain = 'example.com'; - const String serverClientId = 'serverClientId'; + const scopes = ['a', 'b']; + const userId = '12345'; + const userEmail = 'user@example.com'; + const promptIfUnauthorized = false; + const hostedDomain = 'example.com'; + const serverClientId = 'serverClientId'; when( mockApi.authorize(any, promptIfUnauthorized: promptIfUnauthorized), @@ -771,7 +771,7 @@ void main() { promptIfUnauthorized: promptIfUnauthorized, ), ); - final PlatformAuthorizationRequest hostParams = + final hostParams = verification.captured[0] as PlatformAuthorizationRequest; expect(hostParams.scopes, scopes); expect(hostParams.accountEmail, userEmail); @@ -782,8 +782,8 @@ void main() { test( 'serverAuthorizationTokensForScopes passes true promptIfUnauthorized when requested', () async { - const List scopes = ['a', 'b']; - const bool promptIfUnauthorized = true; + const scopes = ['a', 'b']; + const promptIfUnauthorized = true; when( mockApi.authorize(any, promptIfUnauthorized: promptIfUnauthorized), @@ -812,8 +812,8 @@ void main() { test( 'serverAuthorizationTokensForScopes passes success data to caller', () async { - const List scopes = ['a', 'b']; - const String authCode = 'code'; + const scopes = ['a', 'b']; + const authCode = 'code'; when(mockApi.authorize(any, promptIfUnauthorized: false)).thenAnswer( (_) async => PlatformAuthorizationResult( @@ -962,8 +962,8 @@ void main() { group('disconnect', () { test('calls through with previously authorized accounts', () async { // Populate the cache of users. - const String userEmail = 'user@example.com'; - const String aScope = 'grantedScope'; + const userEmail = 'user@example.com'; + const aScope = 'grantedScope'; when(mockApi.authorize(any, promptIfUnauthorized: false)).thenAnswer( (_) async => PlatformAuthorizationResult( grantedScopes: [aScope], @@ -987,7 +987,7 @@ void main() { final VerificationResult verification = verify( mockApi.revokeAccess(captureAny), ); - final PlatformRevokeAccessRequest hostParams = + final hostParams = verification.captured[0] as PlatformRevokeAccessRequest; expect(hostParams.accountEmail, userEmail); expect(hostParams.scopes.first, aScope); @@ -1015,7 +1015,7 @@ void main() { final VerificationResult verification = verify( mockApi.revokeAccess(captureAny), ); - final PlatformRevokeAccessRequest hostParams = + final hostParams = verification.captured[0] as PlatformRevokeAccessRequest; expect(hostParams.accountEmail, _testUser.email); expect(hostParams.scopes.first, 'openid'); @@ -1024,8 +1024,8 @@ void main() { test('does not re-revoke for repeated disconnect', () async { // Populate the cache of users. - const String userEmail = 'user@example.com'; - const String aScope = 'grantedScope'; + const userEmail = 'user@example.com'; + const aScope = 'grantedScope'; when(mockApi.authorize(any, promptIfUnauthorized: false)).thenAnswer( (_) async => PlatformAuthorizationResult( grantedScopes: [aScope], diff --git a/packages/google_sign_in/google_sign_in_ios/example/lib/main.dart b/packages/google_sign_in/google_sign_in_ios/example/lib/main.dart index 54b08919dd8..ce5cc110561 100644 --- a/packages/google_sign_in/google_sign_in_ios/example/lib/main.dart +++ b/packages/google_sign_in/google_sign_in_ios/example/lib/main.dart @@ -159,7 +159,7 @@ class SignInDemoState extends State { print('People API ${response.statusCode} response: ${response.body}'); return; } - final Map data = + final data = json.decode(response.body) as Map; final int contactCount = (data['connections'] as List?)?.length ?? 0; diff --git a/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart b/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart index ea521ab8c07..f21d7443f35 100644 --- a/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart +++ b/packages/google_sign_in/google_sign_in_ios/lib/google_sign_in_ios.dart @@ -217,7 +217,7 @@ class GoogleSignInIOS extends GoogleSignInPlatform { // scopes may not report them with the same string as the request. // For example, requesting 'email' can instead result in the grant // 'https://www.googleapis.com/auth/userinfo.email'. - const Set openIdConnectScopes = { + const openIdConnectScopes = { 'email', 'openid', 'profile', @@ -276,7 +276,7 @@ class GoogleSignInIOS extends GoogleSignInPlatform { SignInSuccess result, ) { final UserData userData = result.user; - final GoogleSignInUserData user = GoogleSignInUserData( + final user = GoogleSignInUserData( email: userData.email, id: userData.userId, displayName: userData.displayName, diff --git a/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart b/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart index 7b6e4bd8dd5..b6edde82931 100644 --- a/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart +++ b/packages/google_sign_in/google_sign_in_ios/test/google_sign_in_ios_test.dart @@ -47,9 +47,9 @@ void main() { group('init', () { test('passes expected values', () async { - const String clientId = 'aClient'; - const String serverClientId = 'aServerClient'; - const String hostedDomain = 'example.com'; + const clientId = 'aClient'; + const serverClientId = 'aServerClient'; + const hostedDomain = 'example.com'; await googleSignIn.init( const InitParameters( @@ -62,7 +62,7 @@ void main() { final VerificationResult verification = verify( mockApi.configure(captureAny), ); - final PlatformConfigurationParams hostParams = + final hostParams = verification.captured[0] as PlatformConfigurationParams; expect(hostParams.clientId, clientId); expect(hostParams.serverClientId, serverClientId); @@ -72,7 +72,7 @@ void main() { group('attemptLightweightAuthentication', () { test('passes success data to caller', () async { - const String idToken = 'idToken'; + const idToken = 'idToken'; when(mockApi.restorePreviousSignIn()).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -137,7 +137,7 @@ void main() { group('authenticate', () { test('passes nonce if provided', () async { - const String nonce = 'nonce'; + const nonce = 'nonce'; when(mockApi.signIn(any, nonce)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -161,7 +161,7 @@ void main() { }); test('passes success data to caller', () async { - const String idToken = 'idToken'; + const idToken = 'idToken'; when(mockApi.signIn(any, null)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -310,7 +310,7 @@ void main() { group('clientAuthorizationTokensForScopes', () { // Request details used when the details of the request are not relevant to // the test. - const AuthorizationRequestDetails defaultAuthRequest = + const defaultAuthRequest = AuthorizationRequestDetails( scopes: ['a'], userId: null, @@ -321,7 +321,7 @@ void main() { test( 'passes expected values to addScopes if interaction is allowed', () async { - const List scopes = ['a', 'b']; + const scopes = ['a', 'b']; when(mockApi.addScopes(any, _testUser.id)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -352,7 +352,7 @@ void main() { final VerificationResult verification = verify( mockApi.addScopes(captureAny, _testUser.id), ); - final List passedScopes = + final passedScopes = verification.captured[0] as List; expect(passedScopes, scopes); }, @@ -360,7 +360,7 @@ void main() { test('passes expected values to getRefreshedAuthorizationTokens if ' 'interaction is not allowed', () async { - const List scopes = ['a', 'b']; + const scopes = ['a', 'b']; when(mockApi.getRefreshedAuthorizationTokens(_testUser.id)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -394,8 +394,8 @@ void main() { test( 'attempts to restore previous sign in if no user is provided', () async { - const List scopes = ['a', 'b']; - final SignInResult signInResult = SignInResult( + const scopes = ['a', 'b']; + final signInResult = SignInResult( success: SignInSuccess( user: UserData( displayName: _testUser.displayName, @@ -466,7 +466,7 @@ void main() { test('attempts to authenticate if no user is provided or already signed in ' 'and interaction is allowed', () async { - const List scopes = ['a', 'b']; + const scopes = ['a', 'b']; when(mockApi.restorePreviousSignIn()).thenAnswer( (_) async => SignInResult( error: SignInFailure(type: GoogleSignInErrorCode.noAuthInKeychain), @@ -509,8 +509,8 @@ void main() { test( 'passes success data to caller when refreshing existing auth', () async { - const List scopes = ['a', 'b']; - const String accessToken = 'token'; + const scopes = ['a', 'b']; + const accessToken = 'token'; when(mockApi.getRefreshedAuthorizationTokens(_testUser.id)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -544,8 +544,8 @@ void main() { ); test('passes success data to caller when calling addScopes', () async { - const List scopes = ['a', 'b']; - const String accessToken = 'token'; + const scopes = ['a', 'b']; + const accessToken = 'token'; when(mockApi.addScopes(scopes, _testUser.id)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -579,8 +579,8 @@ void main() { test('successfully returns refreshed tokens if addScopes indicates the ' 'requested scopes are already granted', () async { - const List scopes = ['a', 'b']; - const String accessToken = 'token'; + const scopes = ['a', 'b']; + const accessToken = 'token'; when(mockApi.addScopes(scopes, _testUser.id)).thenAnswer( (_) async => SignInResult( error: SignInFailure( @@ -625,9 +625,9 @@ void main() { test( 'returns null if re-using existing auth and scopes are missing', () async { - const List requestedScopes = ['a', 'b']; - const List grantedScopes = ['a']; - const String accessToken = 'token'; + const requestedScopes = ['a', 'b']; + const grantedScopes = ['a']; + const accessToken = 'token'; when(mockApi.getRefreshedAuthorizationTokens(_testUser.id)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -765,7 +765,7 @@ void main() { group('serverAuthorizationTokensForScopes', () { // Request details used when the details of the request are not relevant to // the test. - const AuthorizationRequestDetails defaultAuthRequest = + const defaultAuthRequest = AuthorizationRequestDetails( scopes: ['a'], userId: null, @@ -776,7 +776,7 @@ void main() { test( 'passes expected values to addScopes if interaction is allowed', () async { - const List scopes = ['a', 'b']; + const scopes = ['a', 'b']; when(mockApi.addScopes(any, _testUser.id)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -807,7 +807,7 @@ void main() { final VerificationResult verification = verify( mockApi.addScopes(captureAny, _testUser.id), ); - final List passedScopes = + final passedScopes = verification.captured[0] as List; expect(passedScopes, scopes); }, @@ -815,7 +815,7 @@ void main() { test('passes expected values to getRefreshedAuthorizationTokens if ' 'interaction is not allowed', () async { - const List scopes = ['a', 'b']; + const scopes = ['a', 'b']; when(mockApi.getRefreshedAuthorizationTokens(_testUser.id)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -849,8 +849,8 @@ void main() { test( 'attempts to restore previous sign in if no user is provided', () async { - const List scopes = ['a', 'b']; - final SignInResult signInResult = SignInResult( + const scopes = ['a', 'b']; + final signInResult = SignInResult( success: SignInSuccess( user: UserData( displayName: _testUser.displayName, @@ -921,7 +921,7 @@ void main() { test('attempts to authenticate if no user is provided or already signed in ' 'and interaction is allowed', () async { - const List scopes = ['a', 'b']; + const scopes = ['a', 'b']; when(mockApi.restorePreviousSignIn()).thenAnswer( (_) async => SignInResult( error: SignInFailure(type: GoogleSignInErrorCode.noAuthInKeychain), @@ -964,16 +964,16 @@ void main() { test( 'returns cached token from authn when refreshing existing authz', () async { - final UserData userData = UserData( + final userData = UserData( displayName: _testUser.displayName, email: _testUser.email, userId: _testUser.id, photoUrl: _testUser.photoUrl, idToken: '', ); - const List scopes = ['a', 'b']; - const String accessToken = 'accessToken'; - const String serverAuthCode = 'authCode'; + const scopes = ['a', 'b']; + const accessToken = 'accessToken'; + const serverAuthCode = 'authCode'; when(mockApi.signIn(scopes, null)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -1015,17 +1015,17 @@ void main() { ); test('does not return cached token from authn if user changes', () async { - const List scopes = ['a', 'b']; - const String accessToken = 'accessToken'; - const String serverAuthCode = 'authCode'; - final UserData previousUser = UserData( + const scopes = ['a', 'b']; + const accessToken = 'accessToken'; + const serverAuthCode = 'authCode'; + final previousUser = UserData( displayName: 'Previous user', email: 'previous.user@gmail.com', userId: 'different_id', photoUrl: _testUser.photoUrl, idToken: '', ); - final UserData newUser = UserData( + final newUser = UserData( displayName: _testUser.displayName, email: _testUser.email, userId: _testUser.id, @@ -1072,10 +1072,10 @@ void main() { }); test('does not return cached token from authn after signOut', () async { - const List scopes = ['a', 'b']; - const String accessToken = 'accessToken'; - const String serverAuthCode = 'authCode'; - final UserData userData = UserData( + const scopes = ['a', 'b']; + const accessToken = 'accessToken'; + const serverAuthCode = 'authCode'; + final userData = UserData( displayName: _testUser.displayName, email: _testUser.email, userId: _testUser.id, @@ -1123,10 +1123,10 @@ void main() { }); test('does not return cached token from authn after disconnect', () async { - const List scopes = ['a', 'b']; - const String accessToken = 'accessToken'; - const String serverAuthCode = 'authCode'; - final UserData userData = UserData( + const scopes = ['a', 'b']; + const accessToken = 'accessToken'; + const serverAuthCode = 'authCode'; + final userData = UserData( displayName: _testUser.displayName, email: _testUser.email, userId: _testUser.id, @@ -1176,8 +1176,8 @@ void main() { test( 'passes returned data to caller when calling addScopes without cache', () async { - const List scopes = ['a', 'b']; - const String serverAuthCode = 'authCode'; + const scopes = ['a', 'b']; + const serverAuthCode = 'authCode'; when(mockApi.addScopes(scopes, _testUser.id)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -1214,15 +1214,15 @@ void main() { test( 'passes returned data to caller when calling addScopes, not cached data', () async { - const List scopes = ['a', 'b']; - final UserData userData = UserData( + const scopes = ['a', 'b']; + final userData = UserData( displayName: _testUser.displayName, email: _testUser.email, userId: _testUser.id, photoUrl: _testUser.photoUrl, idToken: 'idToken', ); - const String serverAuthCode = 'authCode'; + const serverAuthCode = 'authCode'; when(mockApi.signIn([], null)).thenAnswer( (_) async => SignInResult( success: SignInSuccess( @@ -1263,9 +1263,9 @@ void main() { test('successfully returns cached token if addScopes indicates the ' 'requested scopes are already granted', () async { - const List scopes = ['a', 'b']; - const String serverAuthCode = 'authCode'; - final UserData userData = UserData( + const scopes = ['a', 'b']; + const serverAuthCode = 'authCode'; + final userData = UserData( displayName: _testUser.displayName, email: _testUser.email, userId: _testUser.id, @@ -1324,10 +1324,10 @@ void main() { test( 'returns null if re-using existing authz and scopes are missing', () async { - const List requestedScopes = ['a', 'b']; - const List grantedScopes = ['a']; - const String accessToken = 'token'; - final UserData userData = UserData( + const requestedScopes = ['a', 'b']; + const grantedScopes = ['a']; + const accessToken = 'token'; + final userData = UserData( displayName: _testUser.displayName, email: _testUser.email, userId: _testUser.id, diff --git a/packages/google_sign_in/google_sign_in_platform_interface/test/google_sign_in_platform_interface_test.dart b/packages/google_sign_in/google_sign_in_platform_interface/test/google_sign_in_platform_interface_test.dart index 27444d50674..2546af0a4af 100644 --- a/packages/google_sign_in/google_sign_in_platform_interface/test/google_sign_in_platform_interface_test.dart +++ b/packages/google_sign_in/google_sign_in_platform_interface/test/google_sign_in_platform_interface_test.dart @@ -41,7 +41,7 @@ void main() { test( 'Default implementation of clearAuthorizationToken throws unimplemented error', () { - final ExtendsGoogleSignInPlatform platform = + final platform = ExtendsGoogleSignInPlatform(); expect( @@ -56,13 +56,13 @@ void main() { group('GoogleSignInUserData', () { test('can be compared by == operator', () { - const GoogleSignInUserData firstInstance = GoogleSignInUserData( + const firstInstance = GoogleSignInUserData( email: 'email', id: 'id', displayName: 'displayName', photoUrl: 'photoUrl', ); - const GoogleSignInUserData secondInstance = GoogleSignInUserData( + const secondInstance = GoogleSignInUserData( email: 'email', id: 'id', displayName: 'displayName', @@ -74,10 +74,10 @@ void main() { group('AuthenticationTokenData', () { test('can be compared by == operator', () { - const AuthenticationTokenData firstInstance = AuthenticationTokenData( + const firstInstance = AuthenticationTokenData( idToken: 'idToken', ); - const AuthenticationTokenData secondInstance = AuthenticationTokenData( + const secondInstance = AuthenticationTokenData( idToken: 'idToken', ); expect(firstInstance == secondInstance, isTrue); @@ -86,9 +86,9 @@ void main() { group('ClientAuthorizationTokenData', () { test('can be compared by == operator', () { - const ClientAuthorizationTokenData firstInstance = + const firstInstance = ClientAuthorizationTokenData(accessToken: 'accessToken'); - const ClientAuthorizationTokenData secondInstance = + const secondInstance = ClientAuthorizationTokenData(accessToken: 'accessToken'); expect(firstInstance == secondInstance, isTrue); }); @@ -96,9 +96,9 @@ void main() { group('ServerAuthorizationTokenData', () { test('can be compared by == operator', () { - const ServerAuthorizationTokenData firstInstance = + const firstInstance = ServerAuthorizationTokenData(serverAuthCode: 'serverAuthCode'); - const ServerAuthorizationTokenData secondInstance = + const secondInstance = ServerAuthorizationTokenData(serverAuthCode: 'serverAuthCode'); expect(firstInstance == secondInstance, isTrue); }); diff --git a/packages/google_sign_in/google_sign_in_web/example/integration_test/flexible_size_html_element_view_test_disabled.dart b/packages/google_sign_in/google_sign_in_web/example/integration_test/flexible_size_html_element_view_test_disabled.dart index e19ca94cd5e..5a9abb3ed95 100644 --- a/packages/google_sign_in/google_sign_in_web/example/integration_test/flexible_size_html_element_view_test_disabled.dart +++ b/packages/google_sign_in/google_sign_in_web/example/integration_test/flexible_size_html_element_view_test_disabled.dart @@ -29,7 +29,7 @@ void main() { testWidgets('empty case, calls onElementCreated', ( WidgetTester tester, ) async { - final Completer viewCreatedCompleter = Completer(); + final viewCreatedCompleter = Completer(); await pumpResizableWidget( tester, @@ -45,7 +45,7 @@ void main() { testWidgets('empty case, renders with initial size', ( WidgetTester tester, ) async { - const Size initialSize = Size(160, 100); + const initialSize = Size(160, 100); final Element element = await pumpResizableWidget( tester, @@ -61,9 +61,9 @@ void main() { testWidgets('initialSize null, adopts size of injected element', ( WidgetTester tester, ) async { - const Size childSize = Size(300, 40); + const childSize = Size(300, 40); - final web.HTMLDivElement resizable = + final resizable = web.document.createElement('div') as web.HTMLDivElement; resize(resizable, childSize); @@ -81,10 +81,10 @@ void main() { testWidgets('with initialSize, adopts size of injected element', ( WidgetTester tester, ) async { - const Size initialSize = Size(160, 100); - const Size newSize = Size(300, 40); + const initialSize = Size(160, 100); + const newSize = Size(300, 40); - final web.HTMLDivElement resizable = + final resizable = web.document.createElement('div') as web.HTMLDivElement; resize(resizable, newSize); @@ -103,11 +103,11 @@ void main() { testWidgets('with injected element that resizes, follows resizes', ( WidgetTester tester, ) async { - const Size initialSize = Size(160, 100); + const initialSize = Size(160, 100); final Size expandedSize = initialSize * 2; final Size contractedSize = initialSize / 2; - final web.HTMLDivElement resizable = + final resizable = web.document.createElement('div') as web.HTMLDivElement..setAttribute( 'style', 'width: 100%; height: 100%; background: #fabada;', @@ -178,7 +178,7 @@ class ResizableFromJs extends StatelessWidget { ui_web.platformViewRegistry.registerViewFactory( 'resizable_from_js_$instanceId', (int viewId) { - final web.HTMLDivElement element = + final element = web.document.createElement('div') as web.HTMLDivElement; element.setAttribute( 'style', diff --git a/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart b/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart index 5eefbdc759b..aa5356aa42d 100644 --- a/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart +++ b/packages/google_sign_in/google_sign_in_web/example/integration_test/google_sign_in_web_test.dart @@ -26,24 +26,24 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('Constructor', () { - const String expectedClientId = '3xp3c73d_c113n7_1d'; + const expectedClientId = '3xp3c73d_c113n7_1d'; testWidgets('Loads clientId when set in a meta', (_) async { - final GoogleSignInPlugin plugin = GoogleSignInPlugin( + final plugin = GoogleSignInPlugin( debugOverrideLoader: true, ); expect(plugin.autoDetectedClientId, isNull); // Add it to the test page now, and try again - final web.HTMLMetaElement meta = + final meta = web.document.createElement('meta') as web.HTMLMetaElement ..name = clientIdMetaName ..content = expectedClientId; web.document.head!.appendChild(meta); - final GoogleSignInPlugin another = GoogleSignInPlugin( + final another = GoogleSignInPlugin( debugOverrideLoader: true, ); @@ -123,7 +123,7 @@ void main() { group('support queries', () { testWidgets('reports lack of support for authenticate', (_) async { - final GoogleSignInPlugin plugin = GoogleSignInPlugin( + final plugin = GoogleSignInPlugin( debugOverrideLoader: true, ); @@ -133,7 +133,7 @@ void main() { testWidgets('reports requirement for user interaction to authorize', ( _, ) async { - final GoogleSignInPlugin plugin = GoogleSignInPlugin( + final plugin = GoogleSignInPlugin( debugOverrideLoader: true, ); @@ -144,7 +144,7 @@ void main() { group('(with mocked GIS)', () { late GoogleSignInPlugin plugin; late MockGisSdkClient mockGis; - const InitParameters options = InitParameters( + const options = InitParameters( clientId: 'some-non-null-client-id', ); @@ -182,8 +182,8 @@ void main() { }); group('clientAuthorizationTokensForScopes', () { - const String someAccessToken = '50m3_4cc35_70k3n'; - const List scopes = ['scope1', 'scope2']; + const someAccessToken = '50m3_4cc35_70k3n'; + const scopes = ['scope1', 'scope2']; setUp(() { plugin.init(options); @@ -232,7 +232,7 @@ void main() { }); testWidgets('passes expected values to requestScopes', (_) async { - const String someUserId = 'someUser'; + const someUserId = 'someUser'; mockito .when( mockGis.requestScopes( @@ -292,8 +292,8 @@ void main() { }); group('serverAuthorizationTokensForScopes', () { - const String someAuthCode = 'abc123'; - const List scopes = ['scope1', 'scope2']; + const someAuthCode = 'abc123'; + const scopes = ['scope1', 'scope2']; setUp(() { plugin.init(options); @@ -304,7 +304,7 @@ void main() { .when(mockGis.requestServerAuthCode(mockito.any)) .thenAnswer((_) => Future.value(someAuthCode)); - const AuthorizationRequestDetails request = AuthorizationRequestDetails( + const request = AuthorizationRequestDetails( scopes: scopes, userId: null, email: null, @@ -323,7 +323,7 @@ void main() { expect(token?.serverAuthCode, someAuthCode); - final AuthorizationRequestDetails passedRequest = + final passedRequest = arguments.first! as AuthorizationRequestDetails; expect(passedRequest.scopes, request.scopes); expect(passedRequest.userId, request.userId); @@ -357,7 +357,7 @@ void main() { }); testWidgets('calls clearAuthorizationToken on GIS client', (_) async { - const String someToken = 'someToken'; + const someToken = 'someToken'; await plugin.clearAuthorizationToken( const ClearAuthorizationTokenParams(accessToken: someToken), ); @@ -372,7 +372,7 @@ void main() { }); group('userDataEvents', () { - final StreamController controller = + final controller = StreamController.broadcast(); late GoogleSignInPlugin plugin; diff --git a/packages/google_sign_in/google_sign_in_web/example/integration_test/utils_test.dart b/packages/google_sign_in/google_sign_in_web/example/integration_test/utils_test.dart index ad75b82dab0..5cd060b02a0 100644 --- a/packages/google_sign_in/google_sign_in_web/example/integration_test/utils_test.dart +++ b/packages/google_sign_in/google_sign_in_web/example/integration_test/utils_test.dart @@ -18,7 +18,7 @@ void main() { group('gisResponsesToAuthenticationEvent', () { testWidgets('happy case', (_) async { - final AuthenticationEventSignIn signIn = + final signIn = gisResponsesToAuthenticationEvent(goodCredential)! as AuthenticationEventSignIn; final GoogleSignInUserData data = signIn.user; @@ -31,7 +31,7 @@ void main() { }); testWidgets('happy case (minimal)', (_) async { - final AuthenticationEventSignIn signIn = + final signIn = gisResponsesToAuthenticationEvent(minimalCredential)! as AuthenticationEventSignIn; final GoogleSignInUserData data = signIn.user; @@ -188,7 +188,7 @@ void main() { }); testWidgets('Non base-64 payload -> null', (_) async { - const String payload = 'not-base-64-at-all'; + const payload = 'not-base-64-at-all'; final Map? data = decodeJwtPayload(payload); diff --git a/packages/google_sign_in/google_sign_in_web/example/lib/src/button_configuration_column.dart b/packages/google_sign_in/google_sign_in_web/example/lib/src/button_configuration_column.dart index b6a87a467ed..3d949f101ec 100644 --- a/packages/google_sign_in/google_sign_in_web/example/lib/src/button_configuration_column.dart +++ b/packages/google_sign_in/google_sign_in_web/example/lib/src/button_configuration_column.dart @@ -89,7 +89,7 @@ Widget renderWebButtonConfiguration( GSIButtonConfiguration? currentConfig, { OnWebConfigChangeFn? onChange, }) { - final ScrollController scrollController = ScrollController(); + final scrollController = ScrollController(); return Scrollbar( controller: scrollController, thumbVisibility: true, diff --git a/packages/google_sign_in/google_sign_in_web/lib/src/flexible_size_html_element_view.dart b/packages/google_sign_in/google_sign_in_web/lib/src/flexible_size_html_element_view.dart index af74af8d812..05a57f6dffc 100644 --- a/packages/google_sign_in/google_sign_in_web/lib/src/flexible_size_html_element_view.dart +++ b/packages/google_sign_in/google_sign_in_web/lib/src/flexible_size_html_element_view.dart @@ -121,7 +121,7 @@ class _FlexHtmlElementView extends State { viewType: widget.viewType, onPlatformViewCreated: (int viewId) { final ElementCreatedCallback? callback = widget.onElementCreated; - final web.Element root = + final root = ui_web.platformViewRegistry.getViewById(viewId) as web.Element; _registerListeners(root); if (callback != null) { diff --git a/packages/google_sign_in/google_sign_in_web/lib/src/gis_client.dart b/packages/google_sign_in/google_sign_in_web/lib/src/gis_client.dart index c7787eddd71..2369415689b 100644 --- a/packages/google_sign_in/google_sign_in_web/lib/src/gis_client.dart +++ b/packages/google_sign_in/google_sign_in_web/lib/src/gis_client.dart @@ -96,7 +96,7 @@ class GisSdkClient { bool? useFedCM, }) { // Initialize `id` for the silent-sign in code. - final IdConfiguration idConfig = IdConfiguration( + final idConfig = IdConfiguration( client_id: clientId, callback: onResponse, cancel_on_tap_outside: false, @@ -131,7 +131,7 @@ class GisSdkClient { required ErrorCallbackFn onError, }) { // Create a Token Client for authorization calls. - final TokenClientConfig tokenConfig = TokenClientConfig( + final tokenConfig = TokenClientConfig( prompt: userHint == null ? '' : 'select_account', client_id: clientId, login_hint: userHint, @@ -151,7 +151,7 @@ class GisSdkClient { required ErrorCallbackFn onError, }) { // Create a Token Client for authorization calls. - final CodeClientConfig codeConfig = CodeClientConfig( + final codeConfig = CodeClientConfig( client_id: _clientId, login_hint: userHint, hd: _hostedDomain, @@ -229,7 +229,7 @@ class GisSdkClient { Future requestServerAuthCode( AuthorizationRequestDetails request, ) async { - final Completer<(String? code, Exception? e)> completer = + final completer = Completer<(String? code, Exception? e)>(); final CodeClient codeClient = _initializeCodeClient( userHint: request.userId, @@ -311,7 +311,7 @@ class GisSdkClient { return null; } - final Completer<(String? token, Exception? e)> completer = + final completer = Completer<(String? token, Exception? e)>(); final TokenClient tokenClient = _initializeTokenClient( _clientId, diff --git a/packages/image_picker/image_picker/example/lib/main.dart b/packages/image_picker/image_picker/example/lib/main.dart index 8ea29057129..c49b3c12101 100755 --- a/packages/image_picker/image_picker/example/lib/main.dart +++ b/packages/image_picker/image_picker/example/lib/main.dart @@ -73,7 +73,7 @@ class _MyHomePageState extends State { // Mute the video so it auto-plays in web! // This is not needed if the call to .play is the result of user // interaction (clicking on a "play" button, for example). - const double volume = kIsWeb ? 0.0 : 1.0; + const volume = kIsWeb ? 0.0 : 1.0; await controller.setVolume(volume); await controller.initialize(); await controller.setLooping(true); @@ -143,7 +143,7 @@ class _MyHomePageState extends State { int? limit, ) async { try { - final List pickedFileList = []; + final pickedFileList = []; final XFile? media = await _picker.pickMedia( maxWidth: maxWidth, maxHeight: maxHeight, @@ -286,10 +286,10 @@ class _MyHomePageState extends State { } Widget _buildInlineVideoPlayer(int index) { - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File(_mediaFileList![index].path), ); - const double volume = kIsWeb ? 0.0 : 1.0; + const volume = kIsWeb ? 0.0 : 1.0; controller.setVolume(volume); controller.initialize(); controller.setLooping(true); @@ -492,7 +492,7 @@ class _MyHomePageState extends State { Text? _getRetrieveErrorWidget() { if (_retrieveDataError != null) { - final Text result = Text(_retrieveDataError!); + final result = Text(_retrieveDataError!); _retrieveDataError = null; return result; } diff --git a/packages/image_picker/image_picker/example/lib/readme_excerpts.dart b/packages/image_picker/image_picker/example/lib/readme_excerpts.dart index ff02f8da369..8f52ca53155 100644 --- a/packages/image_picker/image_picker/example/lib/readme_excerpts.dart +++ b/packages/image_picker/image_picker/example/lib/readme_excerpts.dart @@ -32,7 +32,7 @@ class MyCameraDelegate extends ImagePickerCameraDelegate { /// Example function for README demonstration of various pick* calls. Future> readmePickExample() async { // #docregion Pick - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); // Pick an image. final XFile? image = await picker.pickImage(source: ImageSource.gallery); // Capture a photo. @@ -66,7 +66,7 @@ Future> readmePickExample() async { /// Example function for README demonstration of getting lost data. // #docregion LostData Future getLostData() async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); final LostDataResponse response = await picker.retrieveLostData(); if (response.isEmpty) { return; diff --git a/packages/image_picker/image_picker/lib/image_picker.dart b/packages/image_picker/image_picker/lib/image_picker.dart index 0294b4b8b8d..be411a86ee8 100755 --- a/packages/image_picker/image_picker/lib/image_picker.dart +++ b/packages/image_picker/image_picker/lib/image_picker.dart @@ -77,7 +77,7 @@ class ImagePicker { CameraDevice preferredCameraDevice = CameraDevice.rear, bool requestFullMetadata = true, }) { - final ImagePickerOptions imagePickerOptions = + final imagePickerOptions = ImagePickerOptions.createAndValidate( maxWidth: maxWidth, maxHeight: maxHeight, @@ -134,7 +134,7 @@ class ImagePicker { int? limit, bool requestFullMetadata = true, }) { - final ImageOptions imageOptions = ImageOptions.createAndValidate( + final imageOptions = ImageOptions.createAndValidate( maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: imageQuality, diff --git a/packages/image_picker/image_picker/test/image_picker_test.dart b/packages/image_picker/image_picker/test/image_picker_test.dart index 15bb59bbdbb..6230481169f 100644 --- a/packages/image_picker/image_picker/test/image_picker_test.dart +++ b/packages/image_picker/image_picker/test/image_picker_test.dart @@ -41,7 +41,7 @@ void main() { }); test('passes the image source argument correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickImage(source: ImageSource.camera); await picker.pickImage(source: ImageSource.gallery); @@ -64,7 +64,7 @@ void main() { }); test('passes the width and height arguments correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickImage(source: ImageSource.camera); await picker.pickImage(source: ImageSource.camera, maxWidth: 10.0); await picker.pickImage(source: ImageSource.camera, maxHeight: 10.0); @@ -249,7 +249,7 @@ void main() { }); test('does not accept a negative width or height argument', () { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); expect( () => picker.pickImage(source: ImageSource.camera, maxWidth: -1.0), throwsArgumentError, @@ -262,14 +262,14 @@ void main() { }); test('handles a null image file response gracefully', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); expect(await picker.pickImage(source: ImageSource.gallery), isNull); expect(await picker.pickImage(source: ImageSource.camera), isNull); }); test('camera position defaults to back', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickImage(source: ImageSource.camera); verify( @@ -288,7 +288,7 @@ void main() { }); test('camera position can set to front', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickImage( source: ImageSource.camera, preferredCameraDevice: CameraDevice.front, @@ -310,7 +310,7 @@ void main() { }); test('full metadata argument defaults to true', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickImage(source: ImageSource.gallery); verify( @@ -329,7 +329,7 @@ void main() { }); test('passes the full metadata argument correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickImage( source: ImageSource.gallery, requestFullMetadata: false, @@ -363,7 +363,7 @@ void main() { }); test('passes the image source argument correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickVideo(source: ImageSource.camera); await picker.pickVideo(source: ImageSource.gallery); @@ -374,7 +374,7 @@ void main() { }); test('passes the duration argument correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickVideo(source: ImageSource.camera); await picker.pickVideo( source: ImageSource.camera, @@ -391,21 +391,21 @@ void main() { }); test('handles a null video file response gracefully', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); expect(await picker.pickVideo(source: ImageSource.gallery), isNull); expect(await picker.pickVideo(source: ImageSource.camera), isNull); }); test('camera position defaults to back', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickVideo(source: ImageSource.camera); verify(mockPlatform.getVideo(source: ImageSource.camera)); }); test('camera position can set to front', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickVideo( source: ImageSource.camera, preferredCameraDevice: CameraDevice.front, @@ -422,8 +422,8 @@ void main() { group('#retrieveLostData', () { test('retrieveLostData get success response', () async { - final ImagePicker picker = ImagePicker(); - final XFile lostFile = XFile('/example/path'); + final picker = ImagePicker(); + final lostFile = XFile('/example/path'); when(mockPlatform.getLostData()).thenAnswer( (Invocation _) async => LostDataResponse( file: lostFile, @@ -441,8 +441,8 @@ void main() { test( 'retrieveLostData should successfully retrieve multiple files', () async { - final ImagePicker picker = ImagePicker(); - final List lostFiles = [ + final picker = ImagePicker(); + final lostFiles = [ XFile('/example/path0'), XFile('/example/path1'), ]; @@ -465,7 +465,7 @@ void main() { ); test('retrieveLostData get error response', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); when(mockPlatform.getLostData()).thenAnswer( (Invocation _) async => LostDataResponse( exception: PlatformException( @@ -492,7 +492,7 @@ void main() { }); test('passes the arguments correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickMultiVideo(); await picker.pickMultiVideo(maxDuration: const Duration(seconds: 10)); await picker.pickMultiVideo(limit: 5); @@ -538,7 +538,7 @@ void main() { group('#pickMultiImage', () { test('passes the width and height arguments correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickMultiImage(); await picker.pickMultiImage(maxWidth: 10.0); await picker.pickMultiImage(maxHeight: 10.0); @@ -697,7 +697,7 @@ void main() { }); test('does not accept a negative width or height argument', () { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); expect( () => picker.pickMultiImage(maxWidth: -1.0), throwsArgumentError, @@ -710,7 +710,7 @@ void main() { }); test('does not accept a limit argument lower than 2', () { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); expect(() => picker.pickMultiImage(limit: -1), throwsArgumentError); expect(() => picker.pickMultiImage(limit: 0), throwsArgumentError); @@ -719,14 +719,14 @@ void main() { }); test('handles an empty image file response gracefully', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); expect(await picker.pickMultiImage(), isEmpty); expect(await picker.pickMultiImage(), isEmpty); }); test('full metadata argument defaults to true', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickMultiImage(); verify( @@ -745,7 +745,7 @@ void main() { }); test('passes the full metadata argument correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickMultiImage(requestFullMetadata: false); verify( @@ -774,7 +774,7 @@ void main() { group('#pickMedia', () { test('passes the width and height arguments correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickMedia(); await picker.pickMedia(maxWidth: 10.0); await picker.pickMedia(maxHeight: 10.0); @@ -892,21 +892,21 @@ void main() { }); test('does not accept a negative width or height argument', () { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); expect(() => picker.pickMedia(maxWidth: -1.0), throwsArgumentError); expect(() => picker.pickMedia(maxHeight: -1.0), throwsArgumentError); }); test('handles an empty image file response gracefully', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); expect(await picker.pickMedia(), isNull); expect(await picker.pickMedia(), isNull); }); test('full metadata argument defaults to true', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickMedia(); verify( @@ -925,7 +925,7 @@ void main() { }); test('passes the full metadata argument correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickMedia(requestFullMetadata: false); verify( @@ -946,7 +946,7 @@ void main() { group('#pickMultipleMedia', () { test('passes the width and height arguments correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickMultipleMedia(); await picker.pickMultipleMedia(maxWidth: 10.0); await picker.pickMultipleMedia(maxHeight: 10.0); @@ -1092,7 +1092,7 @@ void main() { }); test('does not accept a negative width or height argument', () { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); expect( () => picker.pickMultipleMedia(maxWidth: -1.0), throwsArgumentError, @@ -1105,7 +1105,7 @@ void main() { }); test('does not accept a limit argument lower than 2', () { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); expect( () => picker.pickMultipleMedia(limit: -1), throwsArgumentError, @@ -1117,14 +1117,14 @@ void main() { }); test('handles an empty image file response gracefully', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); expect(await picker.pickMultipleMedia(), isEmpty); expect(await picker.pickMultipleMedia(), isEmpty); }); test('full metadata argument defaults to true', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickMultipleMedia(); verify( @@ -1143,7 +1143,7 @@ void main() { }); test('passes the full metadata argument correctly', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); await picker.pickMultipleMedia(requestFullMetadata: false); verify( @@ -1162,7 +1162,7 @@ void main() { }); }); test('supportsImageSource calls through to platform', () async { - final ImagePicker picker = ImagePicker(); + final picker = ImagePicker(); when(mockPlatform.supportsImageSource(any)).thenReturn(true); final bool supported = picker.supportsImageSource(ImageSource.camera); diff --git a/packages/image_picker/image_picker_android/example/lib/main.dart b/packages/image_picker/image_picker_android/example/lib/main.dart index 400d62a7fa2..8baf3bf9d30 100755 --- a/packages/image_picker/image_picker_android/example/lib/main.dart +++ b/packages/image_picker/image_picker_android/example/lib/main.dart @@ -79,7 +79,7 @@ class _MyHomePageState extends State { Future _playVideo(XFile? file) async { if (file != null && mounted) { await _disposeVideoController(); - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File(file.path), ); _controller = controller; @@ -125,7 +125,7 @@ class _MyHomePageState extends State { int? limit, ) async { try { - final ImageOptions imageOptions = ImageOptions( + final imageOptions = ImageOptions( maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: quality, @@ -164,7 +164,7 @@ class _MyHomePageState extends State { int? limit, ) async { try { - final List pickedFileList = []; + final pickedFileList = []; final XFile? media = _firstOrNull( await _picker.getMedia( options: MediaOptions( @@ -319,7 +319,7 @@ class _MyHomePageState extends State { } Widget _buildInlineVideoPlayer(int index) { - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File(_mediaFileList![index].path), ); controller.setVolume(1.0); @@ -532,7 +532,7 @@ class _MyHomePageState extends State { Text? _getRetrieveErrorWidget() { if (_retrieveDataError != null) { - final Text result = Text(_retrieveDataError!); + final result = Text(_retrieveDataError!); _retrieveDataError = null; return result; } diff --git a/packages/image_picker/image_picker_android/test/image_picker_android_test.dart b/packages/image_picker/image_picker_android/test/image_picker_android_test.dart index 53a8a09c01b..891764af5d3 100644 --- a/packages/image_picker/image_picker_android/test/image_picker_android_test.dart +++ b/packages/image_picker/image_picker_android/test/image_picker_android_test.dart @@ -25,7 +25,7 @@ void main() { group('#pickImage', () { test('calls the method correctly', () async { - const String fakePath = '/foo.jpg'; + const fakePath = '/foo.jpg'; api.returnValue = [fakePath]; final PickedFile? result = await picker.pickImage( source: ImageSource.camera, @@ -141,7 +141,7 @@ void main() { group('#pickMultiImage', () { test('calls the method correctly', () async { - const List fakePaths = ['/foo.jgp', 'bar.jpg']; + const fakePaths = ['/foo.jgp', 'bar.jpg']; api.returnValue = fakePaths; final List? files = await picker.pickMultiImage(); @@ -214,7 +214,7 @@ void main() { group('#pickVideo', () { test('calls the method correctly', () async { - const String fakePath = '/foo.jpg'; + const fakePath = '/foo.jpg'; api.returnValue = [fakePath]; final PickedFile? result = await picker.pickVideo( source: ImageSource.camera, @@ -341,7 +341,7 @@ void main() { group('#getImage', () { test('calls the method correctly', () async { - const String fakePath = '/foo.jpg'; + const fakePath = '/foo.jpg'; api.returnValue = [fakePath]; final XFile? result = await picker.getImage(source: ImageSource.camera); @@ -455,7 +455,7 @@ void main() { group('#getMultiImage', () { test('calls the method correctly', () async { - const List fakePaths = ['/foo.jgp', 'bar.jpg']; + const fakePaths = ['/foo.jgp', 'bar.jpg']; api.returnValue = fakePaths; final List? files = await picker.getMultiImage(); @@ -526,7 +526,7 @@ void main() { group('#getVideo', () { test('calls the method correctly', () async { - const String fakePath = '/foo.jpg'; + const fakePath = '/foo.jpg'; api.returnValue = [fakePath]; final XFile? result = await picker.getVideo(source: ImageSource.camera); @@ -601,7 +601,7 @@ void main() { group('#getMultiVideoWithOptions', () { test('calls the method correctly', () async { - const List fakePaths = ['/foo.mp4', 'bar.mp4']; + const fakePaths = ['/foo.mp4', 'bar.mp4']; api.returnValue = fakePaths; final List result = await picker.getMultiVideoWithOptions(); @@ -692,7 +692,7 @@ void main() { group('#getMedia', () { test('calls the method correctly', () async { - const List fakePaths = ['/foo.jgp', 'bar.jpg']; + const fakePaths = ['/foo.jgp', 'bar.jpg']; api.returnValue = fakePaths; final List files = await picker.getMedia( @@ -844,7 +844,7 @@ void main() { group('#getImageFromSource', () { test('calls the method correctly', () async { - const String fakePath = '/foo.jpg'; + const fakePath = '/foo.jpg'; api.returnValue = [fakePath]; final XFile? result = await picker.getImage(source: ImageSource.camera); diff --git a/packages/image_picker/image_picker_for_web/example/integration_test/image_picker_for_web_test.dart b/packages/image_picker/image_picker_for_web/example/integration_test/image_picker_for_web_test.dart index 03b98675ccf..71e1653577b 100644 --- a/packages/image_picker/image_picker_for_web/example/integration_test/image_picker_for_web_test.dart +++ b/packages/image_picker/image_picker_for_web/example/integration_test/image_picker_for_web_test.dart @@ -43,14 +43,14 @@ void main() { }); testWidgets('getImageFromSource can select a file', (WidgetTester _) async { - final web.HTMLInputElement mockInput = web.HTMLInputElement() + final mockInput = web.HTMLInputElement() ..type = 'file'; - final ImagePickerPluginTestOverrides overrides = + final overrides = ImagePickerPluginTestOverrides() ..createInputElement = ((_, __) => mockInput) ..getMultipleFilesFromInput = ((_) => [textFile]); - final ImagePickerPlugin plugin = ImagePickerPlugin(overrides: overrides); + final plugin = ImagePickerPlugin(overrides: overrides); // Init the pick file dialog... final Future image = plugin.getImageFromSource( @@ -88,10 +88,10 @@ void main() { testWidgets('getMultiImageWithOptions can select multiple files', ( WidgetTester _, ) async { - final web.HTMLInputElement mockInput = web.HTMLInputElement() + final mockInput = web.HTMLInputElement() ..type = 'file'; - final ImagePickerPluginTestOverrides overrides = + final overrides = ImagePickerPluginTestOverrides() ..createInputElement = ((_, __) => mockInput) ..getMultipleFilesFromInput = ((_) => [ @@ -99,7 +99,7 @@ void main() { secondTextFile, ]); - final ImagePickerPlugin plugin = ImagePickerPlugin(overrides: overrides); + final plugin = ImagePickerPlugin(overrides: overrides); // Init the pick file dialog... final Future> files = plugin.getMultiImageWithOptions(); @@ -121,10 +121,10 @@ void main() { }); testWidgets('getMedia can select multiple files', (WidgetTester _) async { - final web.HTMLInputElement mockInput = web.HTMLInputElement() + final mockInput = web.HTMLInputElement() ..type = 'file'; - final ImagePickerPluginTestOverrides overrides = + final overrides = ImagePickerPluginTestOverrides() ..createInputElement = ((_, __) => mockInput) ..getMultipleFilesFromInput = ((_) => [ @@ -132,7 +132,7 @@ void main() { secondTextFile, ]); - final ImagePickerPlugin plugin = ImagePickerPlugin(overrides: overrides); + final plugin = ImagePickerPlugin(overrides: overrides); // Init the pick file dialog... final Future> files = plugin.getMedia( @@ -158,10 +158,10 @@ void main() { testWidgets('getMultiVideoWithOptions can select multiple files', ( WidgetTester _, ) async { - final web.HTMLInputElement mockInput = web.HTMLInputElement() + final mockInput = web.HTMLInputElement() ..type = 'file'; - final ImagePickerPluginTestOverrides overrides = + final overrides = ImagePickerPluginTestOverrides() ..createInputElement = ((_, __) => mockInput) ..getMultipleFilesFromInput = ((_) => [ @@ -169,7 +169,7 @@ void main() { secondTextFile, ]); - final ImagePickerPlugin plugin = ImagePickerPlugin(overrides: overrides); + final plugin = ImagePickerPlugin(overrides: overrides); // Init the pick file dialog... final Future> files = plugin.getMultiVideoWithOptions(); diff --git a/packages/image_picker/image_picker_for_web/example/integration_test/image_resizer_test.dart b/packages/image_picker/image_picker_for_web/example/integration_test/image_resizer_test.dart index 91eac719069..95d36b44c5c 100644 --- a/packages/image_picker/image_picker_for_web/example/integration_test/image_resizer_test.dart +++ b/packages/image_picker/image_picker_for_web/example/integration_test/image_resizer_test.dart @@ -158,8 +158,8 @@ void main() { } Future _getImageSize(XFile file) async { - final Completer completer = Completer(); - final web.HTMLImageElement image = web.HTMLImageElement(); + final completer = Completer(); + final image = web.HTMLImageElement(); image ..onLoad.listen((web.Event event) { completer.complete(Size(image.width.toDouble(), image.height.toDouble())); @@ -175,7 +175,7 @@ web.Blob _base64ToBlob(String data) { final List arr = data.split(','); final String bstr = web.window.atob(arr[1]); int n = bstr.length; - final Uint8List u8arr = Uint8List(n); + final u8arr = Uint8List(n); while (n >= 1) { u8arr[n - 1] = bstr.codeUnitAt(n - 1); diff --git a/packages/image_picker/image_picker_for_web/example/integration_test/readme_excerpts_test.dart b/packages/image_picker/image_picker_for_web/example/integration_test/readme_excerpts_test.dart index bdc9cad65a9..e76dc04ec23 100644 --- a/packages/image_picker/image_picker_for_web/example/integration_test/readme_excerpts_test.dart +++ b/packages/image_picker/image_picker_for_web/example/integration_test/readme_excerpts_test.dart @@ -46,7 +46,7 @@ void main() { /// Creates an XFile with a 1x1 png file. XFile createXFileWeb() { - const String pixel = + const pixel = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR' '42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII='; final Uint8List data = base64Decode(pixel); diff --git a/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart b/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart index 35f82fde4e2..117c68774e2 100644 --- a/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart +++ b/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart @@ -254,13 +254,13 @@ class ImagePickerPlugin extends ImagePickerPlatform { /// Handles the OnChange event from a FileUploadInputElement object /// Returns a list of selected files. List? _handleOnChangeEvent(web.Event event) { - final web.HTMLInputElement? input = event.target as web.HTMLInputElement?; + final input = event.target as web.HTMLInputElement?; return input == null ? null : _getFilesFromInput(input); } /// Monitors an and returns the selected file(s). Future> _getSelectedXFiles(web.HTMLInputElement input) { - final Completer> completer = Completer>(); + final completer = Completer>(); // TODO(dit): Migrate all this to Streams (onChange, onError, onCancel) when onCancel is available. // See: https://github.com/dart-lang/web/issues/199 // Observe the input until we can return something @@ -324,7 +324,7 @@ class ImagePickerPlugin extends ImagePickerPlatform { return _overrides!.createInputElement(accept, capture); } - final web.HTMLInputElement element = web.HTMLInputElement() + final element = web.HTMLInputElement() ..type = 'file' ..multiple = multiple; diff --git a/packages/image_picker/image_picker_for_web/lib/src/image_resizer.dart b/packages/image_picker/image_picker_for_web/lib/src/image_resizer.dart index bf30deca3b2..3414a869298 100644 --- a/packages/image_picker/image_picker_for_web/lib/src/image_resizer.dart +++ b/packages/image_picker/image_picker_for_web/lib/src/image_resizer.dart @@ -49,16 +49,16 @@ class ImageResizer { /// Loads the `blobUrl` into a [web.HTMLImageElement]. Future loadImage(String blobUrl) { - final Completer imageLoadCompleter = + final imageLoadCompleter = Completer(); - final web.HTMLImageElement imageElement = web.HTMLImageElement(); + final imageElement = web.HTMLImageElement(); imageElement ..src = blobUrl ..onLoad.listen((web.Event event) { imageLoadCompleter.complete(imageElement); }) ..onError.listen((web.Event event) { - const String exception = 'Error while loading image.'; + const exception = 'Error while loading image.'; imageElement.remove(); imageLoadCompleter.completeError(exception); }); @@ -76,7 +76,7 @@ class ImageResizer { maxWidth, maxHeight, ); - final web.HTMLCanvasElement canvas = web.HTMLCanvasElement() + final canvas = web.HTMLCanvasElement() ..width = newImageSize.width.toInt() ..height = newImageSize.height.toInt(); final web.CanvasRenderingContext2D context = canvas.context2D; @@ -104,7 +104,7 @@ class ImageResizer { ) async { final double calculatedImageQuality = (min(imageQuality ?? 100, 100)) / 100.0; - final Completer completer = Completer(); + final completer = Completer(); final web.BlobCallback blobCallback = (web.Blob blob) { completer.complete( XFile( diff --git a/packages/image_picker/image_picker_for_web/test/image_resizer_utils_test.dart b/packages/image_picker/image_picker_for_web/test/image_resizer_utils_test.dart index 613b005ab6f..59dfefdf324 100644 --- a/packages/image_picker/image_picker_for_web/test/image_resizer_utils_test.dart +++ b/packages/image_picker/image_picker_for_web/test/image_resizer_utils_test.dart @@ -30,8 +30,8 @@ void main() { ); test('image size is scaled when maxWidth is set', () { - const Size imageSize = Size(500, 300); - const int maxWidth = 400; + const imageSize = Size(500, 300); + const maxWidth = 400; final Size scaledSize = calculateSizeOfDownScaledImage( Size(imageSize.width, imageSize.height), maxWidth.toDouble(), @@ -42,8 +42,8 @@ void main() { }); test('image size is scaled when maxHeight is set', () { - const Size imageSize = Size(500, 300); - const int maxHeight = 400; + const imageSize = Size(500, 300); + const maxHeight = 400; final Size scaledSize = calculateSizeOfDownScaledImage( Size(imageSize.width, imageSize.height), null, @@ -54,9 +54,9 @@ void main() { }); test('image size is scaled when both maxWidth and maxHeight is set', () { - const Size imageSize = Size(1120, 2000); - const int maxHeight = 1200; - const int maxWidth = 99; + const imageSize = Size(1120, 2000); + const maxHeight = 1200; + const maxWidth = 99; final Size scaledSize = calculateSizeOfDownScaledImage( Size(imageSize.width, imageSize.height), maxWidth.toDouble(), diff --git a/packages/image_picker/image_picker_ios/example/lib/main.dart b/packages/image_picker/image_picker_ios/example/lib/main.dart index 1db84163bab..2552e716747 100755 --- a/packages/image_picker/image_picker_ios/example/lib/main.dart +++ b/packages/image_picker/image_picker_ios/example/lib/main.dart @@ -60,7 +60,7 @@ class _MyHomePageState extends State { Future _playVideo(XFile? file) async { if (file != null && mounted) { await _disposeVideoController(); - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File(file.path), ); _controller = controller; @@ -106,7 +106,7 @@ class _MyHomePageState extends State { int? limit, ) async { try { - final ImageOptions imageOptions = ImageOptions( + final imageOptions = ImageOptions( maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: quality, @@ -145,7 +145,7 @@ class _MyHomePageState extends State { int? limit, ) async { try { - final List pickedFileList = []; + final pickedFileList = []; final XFile? media = _firstOrNull( await _picker.getMedia( options: MediaOptions( @@ -289,7 +289,7 @@ class _MyHomePageState extends State { } Widget _buildInlineVideoPlayer(int index) { - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File(_mediaFileList![index].path), ); controller.setVolume(1.0); @@ -447,7 +447,7 @@ class _MyHomePageState extends State { Text? _getRetrieveErrorWidget() { if (_retrieveDataError != null) { - final Text result = Text(_retrieveDataError!); + final result = Text(_retrieveDataError!); _retrieveDataError = null; return result; } diff --git a/packages/image_picker/image_picker_linux/example/lib/main.dart b/packages/image_picker/image_picker_linux/example/lib/main.dart index c78e1ba0eb9..3b08f2fc45a 100644 --- a/packages/image_picker/image_picker_linux/example/lib/main.dart +++ b/packages/image_picker/image_picker_linux/example/lib/main.dart @@ -60,7 +60,7 @@ class _MyHomePageState extends State { Future _playVideo(XFile? file) async { if (file != null && mounted) { await _disposeVideoController(); - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File(file.path), ); _controller = controller; @@ -105,7 +105,7 @@ class _MyHomePageState extends State { int? quality, ) async { try { - final ImageOptions imageOptions = ImageOptions( + final imageOptions = ImageOptions( maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: quality, @@ -141,7 +141,7 @@ class _MyHomePageState extends State { int? quality, ) async { try { - final List pickedFileList = []; + final pickedFileList = []; final XFile? media = _firstOrNull( await _picker.getMedia( options: MediaOptions( @@ -295,7 +295,7 @@ class _MyHomePageState extends State { } Widget _buildInlineVideoPlayer(int index) { - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File(_mediaFileList![index].path), ); controller.setVolume(1.0); @@ -455,7 +455,7 @@ class _MyHomePageState extends State { Text? _getRetrieveErrorWidget() { if (_retrieveDataError != null) { - final Text result = Text(_retrieveDataError!); + final result = Text(_retrieveDataError!); _retrieveDataError = null; return result; } diff --git a/packages/image_picker/image_picker_linux/lib/image_picker_linux.dart b/packages/image_picker/image_picker_linux/lib/image_picker_linux.dart index 14f7f281f64..bd6c87fbaa7 100644 --- a/packages/image_picker/image_picker_linux/lib/image_picker_linux.dart +++ b/packages/image_picker/image_picker_linux/lib/image_picker_linux.dart @@ -103,7 +103,7 @@ class ImagePickerLinux extends CameraDelegatingImagePickerPlatform { case ImageSource.camera: return super.getImageFromSource(source: source); case ImageSource.gallery: - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'Images', mimeTypes: ['image/*'], ); @@ -137,7 +137,7 @@ class ImagePickerLinux extends CameraDelegatingImagePickerPlatform { maxDuration: maxDuration, ); case ImageSource.gallery: - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'Videos', mimeTypes: ['video/*'], ); @@ -160,7 +160,7 @@ class ImagePickerLinux extends CameraDelegatingImagePickerPlatform { double? maxHeight, int? imageQuality, }) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'Images', mimeTypes: ['image/*'], ); @@ -174,7 +174,7 @@ class ImagePickerLinux extends CameraDelegatingImagePickerPlatform { Future> getMultiVideoWithOptions({ MultiVideoPickerOptions options = const MultiVideoPickerOptions(), }) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'Videos', mimeTypes: ['video/*'], ); @@ -189,7 +189,7 @@ class ImagePickerLinux extends CameraDelegatingImagePickerPlatform { // ignored. @override Future> getMedia({required MediaOptions options}) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'Images and videos', mimeTypes: ['image/*', 'video/*'], ); diff --git a/packages/image_picker/image_picker_linux/test/image_picker_linux_test.dart b/packages/image_picker/image_picker_linux/test/image_picker_linux_test.dart index 5f397a3a17a..0d8207545f6 100644 --- a/packages/image_picker/image_picker_linux/test/image_picker_linux_test.dart +++ b/packages/image_picker/image_picker_linux/test/image_picker_linux_test.dart @@ -86,7 +86,7 @@ void main() { ); test('getImageFromSource calls delegate when source is camera', () async { - const String fakePath = '/tmp/foo'; + const fakePath = '/tmp/foo'; plugin.cameraDelegate = FakeCameraDelegate(result: XFile(fakePath)); expect( (await plugin.getImageFromSource(source: ImageSource.camera))!.path, @@ -140,7 +140,7 @@ void main() { }); test('getVideo calls delegate when source is camera', () async { - const String fakePath = '/tmp/foo'; + const fakePath = '/tmp/foo'; plugin.cameraDelegate = FakeCameraDelegate(result: XFile(fakePath)); expect( (await plugin.getVideo(source: ImageSource.camera))!.path, diff --git a/packages/image_picker/image_picker_macos/example/lib/main.dart b/packages/image_picker/image_picker_macos/example/lib/main.dart index c78e1ba0eb9..3b08f2fc45a 100644 --- a/packages/image_picker/image_picker_macos/example/lib/main.dart +++ b/packages/image_picker/image_picker_macos/example/lib/main.dart @@ -60,7 +60,7 @@ class _MyHomePageState extends State { Future _playVideo(XFile? file) async { if (file != null && mounted) { await _disposeVideoController(); - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File(file.path), ); _controller = controller; @@ -105,7 +105,7 @@ class _MyHomePageState extends State { int? quality, ) async { try { - final ImageOptions imageOptions = ImageOptions( + final imageOptions = ImageOptions( maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: quality, @@ -141,7 +141,7 @@ class _MyHomePageState extends State { int? quality, ) async { try { - final List pickedFileList = []; + final pickedFileList = []; final XFile? media = _firstOrNull( await _picker.getMedia( options: MediaOptions( @@ -295,7 +295,7 @@ class _MyHomePageState extends State { } Widget _buildInlineVideoPlayer(int index) { - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File(_mediaFileList![index].path), ); controller.setVolume(1.0); @@ -455,7 +455,7 @@ class _MyHomePageState extends State { Text? _getRetrieveErrorWidget() { if (_retrieveDataError != null) { - final Text result = Text(_retrieveDataError!); + final result = Text(_retrieveDataError!); _retrieveDataError = null; return result; } diff --git a/packages/image_picker/image_picker_macos/lib/image_picker_macos.dart b/packages/image_picker/image_picker_macos/lib/image_picker_macos.dart index 6fd17880e34..886b5cc9b87 100644 --- a/packages/image_picker/image_picker_macos/lib/image_picker_macos.dart +++ b/packages/image_picker/image_picker_macos/lib/image_picker_macos.dart @@ -104,7 +104,7 @@ class ImagePickerMacOS extends CameraDelegatingImagePickerPlatform { // TODO(stuartmorgan): Add a native implementation that can use // PHPickerViewController on macOS 13+, with this as a fallback for // older OS versions: https://github.com/flutter/flutter/issues/125829. - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( uniformTypeIdentifiers: ['public.image'], ); final XFile? file = await fileSelector.openFile( @@ -137,7 +137,7 @@ class ImagePickerMacOS extends CameraDelegatingImagePickerPlatform { maxDuration: maxDuration, ); case ImageSource.gallery: - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( uniformTypeIdentifiers: ['public.movie'], ); final XFile? file = await fileSelector.openFile( @@ -162,7 +162,7 @@ class ImagePickerMacOS extends CameraDelegatingImagePickerPlatform { // TODO(stuartmorgan): Add a native implementation that can use // PHPickerViewController on macOS 13+, with this as a fallback for // older OS versions: https://github.com/flutter/flutter/issues/125829. - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( uniformTypeIdentifiers: ['public.image'], ); final List files = await fileSelector.openFiles( @@ -178,7 +178,7 @@ class ImagePickerMacOS extends CameraDelegatingImagePickerPlatform { // TODO(stuartmorgan): Add a native implementation that can use // PHPickerViewController on macOS 13+, with this as a fallback for // older OS versions: https://github.com/flutter/flutter/issues/125829. - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( uniformTypeIdentifiers: ['public.movie'], ); final List files = await fileSelector.openFiles( @@ -192,7 +192,7 @@ class ImagePickerMacOS extends CameraDelegatingImagePickerPlatform { // ignored. @override Future> getMedia({required MediaOptions options}) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'images and videos', extensions: ['public.image', 'public.movie'], ); diff --git a/packages/image_picker/image_picker_macos/test/image_picker_macos_test.dart b/packages/image_picker/image_picker_macos/test/image_picker_macos_test.dart index 8b52054ed82..0cdae2a1107 100644 --- a/packages/image_picker/image_picker_macos/test/image_picker_macos_test.dart +++ b/packages/image_picker/image_picker_macos/test/image_picker_macos_test.dart @@ -92,7 +92,7 @@ void main() { ); test('getImageFromSource calls delegate when source is camera', () async { - const String fakePath = '/tmp/foo'; + const fakePath = '/tmp/foo'; plugin.cameraDelegate = FakeCameraDelegate(result: XFile(fakePath)); expect( (await plugin.getImageFromSource(source: ImageSource.camera))!.path, @@ -152,7 +152,7 @@ void main() { }); test('getVideo calls delegate when source is camera', () async { - const String fakePath = '/tmp/foo'; + const fakePath = '/tmp/foo'; plugin.cameraDelegate = FakeCameraDelegate(result: XFile(fakePath)); expect( (await plugin.getVideo(source: ImageSource.camera))!.path, diff --git a/packages/image_picker/image_picker_platform_interface/lib/src/method_channel/method_channel_image_picker.dart b/packages/image_picker/image_picker_platform_interface/lib/src/method_channel/method_channel_image_picker.dart index 311d7e47970..7ed9dc66df5 100644 --- a/packages/image_picker/image_picker_platform_interface/lib/src/method_channel/method_channel_image_picker.dart +++ b/packages/image_picker/image_picker_platform_interface/lib/src/method_channel/method_channel_image_picker.dart @@ -157,7 +157,7 @@ class MethodChannelImagePicker extends ImagePickerPlatform { assert(result.containsKey('path') != result.containsKey('errorCode')); - final String? type = result['type'] as String?; + final type = result['type'] as String?; assert(type == kTypeImage || type == kTypeVideo); RetrieveType? retrieveType; @@ -175,7 +175,7 @@ class MethodChannelImagePicker extends ImagePickerPlatform { ); } - final String? path = result['path'] as String?; + final path = result['path'] as String?; return LostData( file: path != null ? PickedFile(path) : null, @@ -258,7 +258,7 @@ class MethodChannelImagePicker extends ImagePickerPlatform { Future> getMedia({required MediaOptions options}) async { final ImageOptions imageOptions = options.imageOptions; - final Map args = { + final args = { 'maxImageWidth': imageOptions.maxWidth, 'maxImageHeight': imageOptions.maxHeight, 'imageQuality': imageOptions.imageQuality, @@ -303,7 +303,7 @@ class MethodChannelImagePicker extends ImagePickerPlatform { assert(result.containsKey('path') != result.containsKey('errorCode')); - final String? type = result['type'] as String?; + final type = result['type'] as String?; assert(type == kTypeImage || type == kTypeVideo || type == kTypeMedia); RetrieveType? retrieveType; @@ -324,7 +324,7 @@ class MethodChannelImagePicker extends ImagePickerPlatform { ); } - final String? path = result['path'] as String?; + final path = result['path'] as String?; final List? pathList = (result['pathList'] as List?) ?.cast(); diff --git a/packages/image_picker/image_picker_platform_interface/test/image_picker_platform_test.dart b/packages/image_picker/image_picker_platform_interface/test/image_picker_platform_test.dart index 1fd1fb68638..a5e419e96f8 100644 --- a/packages/image_picker/image_picker_platform_interface/test/image_picker_platform_test.dart +++ b/packages/image_picker/image_picker_platform_interface/test/image_picker_platform_test.dart @@ -19,7 +19,7 @@ void main() { test( 'supportsImageSource returns false for camera when there is no delegate', () async { - final FakeCameraDelegatingImagePickerPlatform implementation = + final implementation = FakeCameraDelegatingImagePickerPlatform(); expect(implementation.supportsImageSource(ImageSource.camera), false); @@ -29,7 +29,7 @@ void main() { test( 'supportsImageSource returns true for camera when there is a delegate', () async { - final FakeCameraDelegatingImagePickerPlatform implementation = + final implementation = FakeCameraDelegatingImagePickerPlatform(); implementation.cameraDelegate = FakeCameraDelegate(); @@ -40,7 +40,7 @@ void main() { test( 'getImageFromSource for camera throws if delegate is not set', () async { - final FakeCameraDelegatingImagePickerPlatform implementation = + final implementation = FakeCameraDelegatingImagePickerPlatform(); await expectLater( @@ -51,7 +51,7 @@ void main() { ); test('getVideo for camera throws if delegate is not set', () async { - final FakeCameraDelegatingImagePickerPlatform implementation = + final implementation = FakeCameraDelegatingImagePickerPlatform(); await expectLater( @@ -61,8 +61,8 @@ void main() { }); test('getImageFromSource for camera calls delegate if set', () async { - const String fakePath = '/tmp/foo'; - final FakeCameraDelegatingImagePickerPlatform implementation = + const fakePath = '/tmp/foo'; + final implementation = FakeCameraDelegatingImagePickerPlatform(); implementation.cameraDelegate = FakeCameraDelegate( result: XFile(fakePath), @@ -77,8 +77,8 @@ void main() { }); test('getVideo for camera calls delegate if set', () async { - const String fakePath = '/tmp/foo'; - final FakeCameraDelegatingImagePickerPlatform implementation = + const fakePath = '/tmp/foo'; + final implementation = FakeCameraDelegatingImagePickerPlatform(); implementation.cameraDelegate = FakeCameraDelegate( result: XFile(fakePath), @@ -93,7 +93,7 @@ void main() { test('Default implementation of getMultiVideoWithOptions should throw ' 'unimplemented error', () { - final FakeCameraDelegatingImagePickerPlatform implementation = + final implementation = FakeCameraDelegatingImagePickerPlatform(); expect( diff --git a/packages/image_picker/image_picker_platform_interface/test/method_channel_image_picker_test.dart b/packages/image_picker/image_picker_platform_interface/test/method_channel_image_picker_test.dart index b244e7d256e..3401dd0a6b7 100644 --- a/packages/image_picker/image_picker_platform_interface/test/method_channel_image_picker_test.dart +++ b/packages/image_picker/image_picker_platform_interface/test/method_channel_image_picker_test.dart @@ -11,9 +11,9 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); group('$MethodChannelImagePicker', () { - final MethodChannelImagePicker picker = MethodChannelImagePicker(); + final picker = MethodChannelImagePicker(); - final List log = []; + final log = []; dynamic returnValue = ''; setUp(() { diff --git a/packages/image_picker/image_picker_platform_interface/test/picked_file_html_test.dart b/packages/image_picker/image_picker_platform_interface/test/picked_file_html_test.dart index 4a7615c9a0b..a7d87fa0d07 100644 --- a/packages/image_picker/image_picker_platform_interface/test/picked_file_html_test.dart +++ b/packages/image_picker/image_picker_platform_interface/test/picked_file_html_test.dart @@ -23,7 +23,7 @@ final String textFileUrl = web.URL.createObjectURL(textFile); void main() { group('Create with an objectUrl', () { - final PickedFile pickedFile = PickedFile(textFileUrl); + final pickedFile = PickedFile(textFileUrl); test('Can be read as a string', () async { expect(await pickedFile.readAsString(), equals(expectedStringContents)); diff --git a/packages/image_picker/image_picker_platform_interface/test/picked_file_io_test.dart b/packages/image_picker/image_picker_platform_interface/test/picked_file_io_test.dart index 4e34850454e..1393d4912ef 100644 --- a/packages/image_picker/image_picker_platform_interface/test/picked_file_io_test.dart +++ b/packages/image_picker/image_picker_platform_interface/test/picked_file_io_test.dart @@ -23,7 +23,7 @@ final String textFilePath = textFile.path; void main() { group('Create with an objectUrl', () { - final PickedFile pickedFile = PickedFile(textFilePath); + final pickedFile = PickedFile(textFilePath); test('Can be read as a string', () async { expect(await pickedFile.readAsString(), equals(expectedStringContents)); diff --git a/packages/image_picker/image_picker_windows/example/lib/main.dart b/packages/image_picker/image_picker_windows/example/lib/main.dart index c78e1ba0eb9..3b08f2fc45a 100644 --- a/packages/image_picker/image_picker_windows/example/lib/main.dart +++ b/packages/image_picker/image_picker_windows/example/lib/main.dart @@ -60,7 +60,7 @@ class _MyHomePageState extends State { Future _playVideo(XFile? file) async { if (file != null && mounted) { await _disposeVideoController(); - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File(file.path), ); _controller = controller; @@ -105,7 +105,7 @@ class _MyHomePageState extends State { int? quality, ) async { try { - final ImageOptions imageOptions = ImageOptions( + final imageOptions = ImageOptions( maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: quality, @@ -141,7 +141,7 @@ class _MyHomePageState extends State { int? quality, ) async { try { - final List pickedFileList = []; + final pickedFileList = []; final XFile? media = _firstOrNull( await _picker.getMedia( options: MediaOptions( @@ -295,7 +295,7 @@ class _MyHomePageState extends State { } Widget _buildInlineVideoPlayer(int index) { - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File(_mediaFileList![index].path), ); controller.setVolume(1.0); @@ -455,7 +455,7 @@ class _MyHomePageState extends State { Text? _getRetrieveErrorWidget() { if (_retrieveDataError != null) { - final Text result = Text(_retrieveDataError!); + final result = Text(_retrieveDataError!); _retrieveDataError = null; return result; } diff --git a/packages/image_picker/image_picker_windows/lib/image_picker_windows.dart b/packages/image_picker/image_picker_windows/lib/image_picker_windows.dart index 99f033fae4f..ab1c3cab0d3 100644 --- a/packages/image_picker/image_picker_windows/lib/image_picker_windows.dart +++ b/packages/image_picker/image_picker_windows/lib/image_picker_windows.dart @@ -132,7 +132,7 @@ class ImagePickerWindows extends CameraDelegatingImagePickerPlatform { case ImageSource.camera: return super.getImageFromSource(source: source); case ImageSource.gallery: - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'Images', extensions: imageFormats, ); @@ -166,7 +166,7 @@ class ImagePickerWindows extends CameraDelegatingImagePickerPlatform { maxDuration: maxDuration, ); case ImageSource.gallery: - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'Videos', extensions: videoFormats, ); @@ -189,7 +189,7 @@ class ImagePickerWindows extends CameraDelegatingImagePickerPlatform { double? maxHeight, int? imageQuality, }) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'Images', extensions: imageFormats, ); @@ -203,7 +203,7 @@ class ImagePickerWindows extends CameraDelegatingImagePickerPlatform { Future> getMultiVideoWithOptions({ MultiVideoPickerOptions options = const MultiVideoPickerOptions(), }) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'Videos', extensions: videoFormats, ); @@ -218,7 +218,7 @@ class ImagePickerWindows extends CameraDelegatingImagePickerPlatform { // they will be silently ignored by the Windows version of the plugin. @override Future> getMedia({required MediaOptions options}) async { - const XTypeGroup typeGroup = XTypeGroup( + const typeGroup = XTypeGroup( label: 'images and videos', extensions: [...imageFormats, ...videoFormats], ); diff --git a/packages/image_picker/image_picker_windows/test/image_picker_windows_test.dart b/packages/image_picker/image_picker_windows/test/image_picker_windows_test.dart index 1392f1eb1d5..ed224a8b6de 100644 --- a/packages/image_picker/image_picker_windows/test/image_picker_windows_test.dart +++ b/packages/image_picker/image_picker_windows/test/image_picker_windows_test.dart @@ -147,7 +147,7 @@ void main() { }); test('getVideo calls delegate when source is camera', () async { - const String fakePath = '/tmp/foo'; + const fakePath = '/tmp/foo'; plugin.cameraDelegate = FakeCameraDelegate(result: XFile(fakePath)); expect( (await plugin.getVideo(source: ImageSource.camera))!.path, diff --git a/packages/in_app_purchase/in_app_purchase/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase/example/lib/main.dart index 3aecbf90b3e..1bfef78e8b4 100644 --- a/packages/in_app_purchase/in_app_purchase/example/lib/main.dart +++ b/packages/in_app_purchase/in_app_purchase/example/lib/main.dart @@ -149,7 +149,7 @@ class _MyAppState extends State<_MyApp> { @override Widget build(BuildContext context) { - final List stack = []; + final stack = []; if (_queryProductError == null) { stack.add( ListView( @@ -201,7 +201,7 @@ class _MyAppState extends State<_MyApp> { 'The store is ${_isAvailable ? 'available' : 'unavailable'}.', ), ); - final List children = [storeHeader]; + final children = [storeHeader]; if (!_isAvailable) { children.addAll([ @@ -232,8 +232,8 @@ class _MyAppState extends State<_MyApp> { if (!_isAvailable) { return const Card(); } - const ListTile productHeader = ListTile(title: Text('Products for Sale')); - final List productList = []; + const productHeader = ListTile(title: Text('Products for Sale')); + final productList = []; if (_notFoundIds.isNotEmpty) { productList.add( ListTile( @@ -251,7 +251,7 @@ class _MyAppState extends State<_MyApp> { // This loading previous purchases code is just a demo. Please do not use this as it is. // In your app you should always verify the purchase data using the `verificationData` inside the [PurchaseDetails] object before trusting it. // We recommend that you use your own server to verify the purchase data. - final Map purchases = + final purchases = Map.fromEntries( _purchases.map((PurchaseDetails purchase) { if (purchase.pendingCompletePurchase) { @@ -342,7 +342,7 @@ class _MyAppState extends State<_MyApp> { if (!_isAvailable || _notFoundIds.contains(_kConsumableId)) { return const Card(); } - const ListTile consumableHeader = ListTile( + const consumableHeader = ListTile( title: Text('Purchased consumables'), ); final List tokens = _consumables.map((String id) { @@ -443,7 +443,7 @@ class _MyAppState extends State<_MyApp> { Future _listenToPurchaseUpdated( List purchaseDetailsList, ) async { - for (final PurchaseDetails purchaseDetails in purchaseDetailsList) { + for (final purchaseDetails in purchaseDetailsList) { if (purchaseDetails.status == PurchaseStatus.pending) { showPendingUI(); } else { diff --git a/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart b/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart index 50dd802422b..87708efdc4f 100644 --- a/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart +++ b/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart @@ -11,7 +11,7 @@ import 'package:plugin_platform_interface/plugin_platform_interface.dart'; void main() { group('InAppPurchase', () { - final ProductDetails productDetails = ProductDetails( + final productDetails = ProductDetails( id: 'id', title: 'title', description: 'description', @@ -20,7 +20,7 @@ void main() { currencyCode: 'currencyCode', ); - final PurchaseDetails purchaseDetails = PurchaseDetails( + final purchaseDetails = PurchaseDetails( productID: 'productID', verificationData: PurchaseVerificationData( localVerificationData: 'localVerificationData', @@ -93,7 +93,7 @@ void main() { }); test('buyConsumable', () async { - final PurchaseParam purchaseParam = PurchaseParam( + final purchaseParam = PurchaseParam( productDetails: productDetails, ); final bool result = await inAppPurchase.buyConsumable( @@ -113,7 +113,7 @@ void main() { }); test('buyConsumable with autoConsume=false', () async { - final PurchaseParam purchaseParam = PurchaseParam( + final purchaseParam = PurchaseParam( productDetails: productDetails, ); final bool result = await inAppPurchase.buyConsumable( diff --git a/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart index 9986df72f53..b2502a13740 100644 --- a/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart +++ b/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart @@ -75,7 +75,7 @@ class _MyAppState extends State<_MyApp> { }, ); initStoreInfo(); - final InAppPurchaseAndroidPlatformAddition addition = + final addition = InAppPurchasePlatformAddition.instance! as InAppPurchaseAndroidPlatformAddition; final Stream userChoiceDetailsUpdated = @@ -162,7 +162,7 @@ class _MyAppState extends State<_MyApp> { @override Widget build(BuildContext context) { - final List stack = []; + final stack = []; if (_queryProductError == null) { stack.add( ListView( @@ -216,7 +216,7 @@ class _MyAppState extends State<_MyApp> { 'The store is ${_isAvailable ? 'available' : 'unavailable'}.', ), ); - final List children = [storeHeader]; + final children = [storeHeader]; if (!_isAvailable) { children.addAll([ @@ -236,7 +236,7 @@ class _MyAppState extends State<_MyApp> { } Card _buildFetchButtons() { - const ListTile header = ListTile(title: Text('AlternativeBilling Info')); + const header = ListTile(title: Text('AlternativeBilling Info')); final List entries = []; entries.add( ListTile( @@ -298,7 +298,7 @@ class _MyAppState extends State<_MyApp> { foregroundColor: Colors.white, ), onPressed: () { - final InAppPurchaseAndroidPlatformAddition addition = + final addition = InAppPurchasePlatformAddition.instance! as InAppPurchaseAndroidPlatformAddition; unawaited( @@ -319,7 +319,7 @@ class _MyAppState extends State<_MyApp> { foregroundColor: Colors.white, ), onPressed: () { - final InAppPurchaseAndroidPlatformAddition addition = + final addition = InAppPurchasePlatformAddition.instance! as InAppPurchaseAndroidPlatformAddition; unawaited( @@ -340,7 +340,7 @@ class _MyAppState extends State<_MyApp> { foregroundColor: Colors.white, ), onPressed: () { - final InAppPurchaseAndroidPlatformAddition addition = + final addition = InAppPurchasePlatformAddition.instance! as InAppPurchaseAndroidPlatformAddition; unawaited( @@ -361,7 +361,7 @@ class _MyAppState extends State<_MyApp> { foregroundColor: Colors.white, ), onPressed: () { - final InAppPurchaseAndroidPlatformAddition addition = + final addition = InAppPurchasePlatformAddition.instance! as InAppPurchaseAndroidPlatformAddition; unawaited( @@ -388,7 +388,7 @@ class _MyAppState extends State<_MyApp> { } Card _buildUserChoiceDetailsDisplay() { - const ListTile header = ListTile(title: Text('UserChoiceDetails')); + const header = ListTile(title: Text('UserChoiceDetails')); final List entries = []; for (final String item in _userChoiceDetailsList) { entries.add( @@ -418,8 +418,8 @@ class _MyAppState extends State<_MyApp> { if (!_isAvailable) { return const Card(); } - const ListTile productHeader = ListTile(title: Text('Products for Sale')); - final List productList = []; + const productHeader = ListTile(title: Text('Products for Sale')); + final productList = []; if (_notFoundIds.isNotEmpty) { productList.add( ListTile( @@ -437,7 +437,7 @@ class _MyAppState extends State<_MyApp> { // This loading previous purchases code is just a demo. Please do not use this as it is. // In your app you should always verify the purchase data using the `verificationData` inside the [PurchaseDetails] object before trusting it. // We recommend that you use your own server to verify the purchase data. - final Map purchases = + final purchases = Map.fromEntries( _purchases.map((PurchaseDetails purchase) { if (purchase.pendingCompletePurchase) { @@ -472,7 +472,7 @@ class _MyAppState extends State<_MyApp> { productDetails as GooglePlayProductDetails, purchases, ); - final GooglePlayPurchaseParam purchaseParam = + final purchaseParam = GooglePlayPurchaseParam( productDetails: productDetails, changeSubscriptionParam: oldSubscription != null @@ -520,7 +520,7 @@ class _MyAppState extends State<_MyApp> { if (!_isAvailable || _notFoundIds.contains(_kConsumableId)) { return const Card(); } - const ListTile consumableHeader = ListTile( + const consumableHeader = ListTile( title: Text('Purchased consumables'), ); final List tokens = _consumables.map((String id) { @@ -640,7 +640,7 @@ class _MyAppState extends State<_MyApp> { Future deliverUserChoiceDetails( GooglePlayUserChoiceDetails details, ) async { - final String detailDescription = + final detailDescription = '${details.externalTransactionToken}, ${details.originalExternalTransactionId}, ${details.products.length}'; setState(() { _userChoiceDetailsList.add(detailDescription); @@ -650,11 +650,11 @@ class _MyAppState extends State<_MyApp> { Future _listenToPurchaseUpdated( List purchaseDetailsList, ) async { - for (final PurchaseDetails purchaseDetails in purchaseDetailsList) { + for (final purchaseDetails in purchaseDetailsList) { if (purchaseDetails.status == PurchaseStatus.pending) { showPendingUI(); } else { - final InAppPurchaseAndroidPlatformAddition addition = + final addition = InAppPurchasePlatformAddition.instance! as InAppPurchaseAndroidPlatformAddition; if (purchaseDetails.status == PurchaseStatus.error) { 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 32664d2a34b..ade631bd1ec 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 @@ -213,7 +213,7 @@ class InAppPurchaseAndroidPlatform extends InAppPurchasePlatform { 'On Android, the `purchase` should always be of type `GooglePlayPurchaseDetails`.', ); - final GooglePlayPurchaseDetails googlePurchase = + final googlePurchase = purchase as GooglePlayPurchaseDetails; if (googlePurchase.billingClientPurchase.isAcknowledged) { diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_product_details.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_product_details.dart index 21d022e0f13..a070728ec5e 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_product_details.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_product_details.dart @@ -108,10 +108,10 @@ class GooglePlayProductDetails extends ProductDetails { ), ]; } else { - final List productDetailList = + final productDetailList = []; for ( - int subscriptionIndex = 0; + var subscriptionIndex = 0; subscriptionIndex < productDetails.subscriptionOfferDetails!.length; subscriptionIndex++ ) { diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_purchase_details.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_purchase_details.dart index 8d12ba01c3d..2edeaed20ac 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_purchase_details.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_purchase_details.dart @@ -30,7 +30,7 @@ class GooglePlayPurchaseDetails extends PurchaseDetails { PurchaseWrapper purchase, ) { return purchase.products.map((String productId) { - final GooglePlayPurchaseDetails purchaseDetails = + final purchaseDetails = GooglePlayPurchaseDetails( purchaseID: purchase.orderId, productID: productId, diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart index 1f21f04868d..e8d549676bb 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart @@ -44,7 +44,7 @@ void main() { }); test('waits for connection before executing the operations', () async { - final Completer connectedCompleter = Completer(); + final connectedCompleter = Completer(); when(mockApi.startConnection(any, any, any)).thenAnswer((_) async { connectedCompleter.complete(); return PlatformBillingResult( @@ -53,8 +53,8 @@ void main() { ); }); - final Completer calledCompleter1 = Completer(); - final Completer calledCompleter2 = Completer(); + final calledCompleter1 = Completer(); + final calledCompleter2 = Completer(); unawaited( manager.runWithClient((BillingClient _) async { calledCompleter1.complete(); @@ -148,7 +148,7 @@ void main() { () async { clearInteractions(mockApi); - int timesCalled = 0; + var timesCalled = 0; final BillingResultWrapper result = await manager.runWithClient(( BillingClient _, ) async { @@ -178,7 +178,7 @@ void main() { // Ensures all asynchronous connected code finishes. await manager.runWithClientNonRetryable((_) async {}); - const UserChoiceDetailsWrapper expected = UserChoiceDetailsWrapper( + const expected = UserChoiceDetailsWrapper( originalExternalTransactionId: 'TransactionId', externalTransactionToken: 'TransactionToken', products: [ diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart index b87fe0a6742..43ad7af53e3 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart @@ -68,7 +68,7 @@ void main() { group('startConnection', () { test('returns BillingResultWrapper', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const BillingResponse responseCode = BillingResponse.developerError; when(mockApi.startConnection(any, any, any)).thenAnswer( (_) async => PlatformBillingResult( @@ -77,7 +77,7 @@ void main() { ), ); - const BillingResultWrapper billingResult = BillingResultWrapper( + const billingResult = BillingResultWrapper( responseCode: responseCode, debugMessage: debugMessage, ); @@ -120,7 +120,7 @@ void main() { }); test('passes billingChoiceMode userChoiceBilling when set', () async { - final Completer completer = + final completer = Completer(); billingClient = BillingClient( (PurchasesResultWrapper _) {}, @@ -138,7 +138,7 @@ void main() { PlatformBillingChoiceMode.alternativeBillingOnly, ); - const UserChoiceDetailsWrapper expected = UserChoiceDetailsWrapper( + const expected = UserChoiceDetailsWrapper( originalExternalTransactionId: 'TransactionId', externalTransactionToken: 'TransactionToken', products: [ @@ -187,7 +187,7 @@ void main() { group('queryProductDetails', () { test('handles empty productDetails', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const BillingResponse responseCode = BillingResponse.developerError; when(mockApi.queryProductDetailsAsync(any)).thenAnswer( (_) async => PlatformProductDetailsResponse( @@ -209,7 +209,7 @@ void main() { ], ); - const BillingResultWrapper billingResult = BillingResultWrapper( + const billingResult = BillingResultWrapper( responseCode: responseCode, debugMessage: debugMessage, ); @@ -218,7 +218,7 @@ void main() { }); test('returns ProductDetailsResponseWrapper', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const BillingResponse responseCode = BillingResponse.ok; when(mockApi.queryProductDetailsAsync(any)).thenAnswer( (_) async => PlatformProductDetailsResponse( @@ -242,7 +242,7 @@ void main() { ], ); - const BillingResultWrapper billingResult = BillingResultWrapper( + const billingResult = BillingResultWrapper( responseCode: responseCode, debugMessage: debugMessage, ); @@ -253,9 +253,9 @@ void main() { group('launchBillingFlow', () { test('serializes and deserializes data', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const BillingResponse responseCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: responseCode, debugMessage: debugMessage, ); @@ -263,8 +263,8 @@ void main() { mockApi.launchBillingFlow(any), ).thenAnswer((_) async => convertToPigeonResult(expectedBillingResult)); const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String profileId = 'hashedProfileId'; + const accountId = 'hashedAccountId'; + const profileId = 'hashedProfileId'; expect( await billingClient.launchBillingFlow( @@ -278,7 +278,7 @@ void main() { final VerificationResult result = verify( mockApi.launchBillingFlow(captureAny), ); - final PlatformBillingFlowParams params = + final params = result.captured.single as PlatformBillingFlowParams; expect(params.product, equals(productDetails.productId)); expect(params.accountId, equals(accountId)); @@ -289,8 +289,8 @@ void main() { 'Change subscription throws assertion error `oldProduct` and `purchaseToken` has different nullability', () async { const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String profileId = 'hashedProfileId'; + const accountId = 'hashedAccountId'; + const profileId = 'hashedProfileId'; expect( billingClient.launchBillingFlow( @@ -317,9 +317,9 @@ void main() { test( 'serializes and deserializes data on change subscription without proration', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const BillingResponse responseCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: responseCode, debugMessage: debugMessage, ); @@ -327,8 +327,8 @@ void main() { mockApi.launchBillingFlow(any), ).thenAnswer((_) async => convertToPigeonResult(expectedBillingResult)); const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String profileId = 'hashedProfileId'; + const accountId = 'hashedAccountId'; + const profileId = 'hashedProfileId'; expect( await billingClient.launchBillingFlow( @@ -343,7 +343,7 @@ void main() { final VerificationResult result = verify( mockApi.launchBillingFlow(captureAny), ); - final PlatformBillingFlowParams params = + final params = result.captured.single as PlatformBillingFlowParams; expect(params.product, equals(productDetails.productId)); expect(params.accountId, equals(accountId)); @@ -356,9 +356,9 @@ void main() { test( 'serializes and deserializes data on change subscription with proration', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const BillingResponse responseCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: responseCode, debugMessage: debugMessage, ); @@ -366,8 +366,8 @@ void main() { mockApi.launchBillingFlow(any), ).thenAnswer((_) async => convertToPigeonResult(expectedBillingResult)); const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String profileId = 'hashedProfileId'; + const accountId = 'hashedAccountId'; + const profileId = 'hashedProfileId'; const ReplacementMode replacementMode = ReplacementMode.chargeProratedPrice; @@ -385,7 +385,7 @@ void main() { final VerificationResult result = verify( mockApi.launchBillingFlow(captureAny), ); - final PlatformBillingFlowParams params = + final params = result.captured.single as PlatformBillingFlowParams; expect(params.product, equals(productDetails.productId)); expect(params.accountId, equals(accountId)); @@ -402,9 +402,9 @@ void main() { test( 'serializes and deserializes data when using immediateAndChargeFullPrice', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const BillingResponse responseCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: responseCode, debugMessage: debugMessage, ); @@ -412,8 +412,8 @@ void main() { mockApi.launchBillingFlow(any), ).thenAnswer((_) async => convertToPigeonResult(expectedBillingResult)); const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String profileId = 'hashedProfileId'; + const accountId = 'hashedAccountId'; + const profileId = 'hashedProfileId'; const ReplacementMode replacementMode = ReplacementMode.chargeFullPrice; expect( @@ -430,7 +430,7 @@ void main() { final VerificationResult result = verify( mockApi.launchBillingFlow(captureAny), ); - final PlatformBillingFlowParams params = + final params = result.captured.single as PlatformBillingFlowParams; expect(params.product, equals(productDetails.productId)); expect(params.accountId, equals(accountId)); @@ -445,9 +445,9 @@ void main() { ); test('handles null accountId', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const BillingResponse responseCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: responseCode, debugMessage: debugMessage, ); @@ -465,7 +465,7 @@ void main() { final VerificationResult result = verify( mockApi.launchBillingFlow(captureAny), ); - final PlatformBillingFlowParams params = + final params = result.captured.single as PlatformBillingFlowParams; expect(params.product, equals(productDetails.productId)); expect(params.accountId, isNull); @@ -475,11 +475,11 @@ void main() { group('queryPurchases', () { test('serializes and deserializes data', () async { const BillingResponse expectedCode = BillingResponse.ok; - final List expectedList = [ + final expectedList = [ dummyPurchase, ]; - const String debugMessage = 'dummy message'; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const debugMessage = 'dummy message'; + const expectedBillingResult = BillingResultWrapper( responseCode: expectedCode, debugMessage: debugMessage, ); @@ -507,8 +507,8 @@ void main() { test('handles empty purchases', () async { const BillingResponse expectedCode = BillingResponse.userCanceled; - const String debugMessage = 'dummy message'; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const debugMessage = 'dummy message'; + const expectedBillingResult = BillingResultWrapper( responseCode: expectedCode, debugMessage: debugMessage, ); @@ -536,8 +536,8 @@ void main() { group('queryPurchaseHistory', () { test('handles empty purchases', () async { const BillingResponse expectedCode = BillingResponse.userCanceled; - const String debugMessage = 'dummy message'; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const debugMessage = 'dummy message'; + const expectedBillingResult = BillingResultWrapper( responseCode: expectedCode, debugMessage: debugMessage, ); @@ -561,10 +561,10 @@ void main() { group('consume purchases', () { test('consume purchase async success', () async { - const String token = 'dummy token'; + const token = 'dummy token'; const BillingResponse expectedCode = BillingResponse.ok; - const String debugMessage = 'dummy message'; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const debugMessage = 'dummy message'; + const expectedBillingResult = BillingResultWrapper( responseCode: expectedCode, debugMessage: debugMessage, ); @@ -581,10 +581,10 @@ void main() { group('acknowledge purchases', () { test('acknowledge purchase success', () async { - const String token = 'dummy token'; + const token = 'dummy token'; const BillingResponse expectedCode = BillingResponse.ok; - const String debugMessage = 'dummy message'; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const debugMessage = 'dummy message'; + const expectedBillingResult = BillingResultWrapper( responseCode: expectedCode, debugMessage: debugMessage, ); @@ -623,7 +623,7 @@ void main() { group('billingConfig', () { test('billingConfig returns object', () async { - const BillingConfigWrapper expected = BillingConfigWrapper( + const expected = BillingConfigWrapper( countryCode: 'US', responseCode: BillingResponse.ok, debugMessage: '', @@ -640,7 +640,7 @@ void main() { group('isAlternativeBillingOnlyAvailable', () { test('returns object', () async { - const BillingResultWrapper expected = BillingResultWrapper( + const expected = BillingResultWrapper( responseCode: BillingResponse.ok, debugMessage: 'message', ); @@ -658,7 +658,7 @@ void main() { group('createAlternativeBillingOnlyReportingDetails', () { test('returns object', () async { - const AlternativeBillingOnlyReportingDetailsWrapper expected = + const expected = AlternativeBillingOnlyReportingDetailsWrapper( responseCode: BillingResponse.ok, debugMessage: 'debug', @@ -678,7 +678,7 @@ void main() { group('showAlternativeBillingOnlyInformationDialog', () { test('returns object', () async { - const BillingResultWrapper expected = BillingResultWrapper( + const expected = BillingResultWrapper( responseCode: BillingResponse.ok, debugMessage: 'message', ); diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/product_details_wrapper_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/product_details_wrapper_test.dart index 63564bf7b46..51526078fd0 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/product_details_wrapper_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/product_details_wrapper_test.dart @@ -40,7 +40,7 @@ void main() { group('BillingResultWrapper', () { test('operator == of ProductDetailsWrapper works fine', () { - const ProductDetailsWrapper firstProductDetailsInstance = + const firstProductDetailsInstance = ProductDetailsWrapper( description: 'description', title: 'title', @@ -74,7 +74,7 @@ void main() { ), ], ); - const ProductDetailsWrapper secondProductDetailsInstance = + const secondProductDetailsInstance = ProductDetailsWrapper( description: 'description', title: 'title', @@ -115,12 +115,12 @@ void main() { }); test('operator == of BillingResultWrapper works fine', () { - const BillingResultWrapper firstBillingResultInstance = + const firstBillingResultInstance = BillingResultWrapper( responseCode: BillingResponse.ok, debugMessage: 'debugMessage', ); - const BillingResultWrapper secondBillingResultInstance = + const secondBillingResultInstance = BillingResultWrapper( responseCode: BillingResponse.ok, debugMessage: 'debugMessage', diff --git a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart index 93fec10b283..48a31577cbf 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart @@ -47,8 +47,8 @@ void main() { group('consume purchases', () { test('consume purchase async success', () async { const BillingResponse expectedCode = BillingResponse.ok; - const String debugMessage = 'dummy message'; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const debugMessage = 'dummy message'; + const expectedBillingResult = BillingResultWrapper( responseCode: expectedCode, debugMessage: debugMessage, ); @@ -66,8 +66,8 @@ void main() { group('billingConfig', () { test('getCountryCode success', () async { - const String expectedCountryCode = 'US'; - const BillingConfigWrapper expected = BillingConfigWrapper( + const expectedCountryCode = 'US'; + const expected = BillingConfigWrapper( countryCode: expectedCountryCode, responseCode: BillingResponse.ok, debugMessage: 'dummy message', @@ -122,7 +122,7 @@ void main() { group('isAlternativeBillingOnlyAvailable', () { test('isAlternativeBillingOnlyAvailable success', () async { - const BillingResultWrapper expected = BillingResultWrapper( + const expected = BillingResultWrapper( responseCode: BillingResponse.ok, debugMessage: 'dummy message', ); @@ -142,7 +142,7 @@ void main() { group('showAlternativeBillingOnlyInformationDialog', () { test('showAlternativeBillingOnlyInformationDialog success', () async { - const BillingResultWrapper expected = BillingResultWrapper( + const expected = BillingResultWrapper( responseCode: BillingResponse.ok, debugMessage: 'dummy message', ); @@ -163,7 +163,7 @@ void main() { group('queryPastPurchase', () { group('queryPurchaseDetails', () { test('returns ProductDetailsResponseWrapper', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const PlatformBillingResponse responseCode = PlatformBillingResponse.ok; when(mockApi.queryPurchasesAsync(any)).thenAnswer( @@ -231,7 +231,7 @@ void main() { test('called', () async { final Future futureDetails = iapAndroidPlatformAddition.userChoiceDetailsStream.first; - const UserChoiceDetailsWrapper expected = UserChoiceDetailsWrapper( + const expected = UserChoiceDetailsWrapper( originalExternalTransactionId: 'TransactionId', externalTransactionToken: 'TransactionToken', products: [ diff --git a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart index 908e89542aa..4b0316bdb7b 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart @@ -140,7 +140,7 @@ void main() { group('queryProductDetails', () { test('handles empty productDetails', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const PlatformBillingResponse responseCode = PlatformBillingResponse.ok; when(mockApi.queryProductDetailsAsync(any)).thenAnswer( (_) async => PlatformProductDetailsResponse( @@ -158,7 +158,7 @@ void main() { }); test('should get correct product details', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const PlatformBillingResponse responseCode = PlatformBillingResponse.ok; when(mockApi.queryProductDetailsAsync(any)).thenAnswer( (_) async => PlatformProductDetailsResponse( @@ -191,7 +191,7 @@ void main() { }); test('should get the correct notFoundIDs', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const PlatformBillingResponse responseCode = PlatformBillingResponse.ok; when(mockApi.queryProductDetailsAsync(any)).thenAnswer( (_) async => PlatformProductDetailsResponse( @@ -268,7 +268,7 @@ void main() { }); test('returns ProductDetailsResponseWrapper', () async { - final Completer> completer = + final completer = Completer>(); final Stream> stream = iapAndroidPlatform.purchaseStream; @@ -281,7 +281,7 @@ void main() { } }); - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const PlatformBillingResponse responseCode = PlatformBillingResponse.ok; when(mockApi.queryPurchasesAsync(any)).thenAnswer( @@ -301,8 +301,8 @@ void main() { final List restoredPurchases = await completer.future; expect(restoredPurchases.length, 2); - for (final PurchaseDetails element in restoredPurchases) { - final GooglePlayPurchaseDetails purchase = + for (final element in restoredPurchases) { + final purchase = element as GooglePlayPurchaseDetails; expect(purchase.productID, dummyPurchase.products.first); @@ -329,10 +329,10 @@ void main() { () async { const ProductDetailsWrapper productDetails = dummySubscriptionProductDetails; - const String accountId = 'hashedAccountId'; - const String debugMessage = 'dummy message'; + const accountId = 'hashedAccountId'; + const debugMessage = 'dummy message'; const BillingResponse sentCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: sentCode, debugMessage: debugMessage, ); @@ -364,7 +364,7 @@ void main() { return convertToPigeonResult(expectedBillingResult); }); - final Completer completer = + final completer = Completer(); PurchaseDetails purchaseDetails; final Stream> purchaseStream = @@ -375,7 +375,7 @@ void main() { completer.complete(purchaseDetails); subscription.cancel(); }, onDone: () {}); - final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( + final purchaseParam = GooglePlayPurchaseParam( offerToken: productDetails.subscriptionOfferDetails?.first.offerIdToken, productDetails: GooglePlayProductDetails.fromProductDetails( @@ -397,10 +397,10 @@ void main() { test('buy non consumable, serializes and deserializes data', () async { const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String debugMessage = 'dummy message'; + const accountId = 'hashedAccountId'; + const debugMessage = 'dummy message'; const BillingResponse sentCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: sentCode, debugMessage: debugMessage, ); @@ -432,7 +432,7 @@ void main() { return convertToPigeonResult(expectedBillingResult); }); - final Completer completer = Completer(); + final completer = Completer(); PurchaseDetails purchaseDetails; final Stream> purchaseStream = iapAndroidPlatform.purchaseStream; @@ -442,7 +442,7 @@ void main() { completer.complete(purchaseDetails); subscription.cancel(); }, onDone: () {}); - final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( + final purchaseParam = GooglePlayPurchaseParam( productDetails: GooglePlayProductDetails.fromProductDetails( productDetails, ).first, @@ -461,10 +461,10 @@ void main() { test('handles an error with an empty purchases list', () async { const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String debugMessage = 'dummy message'; + const accountId = 'hashedAccountId'; + const debugMessage = 'dummy message'; const BillingResponse sentCode = BillingResponse.error; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: sentCode, debugMessage: debugMessage, ); @@ -481,7 +481,7 @@ void main() { return convertToPigeonResult(expectedBillingResult); }); - final Completer completer = Completer(); + final completer = Completer(); PurchaseDetails purchaseDetails; final Stream> purchaseStream = iapAndroidPlatform.purchaseStream; @@ -491,7 +491,7 @@ void main() { completer.complete(purchaseDetails); subscription.cancel(); }, onDone: () {}); - final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( + final purchaseParam = GooglePlayPurchaseParam( productDetails: GooglePlayProductDetails.fromProductDetails( productDetails, ).first, @@ -510,10 +510,10 @@ void main() { 'buy consumable with auto consume, serializes and deserializes data', () async { const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String debugMessage = 'dummy message'; + const accountId = 'hashedAccountId'; + const debugMessage = 'dummy message'; const BillingResponse sentCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: sentCode, debugMessage: debugMessage, ); @@ -545,10 +545,10 @@ void main() { return convertToPigeonResult(expectedBillingResult); }); - final Completer consumeCompleter = Completer(); + final consumeCompleter = Completer(); // adding call back for consume purchase const BillingResponse expectedCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResultForConsume = + const expectedBillingResultForConsume = BillingResultWrapper( responseCode: expectedCode, debugMessage: debugMessage, @@ -556,13 +556,13 @@ void main() { when(mockApi.consumeAsync(any)).thenAnswer(( Invocation invocation, ) async { - final String purchaseToken = + final purchaseToken = invocation.positionalArguments.first as String; consumeCompleter.complete(purchaseToken); return convertToPigeonResult(expectedBillingResultForConsume); }); - final Completer completer = + final completer = Completer(); PurchaseDetails purchaseDetails; final Stream> purchaseStream = @@ -573,7 +573,7 @@ void main() { completer.complete(purchaseDetails); subscription.cancel(); }, onDone: () {}); - final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( + final purchaseParam = GooglePlayPurchaseParam( productDetails: GooglePlayProductDetails.fromProductDetails( productDetails, ).first, @@ -584,7 +584,7 @@ void main() { ); // Verify that the result has succeeded - final GooglePlayPurchaseDetails result = + final result = await completer.future as GooglePlayPurchaseDetails; expect(launchResult, isTrue); expect(result.billingClientPurchase, isNotNull); @@ -600,9 +600,9 @@ void main() { test( 'buyNonConsumable propagates failures to launch the billing flow', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const BillingResponse sentCode = BillingResponse.error; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: sentCode, debugMessage: debugMessage, ); @@ -626,9 +626,9 @@ void main() { test( 'buyConsumable propagates failures to launch the billing flow', () async { - const String debugMessage = 'dummy message'; + const debugMessage = 'dummy message'; const BillingResponse sentCode = BillingResponse.developerError; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: sentCode, debugMessage: debugMessage, ); @@ -651,10 +651,10 @@ void main() { test('adds consumption failures to PurchaseDetails objects', () async { const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String debugMessage = 'dummy message'; + const accountId = 'hashedAccountId'; + const debugMessage = 'dummy message'; const BillingResponse sentCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: sentCode, debugMessage: debugMessage, ); @@ -685,22 +685,22 @@ void main() { return convertToPigeonResult(expectedBillingResult); }); - final Completer consumeCompleter = Completer(); + final consumeCompleter = Completer(); // adding call back for consume purchase const BillingResponse expectedCode = BillingResponse.error; - const BillingResultWrapper expectedBillingResultForConsume = + const expectedBillingResultForConsume = BillingResultWrapper( responseCode: expectedCode, debugMessage: debugMessage, ); when(mockApi.consumeAsync(any)).thenAnswer((Invocation invocation) async { - final String purchaseToken = + final purchaseToken = invocation.positionalArguments.first as String; consumeCompleter.complete(purchaseToken); return convertToPigeonResult(expectedBillingResultForConsume); }); - final Completer completer = Completer(); + final completer = Completer(); PurchaseDetails purchaseDetails; final Stream> purchaseStream = iapAndroidPlatform.purchaseStream; @@ -710,7 +710,7 @@ void main() { completer.complete(purchaseDetails); subscription.cancel(); }, onDone: () {}); - final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( + final purchaseParam = GooglePlayPurchaseParam( productDetails: GooglePlayProductDetails.fromProductDetails( productDetails, ).first, @@ -719,7 +719,7 @@ void main() { await iapAndroidPlatform.buyConsumable(purchaseParam: purchaseParam); // Verify that the result has an error for the failed consumption - final GooglePlayPurchaseDetails result = + final result = await completer.future as GooglePlayPurchaseDetails; expect(result.billingClientPurchase, isNotNull); expect( @@ -735,10 +735,10 @@ void main() { 'buy consumable without auto consume, consume api should not receive calls', () async { const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String debugMessage = 'dummy message'; + const accountId = 'hashedAccountId'; + const debugMessage = 'dummy message'; const BillingResponse sentCode = BillingResponse.developerError; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: sentCode, debugMessage: debugMessage, ); @@ -770,10 +770,10 @@ void main() { return convertToPigeonResult(expectedBillingResult); }); - final Completer consumeCompleter = Completer(); + final consumeCompleter = Completer(); // adding call back for consume purchase const BillingResponse expectedCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResultForConsume = + const expectedBillingResultForConsume = BillingResultWrapper( responseCode: expectedCode, debugMessage: debugMessage, @@ -781,7 +781,7 @@ void main() { when(mockApi.consumeAsync(any)).thenAnswer(( Invocation invocation, ) async { - final String purchaseToken = + final purchaseToken = invocation.positionalArguments.first as String; consumeCompleter.complete(purchaseToken); return convertToPigeonResult(expectedBillingResultForConsume); @@ -794,7 +794,7 @@ void main() { consumeCompleter.complete(null); subscription.cancel(); }, onDone: () {}); - final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( + final purchaseParam = GooglePlayPurchaseParam( productDetails: GooglePlayProductDetails.fromProductDetails( productDetails, ).first, @@ -812,10 +812,10 @@ void main() { 'should get canceled purchase status when response code is BillingResponse.userCanceled', () async { const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String debugMessage = 'dummy message'; + const accountId = 'hashedAccountId'; + const debugMessage = 'dummy message'; const BillingResponse sentCode = BillingResponse.userCanceled; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: sentCode, debugMessage: debugMessage, ); @@ -846,10 +846,10 @@ void main() { return convertToPigeonResult(expectedBillingResult); }); - final Completer consumeCompleter = Completer(); + final consumeCompleter = Completer(); // adding call back for consume purchase const BillingResponse expectedCode = BillingResponse.userCanceled; - const BillingResultWrapper expectedBillingResultForConsume = + const expectedBillingResultForConsume = BillingResultWrapper( responseCode: expectedCode, debugMessage: debugMessage, @@ -857,13 +857,13 @@ void main() { when(mockApi.consumeAsync(any)).thenAnswer(( Invocation invocation, ) async { - final String purchaseToken = + final purchaseToken = invocation.positionalArguments.first as String; consumeCompleter.complete(purchaseToken); return convertToPigeonResult(expectedBillingResultForConsume); }); - final Completer completer = + final completer = Completer(); PurchaseDetails purchaseDetails; final Stream> purchaseStream = @@ -874,7 +874,7 @@ void main() { completer.complete(purchaseDetails); subscription.cancel(); }, onDone: () {}); - final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( + final purchaseParam = GooglePlayPurchaseParam( productDetails: GooglePlayProductDetails.fromProductDetails( productDetails, ).first, @@ -883,7 +883,7 @@ void main() { await iapAndroidPlatform.buyConsumable(purchaseParam: purchaseParam); // Verify that the result has an error for the failed consumption - final GooglePlayPurchaseDetails result = + final result = await completer.future as GooglePlayPurchaseDetails; expect(result.status, PurchaseStatus.canceled); }, @@ -893,10 +893,10 @@ void main() { 'should get purchased purchase status when upgrading subscription by deferred proration mode', () async { const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; - const String accountId = 'hashedAccountId'; - const String debugMessage = 'dummy message'; + const accountId = 'hashedAccountId'; + const debugMessage = 'dummy message'; const BillingResponse sentCode = BillingResponse.ok; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const expectedBillingResult = BillingResultWrapper( responseCode: sentCode, debugMessage: debugMessage, ); @@ -913,7 +913,7 @@ void main() { return convertToPigeonResult(expectedBillingResult); }); - final Completer completer = + final completer = Completer(); PurchaseDetails purchaseDetails; final Stream> purchaseStream = @@ -924,7 +924,7 @@ void main() { completer.complete(purchaseDetails); subscription.cancel(); }, onDone: () {}); - final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( + final purchaseParam = GooglePlayPurchaseParam( productDetails: GooglePlayProductDetails.fromProductDetails( productDetails, ).first, @@ -947,8 +947,8 @@ void main() { group('complete purchase', () { test('complete purchase success', () async { const BillingResponse expectedCode = BillingResponse.ok; - const String debugMessage = 'dummy message'; - const BillingResultWrapper expectedBillingResult = BillingResultWrapper( + const debugMessage = 'dummy message'; + const expectedBillingResult = BillingResultWrapper( responseCode: expectedCode, debugMessage: debugMessage, ); @@ -959,7 +959,7 @@ void main() { GooglePlayPurchaseDetails.fromPurchase( dummyUnacknowledgedPurchase, ).first; - final Completer completer = + final completer = Completer(); purchaseDetails.status = PurchaseStatus.purchased; if (purchaseDetails.pendingCompletePurchase) { @@ -974,8 +974,8 @@ void main() { group('billingConfig', () { test('getCountryCode success', () async { - const String expectedCountryCode = 'US'; - const BillingConfigWrapper expected = BillingConfigWrapper( + const expectedCountryCode = 'US'; + const expected = BillingConfigWrapper( countryCode: expectedCountryCode, responseCode: BillingResponse.ok, debugMessage: 'dummy message', diff --git a/packages/in_app_purchase/in_app_purchase_android/test/types/translator_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/types/translator_test.dart index 6add39629e2..be20afe0dca 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/types/translator_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/types/translator_test.dart @@ -22,7 +22,7 @@ void main() { }); test('convertToUserChoiceDetailsProduct', () { - const GooglePlayUserChoiceDetailsProduct expected = + const expected = GooglePlayUserChoiceDetailsProduct( id: 'id', offerToken: 'offerToken', @@ -40,19 +40,19 @@ void main() { ); }); test('convertToUserChoiceDetailsProduct', () { - const GooglePlayUserChoiceDetailsProduct expectedProduct1 = + const expectedProduct1 = GooglePlayUserChoiceDetailsProduct( id: 'id1', offerToken: 'offerToken1', productType: GooglePlayProductType.inapp, ); - const GooglePlayUserChoiceDetailsProduct expectedProduct2 = + const expectedProduct2 = GooglePlayUserChoiceDetailsProduct( id: 'id2', offerToken: 'offerToken2', productType: GooglePlayProductType.subs, ); - const GooglePlayUserChoiceDetails expected = GooglePlayUserChoiceDetails( + const expected = GooglePlayUserChoiceDetails( originalExternalTransactionId: 'originalExternalTransactionId', externalTransactionToken: 'externalTransactionToken', products: [ diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart b/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart index 30377ce0e93..3b0bbff681d 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart @@ -35,7 +35,7 @@ void main() { test( 'Default implementation of purchaseStream should throw unimplemented error', () { - final ExtendsInAppPurchasePlatform inAppPurchasePlatform = + final inAppPurchasePlatform = ExtendsInAppPurchasePlatform(); expect( @@ -48,7 +48,7 @@ void main() { test( 'Default implementation of isAvailable should throw unimplemented error', () { - final ExtendsInAppPurchasePlatform inAppPurchasePlatform = + final inAppPurchasePlatform = ExtendsInAppPurchasePlatform(); expect( @@ -61,7 +61,7 @@ void main() { test( 'Default implementation of queryProductDetails should throw unimplemented error', () { - final ExtendsInAppPurchasePlatform inAppPurchasePlatform = + final inAppPurchasePlatform = ExtendsInAppPurchasePlatform(); expect( @@ -74,7 +74,7 @@ void main() { test( 'Default implementation of buyNonConsumable should throw unimplemented error', () { - final ExtendsInAppPurchasePlatform inAppPurchasePlatform = + final inAppPurchasePlatform = ExtendsInAppPurchasePlatform(); expect( @@ -89,7 +89,7 @@ void main() { test( 'Default implementation of buyConsumable should throw unimplemented error', () { - final ExtendsInAppPurchasePlatform inAppPurchasePlatform = + final inAppPurchasePlatform = ExtendsInAppPurchasePlatform(); expect( @@ -104,7 +104,7 @@ void main() { test( 'Default implementation of completePurchase should throw unimplemented error', () { - final ExtendsInAppPurchasePlatform inAppPurchasePlatform = + final inAppPurchasePlatform = ExtendsInAppPurchasePlatform(); expect( @@ -117,7 +117,7 @@ void main() { test( 'Default implementation of restorePurchases should throw unimplemented error', () { - final ExtendsInAppPurchasePlatform inAppPurchasePlatform = + final inAppPurchasePlatform = ExtendsInAppPurchasePlatform(); expect( @@ -130,7 +130,7 @@ void main() { test( 'Default implementation of countryCode should throw unimplemented error', () { - final ExtendsInAppPurchasePlatform inAppPurchasePlatform = + final inAppPurchasePlatform = ExtendsInAppPurchasePlatform(); expect( @@ -170,7 +170,7 @@ void main() { test('Provider can provide', () { ImplementsInAppPurchasePlatformAdditionProvider.register(); - final ImplementsInAppPurchasePlatformAdditionProvider provider = + final provider = ImplementsInAppPurchasePlatformAdditionProvider(); final InAppPurchasePlatformAddition? addition = provider .getPlatformAddition(); @@ -178,7 +178,7 @@ void main() { }); test('Provider can provide `null`', () { - final ImplementsInAppPurchasePlatformAdditionProvider provider = + final provider = ImplementsInAppPurchasePlatformAdditionProvider(); final InAppPurchasePlatformAddition? addition = provider .getPlatformAddition(); diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/errors/in_app_purchase_error_test.dart b/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/errors/in_app_purchase_error_test.dart index 8d329bddc96..e923536b860 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/errors/in_app_purchase_error_test.dart +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/errors/in_app_purchase_error_test.dart @@ -7,7 +7,7 @@ import 'package:in_app_purchase_platform_interface/src/errors/in_app_purchase_er void main() { test('toString: Should return a description of the error', () { - final IAPError exceptionNoDetails = IAPError( + final exceptionNoDetails = IAPError( code: 'error_code', message: 'dummy_message', source: 'dummy_source', @@ -18,7 +18,7 @@ void main() { 'IAPError(code: error_code, source: dummy_source, message: dummy_message, details: null)', ); - final IAPError exceptionWithDetails = IAPError( + final exceptionWithDetails = IAPError( code: 'error_code', message: 'dummy_message', source: 'dummy_source', diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/errors/in_app_purchase_exception_test.dart b/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/errors/in_app_purchase_exception_test.dart index a4735fef3d7..1b376a8422f 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/errors/in_app_purchase_exception_test.dart +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/errors/in_app_purchase_exception_test.dart @@ -7,14 +7,14 @@ import 'package:in_app_purchase_platform_interface/src/errors/in_app_purchase_ex void main() { test('toString: Should return a description of the exception', () { - final InAppPurchaseException exception = InAppPurchaseException( + final exception = InAppPurchaseException( code: 'error_code', message: 'dummy message', source: 'dummy_source', ); // Act - final String actual = exception.toString(); + final actual = exception.toString(); // Assert expect( diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/types/product_details_test.dart b/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/types/product_details_test.dart index 40b3647188a..86a7d25b66b 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/types/product_details_test.dart +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/test/src/types/product_details_test.dart @@ -10,7 +10,7 @@ void main() { test( 'fromSkProduct should correctly parse data from a SKProductWrapper instance.', () { - final ProductDetails productDetails = ProductDetails( + final productDetails = ProductDetails( id: 'id', title: 'title', description: 'description', diff --git a/packages/in_app_purchase/in_app_purchase_storekit/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase_storekit/example/lib/main.dart index f0e0431d4df..62e5a9eaeda 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/example/lib/main.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/example/lib/main.dart @@ -140,7 +140,7 @@ class _MyAppState extends State<_MyApp> { @override Widget build(BuildContext context) { - final List stack = []; + final stack = []; if (_queryProductError == null) { stack.add( ListView( @@ -192,7 +192,7 @@ class _MyAppState extends State<_MyApp> { 'The store is ${_isAvailable ? 'available' : 'unavailable'}.', ), ); - final List children = [storeHeader]; + final children = [storeHeader]; if (!_isAvailable) { children.addAll([ @@ -223,19 +223,19 @@ class _MyAppState extends State<_MyApp> { if (!_isAvailable) { return const Card(); } - const ListTile productHeader = ListTile( + const productHeader = ListTile( title: Text( 'Products for Sale', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), ); - const ListTile promoHeader = ListTile( + const promoHeader = ListTile( title: Text( 'Products in promo', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), ); - final List productList = []; + final productList = []; if (_notFoundIds.isNotEmpty) { productList.add( ListTile( @@ -253,7 +253,7 @@ class _MyAppState extends State<_MyApp> { // This loading previous purchases code is just a demo. Please do not use this as it is. // In your app you should always verify the purchase data using the `verificationData` inside the [PurchaseDetails] object before trusting it. // We recommend that you use your own server to verify the purchase data. - final Map purchases = + final purchases = Map.fromEntries( _purchases.map((PurchaseDetails purchase) { if (purchase.pendingCompletePurchase) { @@ -284,7 +284,7 @@ class _MyAppState extends State<_MyApp> { foregroundColor: Colors.white, ), onPressed: () { - final PurchaseParam purchaseParam = PurchaseParam( + final purchaseParam = PurchaseParam( productDetails: productDetails, ); if (productDetails.id == _kConsumableId) { @@ -339,7 +339,7 @@ class _MyAppState extends State<_MyApp> { } Future> _buildPromoList() async { - final List promoList = []; + final promoList = []; for (final ProductDetails detail in _products) { if (detail is AppStoreProduct2Details) { final SK2SubscriptionInfo? subscription = @@ -347,7 +347,7 @@ class _MyAppState extends State<_MyApp> { final List offers = subscription?.promotionalOffers ?? []; - for (final SK2SubscriptionOffer offer in offers) { + for (final offer in offers) { if (offer.type == SK2SubscriptionOfferType.winBack) { final bool eligible = await _iapStoreKitPlatform .isWinBackOfferEligible(detail.id, offer.id ?? ''); @@ -377,7 +377,7 @@ class _MyAppState extends State<_MyApp> { foregroundColor: Colors.white, ), onPressed: () { - final Sk2PurchaseParam purchaseParam = Sk2PurchaseParam.fromOffer( + final purchaseParam = Sk2PurchaseParam.fromOffer( productDetails: productDetails, offer: offer, signature: SK2SubscriptionOfferSignature( @@ -407,7 +407,7 @@ class _MyAppState extends State<_MyApp> { if (!_isAvailable || _notFoundIds.contains(_kConsumableId)) { return const Card(); } - const ListTile consumableHeader = ListTile( + const consumableHeader = ListTile( title: Text('Purchased consumables'), ); final List tokens = _consumables.map((String id) { 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 831136fdc31..48e5782a079 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 @@ -68,7 +68,7 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { _skPaymentQueueWrapper = SKPaymentQueueWrapper(); if (_useStoreKit2) { - final StreamController> updateController2 = + final updateController2 = StreamController>.broadcast( onListen: () => SK2Transaction.startListeningToTransactions(), onCancel: () => SK2Transaction.stopListeningToTransactions(), @@ -80,7 +80,7 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { } else { // Create a purchaseUpdatedController and notify the native side when to // start of stop sending updates. - final StreamController> updateController = + final updateController = StreamController>.broadcast( onListen: () => _skPaymentQueueWrapper.startObservingTransactionQueue(), @@ -272,7 +272,7 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { Set identifiers, ) async { if (_useStoreKit2) { - List products = []; + var products = []; Set invalidProductIdentifiers; PlatformException? exception; try { @@ -293,7 +293,7 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { AppStoreProduct2Details.fromSK2Product(productWrapper), ) .toList(); - final ProductDetailsResponse response = ProductDetailsResponse( + final response = ProductDetailsResponse( productDetails: productDetails, notFoundIDs: invalidProductIdentifiers.toList(), error: exception == null @@ -307,7 +307,7 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { ); return response; } - final SKRequestMaker requestMaker = SKRequestMaker(); + final requestMaker = SKRequestMaker(); SkProductResponseWrapper response; PlatformException? exception; try { @@ -319,7 +319,7 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { invalidProductIdentifiers: identifiers.toList(), ); } - List productDetails = []; + var productDetails = []; productDetails = response.products .map( (SKProductWrapper productWrapper) => @@ -330,7 +330,7 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { if (productDetails.isEmpty) { invalidIdentifiers = identifiers.toList(); } - final ProductDetailsResponse productDetailsResponse = + final productDetailsResponse = ProductDetailsResponse( productDetails: productDetails, notFoundIDs: invalidIdentifiers, 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 4a8a5728d39..0f92f90b7ce 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 @@ -239,7 +239,7 @@ class SKPaymentQueueWrapper { } case 'restoreCompletedTransactionsFailed': { - final SKError error = SKError.fromJson( + final error = SKError.fromJson( Map.from(call.arguments as Map), ); return Future(() { @@ -254,13 +254,13 @@ class SKPaymentQueueWrapper { } case 'shouldAddStorePayment': { - final Map arguments = + final arguments = call.arguments as Map; - final SKPaymentWrapper payment = SKPaymentWrapper.fromJson( + final payment = SKPaymentWrapper.fromJson( (arguments['payment']! as Map) .cast(), ); - final SKProductWrapper product = SKProductWrapper.fromJson( + final product = SKProductWrapper.fromJson( (arguments['product']! as Map) .cast(), ); @@ -310,14 +310,14 @@ class SKPaymentQueueWrapper { final SKPaymentQueueDelegateWrapper delegate = _paymentQueueDelegate!; switch (call.method) { case 'shouldContinueTransaction': - final Map arguments = + final arguments = call.arguments as Map; - final SKPaymentTransactionWrapper transaction = + final transaction = SKPaymentTransactionWrapper.fromJson( (arguments['transaction']! as Map) .cast(), ); - final SKStorefrontWrapper storefront = SKStorefrontWrapper.fromJson( + final storefront = SKStorefrontWrapper.fromJson( (arguments['storefront']! as Map) .cast(), ); diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/types/app_store_purchase_details.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/types/app_store_purchase_details.dart index 5964137dc83..d55ca6c47a9 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/types/app_store_purchase_details.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/types/app_store_purchase_details.dart @@ -30,7 +30,7 @@ class AppStorePurchaseDetails extends PurchaseDetails { SKPaymentTransactionWrapper transaction, String base64EncodedReceipt, ) { - final AppStorePurchaseDetails purchaseDetails = AppStorePurchaseDetails( + final purchaseDetails = AppStorePurchaseDetails( productID: transaction.payment.productIdentifier, purchaseID: transaction.transactionIdentifier, skPaymentTransaction: transaction, diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart index 4b155205af5..6a4e1e9d76d 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart @@ -159,12 +159,12 @@ class FakeStoreKitPlatform implements InAppPurchaseAPI { @override Future addPayment(Map paymentMap) async { - final String id = paymentMap['productIdentifier']! as String; - final int quantity = paymentMap['quantity']! as int; + final id = paymentMap['productIdentifier']! as String; + final quantity = paymentMap['quantity']! as int; // Keep the received paymentDiscount parameter when testing payment with discount. if (paymentMap['applicationUsername']! == 'userWithDiscount') { - final Map? discountArgument = + final discountArgument = paymentMap['paymentDiscount'] as Map?; if (discountArgument != null) { discountReceived = discountArgument.cast(); @@ -272,17 +272,17 @@ class FakeStoreKitPlatform implements InAppPurchaseAPI { if (queryProductException != null) { throw queryProductException!; } - final List productIDS = productIdentifiers; - final List invalidFound = []; - final List products = []; - for (final String? productID in productIDS) { + final productIDS = productIdentifiers; + final invalidFound = []; + final products = []; + for (final productID in productIDS) { if (!validProductIDs.contains(productID)) { invalidFound.add(productID!); } else { products.add(validProducts[productID]!); } } - final SkProductResponseWrapper response = SkProductResponseWrapper( + final response = SkProductResponseWrapper( products: products, invalidProductIdentifiers: invalidFound, ); @@ -362,7 +362,7 @@ class FakeStoreKit2Platform implements InAppPurchase2API { validProductIDs = {'123', '456'}; validProducts = {}; for (final String validID in validProductIDs) { - final SK2Product product = SK2Product( + final product = SK2Product( id: validID, displayName: 'test_product', displayPrice: '0.99', @@ -402,15 +402,15 @@ class FakeStoreKit2Platform implements InAppPurchase2API { if (queryProductException != null) { throw queryProductException!; } - final List productIDS = identifiers; - final List products = []; - for (final String? productID in productIDS) { + final productIDS = identifiers; + final products = []; + for (final productID in productIDS) { if (validProductIDs.contains(productID)) { products.add(validProducts[productID]!); } } - final List result = []; - for (final SK2Product p in products) { + final result = []; + for (final p in products) { result.add(p.convertToPigeon()); } diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_2_platform_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_2_platform_test.dart index 8ce69c30066..e5b0a748477 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_2_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_2_platform_test.dart @@ -14,7 +14,7 @@ import 'package:in_app_purchase_storekit/store_kit_2_wrappers.dart'; import 'fakes/fake_storekit_platform.dart'; void main() { - final SK2Product dummyProductWrapper = SK2Product( + final dummyProductWrapper = SK2Product( id: '2', displayName: 'name', displayPrice: '0.99', @@ -26,8 +26,8 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); - final FakeStoreKit2Platform fakeStoreKit2Platform = FakeStoreKit2Platform(); - final FakeStoreKitPlatform fakeStoreKitPlatform = FakeStoreKitPlatform(); + final fakeStoreKit2Platform = FakeStoreKit2Platform(); + final fakeStoreKitPlatform = FakeStoreKitPlatform(); late InAppPurchaseStoreKitPlatform iapStoreKitPlatform; @@ -55,7 +55,7 @@ void main() { group('query product list', () { test('should get product list and correct invalid identifiers', () async { - final InAppPurchaseStoreKitPlatform connection = + final connection = InAppPurchaseStoreKitPlatform(); final ProductDetailsResponse response = await connection .queryProductDetails({'123', '456', '789'}); @@ -75,7 +75,7 @@ void main() { message: 'error_message', details: {'info': 'error_info'}, ); - final InAppPurchaseStoreKitPlatform connection = + final connection = InAppPurchaseStoreKitPlatform(); final ProductDetailsResponse response = await connection .queryProductDetails({'123', '456', '789'}); @@ -94,8 +94,8 @@ void main() { test( 'buying non consumable, should get purchase objects in the purchase update callback', () async { - final List details = []; - final Completer> completer = + final details = []; + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -110,7 +110,7 @@ void main() { subscription.cancel(); } }); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProduct2Details.fromSK2Product( dummyProductWrapper, ), @@ -129,8 +129,8 @@ void main() { test( 'buying consumable, should get purchase objects in the purchase update callback', () async { - final List details = []; - final Completer> completer = + final details = []; + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -145,7 +145,7 @@ void main() { subscription.cancel(); } }); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProduct2Details.fromSK2Product( dummyProductWrapper, ), @@ -160,7 +160,7 @@ void main() { ); test('buying consumable, should throw when autoConsume is false', () async { - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProduct2Details.fromSK2Product( dummyProductWrapper, ), @@ -178,8 +178,8 @@ void main() { test( 'buying consumable, should get PurchaseVerificationData with serverVerificationData and localVerificationData', () async { - final List details = []; - final Completer> completer = + final details = []; + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -194,7 +194,7 @@ void main() { subscription.cancel(); } }); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProduct2Details.fromSK2Product( dummyProductWrapper, ), @@ -217,7 +217,7 @@ void main() { ); test('should process Sk2PurchaseParam with winBackOfferId only', () async { - final Sk2PurchaseParam purchaseParam = Sk2PurchaseParam( + final purchaseParam = Sk2PurchaseParam( productDetails: AppStoreProduct2Details.fromSK2Product( dummyProductWrapper, ), @@ -239,7 +239,7 @@ void main() { test( 'should process Sk2PurchaseParam with promotionalOffer only', () async { - final SK2SubscriptionOfferSignature fakeSignature = + final fakeSignature = SK2SubscriptionOfferSignature( keyID: 'key123', signature: 'signature123', @@ -247,7 +247,7 @@ void main() { timestamp: 1234567890, ); - final Sk2PurchaseParam purchaseParam = Sk2PurchaseParam( + final purchaseParam = Sk2PurchaseParam( productDetails: AppStoreProduct2Details.fromSK2Product( dummyProductWrapper, ), @@ -283,7 +283,7 @@ void main() { test( 'should process Sk2PurchaseParam with no winBackOfferId or promotionalOffer', () async { - final Sk2PurchaseParam purchaseParam = Sk2PurchaseParam( + final purchaseParam = Sk2PurchaseParam( productDetails: AppStoreProduct2Details.fromSK2Product( dummyProductWrapper, ), @@ -307,7 +307,7 @@ void main() { test( 'should pass quantity for consumable product with Sk2PurchaseParam', () async { - final Sk2PurchaseParam purchaseParam = Sk2PurchaseParam( + final purchaseParam = Sk2PurchaseParam( productDetails: AppStoreProduct2Details.fromSK2Product( dummyProductWrapper, ), @@ -330,7 +330,7 @@ void main() { test( 'should default to quantity = 1 when not provided in Sk2PurchaseParam', () async { - final Sk2PurchaseParam purchaseParam = Sk2PurchaseParam( + final purchaseParam = Sk2PurchaseParam( productDetails: AppStoreProduct2Details.fromSK2Product( dummyProductWrapper, ), @@ -355,7 +355,7 @@ void main() { fakeStoreKit2Platform.transactionList.add( fakeStoreKit2Platform.createRestoredTransaction('foo', 'RT2'), ); - final Completer> completer = + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -372,7 +372,7 @@ void main() { final List details = await completer.future; expect(details.length, 2); - for (int i = 0; i < fakeStoreKit2Platform.transactionList.length; i++) { + for (var i = 0; i < fakeStoreKit2Platform.transactionList.length; i++) { final SK2TransactionMessage expected = fakeStoreKit2Platform.transactionList[i]; final PurchaseDetails actual = details[i]; @@ -388,7 +388,7 @@ void main() { group('billing configuration', () { test('country_code', () async { - const String expectedCountryCode = 'ABC'; + const expectedCountryCode = 'ABC'; final String countryCode = await iapStoreKitPlatform.countryCode(); expect(countryCode, expectedCountryCode); }); diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_addtion_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_addtion_test.dart index 5e2ad208896..b73b6268139 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_addtion_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_addtion_test.dart @@ -12,7 +12,7 @@ import 'fakes/fake_storekit_platform.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - final FakeStoreKitPlatform fakeStoreKitPlatform = FakeStoreKitPlatform(); + final fakeStoreKitPlatform = FakeStoreKitPlatform(); setUpAll(() { setInAppPurchaseHostApis(api: fakeStoreKitPlatform); diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart index cf793c6c482..9af2ca48d1d 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart @@ -18,7 +18,7 @@ import 'store_kit_wrappers/sk_test_stub_objects.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - final FakeStoreKitPlatform fakeStoreKitPlatform = FakeStoreKitPlatform(); + final fakeStoreKitPlatform = FakeStoreKitPlatform(); late InAppPurchaseStoreKitPlatform iapStoreKitPlatform; setUpAll(() { @@ -43,7 +43,7 @@ void main() { group('query product list', () { test('should get product list and correct invalid identifiers', () async { - final InAppPurchaseStoreKitPlatform connection = + final connection = InAppPurchaseStoreKitPlatform(); final ProductDetailsResponse response = await connection .queryProductDetails({'123', '456', '789', '999'}); @@ -66,7 +66,7 @@ void main() { message: 'error_message', details: {'info': 'error_info'}, ); - final InAppPurchaseStoreKitPlatform connection = + final connection = InAppPurchaseStoreKitPlatform(); final ProductDetailsResponse response = await connection .queryProductDetails({'123', '456', '789'}); @@ -91,7 +91,7 @@ void main() { 1, fakeStoreKitPlatform.createRestoredTransaction('foo', 'RT2'), ); - final Completer> completer = + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -108,7 +108,7 @@ void main() { final List details = await completer.future; expect(details.length, 2); - for (int i = 0; i < fakeStoreKitPlatform.transactionList.length; i++) { + for (var i = 0; i < fakeStoreKitPlatform.transactionList.length; i++) { final SKPaymentTransactionWrapper expected = fakeStoreKitPlatform.transactionList[i]; final PurchaseDetails actual = details[i]; @@ -132,7 +132,7 @@ void main() { 'should emit empty transaction list on purchase stream when there is nothing to restore', () async { fakeStoreKitPlatform.testRestoredTransactionsNull = true; - final Completer?> completer = + final completer = Completer?>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -164,7 +164,7 @@ void main() { 2, fakeStoreKitPlatform.createRestoredTransaction('foo', 'RT2'), ); - final Completer> completer = + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -179,7 +179,7 @@ void main() { await iapStoreKitPlatform.restorePurchases(); final List details = await completer.future; expect(details.length, 3); - for (int i = 0; i < fakeStoreKitPlatform.transactionList.length; i++) { + for (var i = 0; i < fakeStoreKitPlatform.transactionList.length; i++) { final SKPaymentTransactionWrapper expected = fakeStoreKitPlatform.transactionList[i]; final PurchaseDetails actual = details[i]; @@ -212,11 +212,11 @@ void main() { 0, fakeStoreKitPlatform.createPurchasedTransaction('foo', 'bar'), ); - final Completer>> completer = + final completer = Completer>>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; - final List> purchaseDetails = + final purchaseDetails = >[]; late StreamSubscription> subscription; @@ -234,7 +234,7 @@ void main() { final List> details = await completer.future; expect(details.length, 2); expect(details[0], >[]); - for (int i = 0; i < fakeStoreKitPlatform.transactionList.length; i++) { + for (var i = 0; i < fakeStoreKitPlatform.transactionList.length; i++) { final SKPaymentTransactionWrapper expected = fakeStoreKitPlatform.transactionList[i]; final PurchaseDetails actual = details[1][i]; @@ -273,7 +273,7 @@ void main() { fakeStoreKitPlatform.createRestoredTransaction('foo', 'RT2'), ); fakeStoreKitPlatform.receiptData = null; - final Completer> completer = + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -291,7 +291,7 @@ void main() { await iapStoreKitPlatform.restorePurchases(); final List details = await completer.future; - for (final PurchaseDetails purchase in details) { + for (final purchase in details) { expect(purchase.verificationData.localVerificationData, isEmpty); expect(purchase.verificationData.serverVerificationData, isEmpty); } @@ -325,8 +325,8 @@ void main() { test( 'buying non consumable, should get purchase objects in the purchase update callback', () async { - final List details = []; - final Completer> completer = + final details = []; + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -341,7 +341,7 @@ void main() { subscription.cancel(); } }); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProductDetails.fromSKProduct( dummyProductWrapper, ), @@ -360,8 +360,8 @@ void main() { test( 'buying consumable, should get purchase objects in the purchase update callback', () async { - final List details = []; - final Completer> completer = + final details = []; + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -376,7 +376,7 @@ void main() { subscription.cancel(); } }); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProductDetails.fromSKProduct( dummyProductWrapper, ), @@ -391,7 +391,7 @@ void main() { ); test('buying consumable, should throw when autoConsume is false', () async { - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProductDetails.fromSKProduct( dummyProductWrapper, ), @@ -408,8 +408,8 @@ void main() { test('should get failed purchase status', () async { fakeStoreKitPlatform.testTransactionFail = true; - final List details = []; - final Completer completer = Completer(); + final details = []; + final completer = Completer(); late IAPError error; final Stream> stream = @@ -417,7 +417,7 @@ void main() { late StreamSubscription> subscription; subscription = stream.listen((List purchaseDetailsList) { details.addAll(purchaseDetailsList); - for (final PurchaseDetails purchaseDetails in purchaseDetailsList) { + for (final purchaseDetails in purchaseDetailsList) { if (purchaseDetails.status == PurchaseStatus.error) { error = purchaseDetails.error!; completer.complete(error); @@ -425,7 +425,7 @@ void main() { } } }); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProductDetails.fromSKProduct( dummyProductWrapper, ), @@ -446,8 +446,8 @@ void main() { 'should get canceled purchase status when error code is SKErrorPaymentCancelled', () async { fakeStoreKitPlatform.testTransactionCancel = 2; - final List details = []; - final Completer completer = Completer(); + final details = []; + final completer = Completer(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -456,14 +456,14 @@ void main() { List purchaseDetailsList, ) { details.addAll(purchaseDetailsList); - for (final PurchaseDetails purchaseDetails in purchaseDetailsList) { + for (final purchaseDetails in purchaseDetailsList) { if (purchaseDetails.status == PurchaseStatus.canceled) { completer.complete(purchaseDetails.status); subscription.cancel(); } } }); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProductDetails.fromSKProduct( dummyProductWrapper, ), @@ -482,8 +482,8 @@ void main() { 'should get canceled purchase status when error code is SKErrorOverlayCancelled', () async { fakeStoreKitPlatform.testTransactionCancel = 15; - final List details = []; - final Completer completer = Completer(); + final details = []; + final completer = Completer(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -492,14 +492,14 @@ void main() { List purchaseDetailsList, ) { details.addAll(purchaseDetailsList); - for (final PurchaseDetails purchaseDetails in purchaseDetailsList) { + for (final purchaseDetails in purchaseDetailsList) { if (purchaseDetails.status == PurchaseStatus.canceled) { completer.complete(purchaseDetails.status); subscription.cancel(); } } }); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProductDetails.fromSKProduct( dummyProductWrapper, ), @@ -517,8 +517,8 @@ void main() { test( 'buying non consumable, should be able to purchase multiple quantity of one product', () async { - final List details = []; - final Completer> completer = + final details = []; + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -527,7 +527,7 @@ void main() { List purchaseDetailsList, ) { details.addAll(purchaseDetailsList); - for (final PurchaseDetails purchaseDetails in purchaseDetailsList) { + for (final purchaseDetails in purchaseDetailsList) { if (purchaseDetails.pendingCompletePurchase) { iapStoreKitPlatform.completePurchase(purchaseDetails); completer.complete(details); @@ -535,9 +535,9 @@ void main() { } } }); - final AppStoreProductDetails productDetails = + final productDetails = AppStoreProductDetails.fromSKProduct(dummyProductWrapper); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: productDetails, quantity: 5, applicationUserName: 'appName', @@ -556,8 +556,8 @@ void main() { test( 'buying consumable, should be able to purchase multiple quantity of one product', () async { - final List details = []; - final Completer> completer = + final details = []; + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -566,7 +566,7 @@ void main() { List purchaseDetailsList, ) { details.addAll(purchaseDetailsList); - for (final PurchaseDetails purchaseDetails in purchaseDetailsList) { + for (final purchaseDetails in purchaseDetailsList) { if (purchaseDetails.pendingCompletePurchase) { iapStoreKitPlatform.completePurchase(purchaseDetails); completer.complete(details); @@ -574,9 +574,9 @@ void main() { } } }); - final AppStoreProductDetails productDetails = + final productDetails = AppStoreProductDetails.fromSKProduct(dummyProductWrapper); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: productDetails, quantity: 5, applicationUserName: 'appName', @@ -593,8 +593,8 @@ void main() { test( 'buying non consumable with discount, should get purchase objects in the purchase update callback', () async { - final List details = []; - final Completer> completer = + final details = []; + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; @@ -609,7 +609,7 @@ void main() { subscription.cancel(); } }); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProductDetails.fromSKProduct( dummyProductWrapper, ), @@ -633,15 +633,15 @@ void main() { group('complete purchase', () { test('should complete purchase', () async { - final List details = []; - final Completer> completer = + final details = []; + final completer = Completer>(); final Stream> stream = iapStoreKitPlatform.purchaseStream; late StreamSubscription> subscription; subscription = stream.listen((List purchaseDetailsList) { details.addAll(purchaseDetailsList); - for (final PurchaseDetails purchaseDetails in purchaseDetailsList) { + for (final purchaseDetails in purchaseDetailsList) { if (purchaseDetails.pendingCompletePurchase) { iapStoreKitPlatform.completePurchase(purchaseDetails); completer.complete(details); @@ -649,7 +649,7 @@ void main() { } } }); - final AppStorePurchaseParam purchaseParam = AppStorePurchaseParam( + final purchaseParam = AppStorePurchaseParam( productDetails: AppStoreProductDetails.fromSKProduct( dummyProductWrapper, ), @@ -683,7 +683,7 @@ void main() { group('billing configuration', () { test('country_code', () async { - const String expectedCountryCode = 'CA'; + const expectedCountryCode = 'CA'; fakeStoreKitPlatform.setStoreFrontInfo( countryCode: expectedCountryCode, identifier: 'ABC', diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/pigeon_converter_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/pigeon_converter_test.dart index 1434f6fd767..566f83c3143 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/pigeon_converter_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/pigeon_converter_test.dart @@ -8,19 +8,19 @@ import 'package:in_app_purchase_storekit/src/store_kit_2_wrappers/sk2_product_wr import 'package:in_app_purchase_storekit/store_kit_wrappers.dart'; void main() { - final SKPriceLocaleWrapper locale = SKPriceLocaleWrapper( + final locale = SKPriceLocaleWrapper( currencySymbol: r'$', currencyCode: 'USD', countryCode: 'USA', ); - final SKProductSubscriptionPeriodWrapper subPeriod = + final subPeriod = SKProductSubscriptionPeriodWrapper( numberOfUnits: 1, unit: SKSubscriptionPeriodUnit.month, ); - final SKProductDiscountWrapper discount = SKProductDiscountWrapper( + final discount = SKProductDiscountWrapper( price: '0.99', priceLocale: locale, numberOfPeriods: 1, @@ -30,7 +30,7 @@ void main() { type: SKProductDiscountType.subscription, ); - final SKProductWrapper product = SKProductWrapper( + final product = SKProductWrapper( productIdentifier: 'fake_product', localizedTitle: 'title', localizedDescription: 'description', @@ -40,7 +40,7 @@ void main() { discounts: [discount], ); - final SkProductResponseWrapper productResponse = SkProductResponseWrapper( + final productResponse = SkProductResponseWrapper( products: [product], invalidProductIdentifiers: const ['invalid_identifier'], ); @@ -107,7 +107,7 @@ void main() { }); test('test SKerror pigeon converter', () { - final SKErrorMessage msg = SKErrorMessage(code: 99, domain: 'domain'); + final msg = SKErrorMessage(code: 99, domain: 'domain'); final SKError wrapper = SKError.convertFromPigeon(msg); expect(wrapper.code, 99); @@ -116,7 +116,7 @@ void main() { }); test('test AppStoreProduct2Details conversion', () { - final SK2Product product = SK2Product( + final product = SK2Product( id: '123', displayName: 'name', displayPrice: '0.99', @@ -126,7 +126,7 @@ void main() { priceLocale: SK2PriceLocale(currencyCode: 'USD', currencySymbol: r'$'), ); - final AppStoreProduct2Details details = + final details = AppStoreProduct2Details.fromSK2Product(product); expect(details.sk2Product, product); diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_methodchannel_apis_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_methodchannel_apis_test.dart index 497c567bbf6..0b5ec0d0d8e 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_methodchannel_apis_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_methodchannel_apis_test.dart @@ -12,7 +12,7 @@ import 'sk_test_stub_objects.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - final FakeStoreKitPlatform fakeStoreKitPlatform = FakeStoreKitPlatform(); + final fakeStoreKitPlatform = FakeStoreKitPlatform(); setUpAll(() { setInAppPurchaseHostApis(api: fakeStoreKitPlatform); @@ -98,7 +98,7 @@ void main() { }); test('storefront returns valid SKStoreFrontWrapper object', () async { - final SKPaymentQueueWrapper queue = SKPaymentQueueWrapper(); + final queue = SKPaymentQueueWrapper(); expect( await queue.storefront(), SKStorefrontWrapper.fromJson(const { @@ -123,8 +123,8 @@ void main() { ); test('should add payment to the payment queue', () async { - final SKPaymentQueueWrapper queue = SKPaymentQueueWrapper(); - final TestPaymentTransactionObserver observer = + final queue = SKPaymentQueueWrapper(); + final observer = TestPaymentTransactionObserver(); queue.setTransactionObserver(observer); await queue.addPayment(dummyPayment); @@ -132,8 +132,8 @@ void main() { }); test('should finish transaction', () async { - final SKPaymentQueueWrapper queue = SKPaymentQueueWrapper(); - final TestPaymentTransactionObserver observer = + final queue = SKPaymentQueueWrapper(); + final observer = TestPaymentTransactionObserver(); queue.setTransactionObserver(observer); await queue.finishTransaction(dummyTransaction); @@ -144,8 +144,8 @@ void main() { }); test('should restore transaction', () async { - final SKPaymentQueueWrapper queue = SKPaymentQueueWrapper(); - final TestPaymentTransactionObserver observer = + final queue = SKPaymentQueueWrapper(); + final observer = TestPaymentTransactionObserver(); queue.setTransactionObserver(observer); await queue.restoreTransactions(applicationUserName: 'aUserID'); diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_payment_queue_delegate_api_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_payment_queue_delegate_api_test.dart index 08eca698b1a..a4a9c2e3cbb 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_payment_queue_delegate_api_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_payment_queue_delegate_api_test.dart @@ -12,7 +12,7 @@ import '../fakes/fake_storekit_platform.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - final FakeStoreKitPlatform fakeStoreKitPlatform = FakeStoreKitPlatform(); + final fakeStoreKitPlatform = FakeStoreKitPlatform(); setUpAll(() { setInAppPurchaseHostApis(api: fakeStoreKitPlatform); @@ -21,11 +21,11 @@ void main() { test( 'handlePaymentQueueDelegateCallbacks should call SKPaymentQueueDelegateWrapper.shouldContinueTransaction', () async { - final SKPaymentQueueWrapper queue = SKPaymentQueueWrapper(); - final TestPaymentQueueDelegate testDelegate = TestPaymentQueueDelegate(); + final queue = SKPaymentQueueWrapper(); + final testDelegate = TestPaymentQueueDelegate(); await queue.setDelegate(testDelegate); - final Map arguments = { + final arguments = { 'storefront': { 'countryCode': 'USA', 'identifier': 'unique_identifier', @@ -49,11 +49,11 @@ void main() { test( 'handlePaymentQueueDelegateCallbacks should call SKPaymentQueueDelegateWrapper.shouldShowPriceConsent', () async { - final SKPaymentQueueWrapper queue = SKPaymentQueueWrapper(); - final TestPaymentQueueDelegate testDelegate = TestPaymentQueueDelegate(); + final queue = SKPaymentQueueWrapper(); + final testDelegate = TestPaymentQueueDelegate(); await queue.setDelegate(testDelegate); - final bool result = + final result = (await queue.handlePaymentQueueDelegateCallbacks( const MethodCall('shouldShowPriceConsent'), ))! @@ -67,12 +67,12 @@ void main() { test( 'handleObserverCallbacks should call SKTransactionObserverWrapper.restoreCompletedTransactionsFailed', () async { - final SKPaymentQueueWrapper queue = SKPaymentQueueWrapper(); - final TestTransactionObserverWrapper testObserver = + final queue = SKPaymentQueueWrapper(); + final testObserver = TestTransactionObserverWrapper(); queue.setTransactionObserver(testObserver); - final Map arguments = { + final arguments = { 'code': 100, 'domain': 'domain', 'userInfo': {'error': 'underlying_error'}, diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_product_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_product_test.dart index 4ac472e31e7..c048391d562 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_product_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_product_test.dart @@ -14,7 +14,7 @@ void main() { test( 'SKProductSubscriptionPeriodWrapper should have property values consistent with map', () { - final SKProductSubscriptionPeriodWrapper wrapper = + final wrapper = SKProductSubscriptionPeriodWrapper.fromJson( buildSubscriptionPeriodMap(dummySubscription), ); @@ -25,7 +25,7 @@ void main() { test( 'SKProductSubscriptionPeriodWrapper should have properties to be default values if map is empty', () { - final SKProductSubscriptionPeriodWrapper wrapper = + final wrapper = SKProductSubscriptionPeriodWrapper.fromJson( const {}, ); @@ -37,7 +37,7 @@ void main() { test( 'SKProductDiscountWrapper should have property values consistent with map', () { - final SKProductDiscountWrapper wrapper = + final wrapper = SKProductDiscountWrapper.fromJson(buildDiscountMap(dummyDiscount)); expect(wrapper, equals(dummyDiscount)); }, @@ -45,7 +45,7 @@ void main() { test('SKProductDiscountWrapper missing identifier and type should have ' 'property values consistent with map', () { - final SKProductDiscountWrapper wrapper = + final wrapper = SKProductDiscountWrapper.fromJson( buildDiscountMapMissingIdentifierAndType( dummyDiscountMissingIdentifierAndType, @@ -57,7 +57,7 @@ void main() { test( 'SKProductDiscountWrapper should have properties to be default if map is empty', () { - final SKProductDiscountWrapper wrapper = + final wrapper = SKProductDiscountWrapper.fromJson(const {}); expect(wrapper.price, ''); expect( @@ -83,7 +83,7 @@ void main() { test( 'SKProductWrapper should have property values consistent with map', () { - final SKProductWrapper wrapper = SKProductWrapper.fromJson( + final wrapper = SKProductWrapper.fromJson( buildProductMap(dummyProductWrapper), ); expect(wrapper, equals(dummyProductWrapper)); @@ -93,7 +93,7 @@ void main() { test( 'SKProductWrapper should have properties to be default if map is empty', () { - final SKProductWrapper wrapper = SKProductWrapper.fromJson( + final wrapper = SKProductWrapper.fromJson( const {}, ); expect(wrapper.productIdentifier, ''); @@ -115,10 +115,10 @@ void main() { ); test('toProductDetails() should return correct Product object', () { - final SKProductWrapper wrapper = SKProductWrapper.fromJson( + final wrapper = SKProductWrapper.fromJson( buildProductMap(dummyProductWrapper), ); - final AppStoreProductDetails product = + final product = AppStoreProductDetails.fromSKProduct(wrapper); expect(product.title, wrapper.localizedTitle); expect(product.description, wrapper.localizedDescription); @@ -128,26 +128,26 @@ void main() { }); test('SKProductResponse wrapper should match', () { - final SkProductResponseWrapper wrapper = + final wrapper = SkProductResponseWrapper.fromJson( buildProductResponseMap(dummyProductResponseWrapper), ); expect(wrapper, equals(dummyProductResponseWrapper)); }); test('SKProductResponse wrapper should default to empty list', () { - final Map> productResponseMapEmptyList = + final productResponseMapEmptyList = >{ 'products': >[], 'invalidProductIdentifiers': [], }; - final SkProductResponseWrapper wrapper = + final wrapper = SkProductResponseWrapper.fromJson(productResponseMapEmptyList); expect(wrapper.products.length, 0); expect(wrapper.invalidProductIdentifiers.length, 0); }); test('LocaleWrapper should have property values consistent with map', () { - final SKPriceLocaleWrapper wrapper = SKPriceLocaleWrapper.fromJson( + final wrapper = SKPriceLocaleWrapper.fromJson( buildLocaleMap(dollarLocale), ); expect(wrapper, equals(dollarLocale)); @@ -156,7 +156,7 @@ void main() { group('Payment queue related object tests', () { test('Should construct correct SKPaymentWrapper from json', () { - final SKPaymentWrapper payment = SKPaymentWrapper.fromJson( + final payment = SKPaymentWrapper.fromJson( dummyPayment.toMap(), ); expect(payment, equals(dummyPayment)); @@ -188,12 +188,12 @@ void main() { ); test('Should construct correct SKError from json', () { - final SKError error = SKError.fromJson(buildErrorMap(dummyError)); + final error = SKError.fromJson(buildErrorMap(dummyError)); expect(error, equals(dummyError)); }); test('Should construct correct SKTransactionWrapper from json', () { - final SKPaymentTransactionWrapper transaction = + final transaction = SKPaymentTransactionWrapper.fromJson( buildTransactionMap(dummyTransaction), ); @@ -201,7 +201,7 @@ void main() { }); test('toPurchaseDetails() should return correct PurchaseDetail object', () { - final AppStorePurchaseDetails details = + final details = AppStorePurchaseDetails.fromSKTransaction( dummyTransaction, 'receipt data', @@ -221,7 +221,7 @@ void main() { }); test('SKPaymentTransactionWrapper.toFinishMap set correct value', () { - final SKPaymentTransactionWrapper transactionWrapper = + final transactionWrapper = SKPaymentTransactionWrapper( payment: dummyPayment, transactionState: SKPaymentTransactionStateWrapper.failed, @@ -235,7 +235,7 @@ void main() { test( 'SKPaymentTransactionWrapper.toFinishMap should set transactionIdentifier to null when necessary', () { - final SKPaymentTransactionWrapper transactionWrapper = + final transactionWrapper = SKPaymentTransactionWrapper( payment: dummyPayment, transactionState: SKPaymentTransactionStateWrapper.failed, diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_test_stub_objects.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_test_stub_objects.dart index 43496478f24..cd8ceb1f6ca 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_test_stub_objects.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/store_kit_wrappers/sk_test_stub_objects.dart @@ -249,7 +249,7 @@ Map buildErrorMap(SKError error) { Map buildTransactionMap( SKPaymentTransactionWrapper transaction, ) { - final Map map = { + final map = { 'transactionState': SKPaymentTransactionStateWrapper.values.indexOf( SKPaymentTransactionStateWrapper.purchased, ), @@ -267,7 +267,7 @@ Map buildTransactionMap( Map buildTransactionMessage( SKPaymentTransactionWrapper transaction, ) { - final Map map = { + final map = { 'transactionState': SKPaymentTransactionStateWrapper.values.indexOf( SKPaymentTransactionStateWrapper.purchased, ), diff --git a/packages/interactive_media_ads/lib/src/android/android_ad_display_container.dart b/packages/interactive_media_ads/lib/src/android/android_ad_display_container.dart index 2a55badc033..d47c674920a 100644 --- a/packages/interactive_media_ads/lib/src/android/android_ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/android/android_ad_display_container.dart @@ -65,7 +65,7 @@ final class AndroidAdDisplayContainerCreationParams base class AndroidAdDisplayContainer extends PlatformAdDisplayContainer { /// Constructs an [AndroidAdDisplayContainer]. AndroidAdDisplayContainer(super.params) : super.implementation() { - final WeakReference weakThis = + final weakThis = WeakReference(this); _videoView = _setUpVideoView(weakThis); _frameLayout.addView(_videoView); diff --git a/packages/interactive_media_ads/lib/src/android/android_ads_rendering_settings.dart b/packages/interactive_media_ads/lib/src/android/android_ads_rendering_settings.dart index 3a1ac4f271a..517bb2200b5 100644 --- a/packages/interactive_media_ads/lib/src/android/android_ads_rendering_settings.dart +++ b/packages/interactive_media_ads/lib/src/android/android_ads_rendering_settings.dart @@ -54,7 +54,7 @@ final class AndroidAdsRenderingSettingsCreationParams base class AndroidAdsRenderingSettings extends PlatformAdsRenderingSettings { /// Constructs an [AndroidAdsRenderingSettings]. AndroidAdsRenderingSettings(super.params) : super.implementation() { - final Completer nativeSettingsCompleter = + final nativeSettingsCompleter = Completer(); nativeSettings = nativeSettingsCompleter.future; diff --git a/packages/interactive_media_ads/lib/src/ios/ios_ima_settings.dart b/packages/interactive_media_ads/lib/src/ios/ios_ima_settings.dart index f858619488f..6131c68010f 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_ima_settings.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_ima_settings.dart @@ -66,7 +66,7 @@ final class IOSImaSettings extends PlatformImaSettings { } IMASettings _createSettings() { - final IMASettings settings = IMASettings(); + final settings = IMASettings(); if (params.language case final String language) { settings.setLanguage(language); } diff --git a/packages/interactive_media_ads/test/ad_display_container_test.dart b/packages/interactive_media_ads/test/ad_display_container_test.dart index c20a19ff89e..327fa32f772 100644 --- a/packages/interactive_media_ads/test/ad_display_container_test.dart +++ b/packages/interactive_media_ads/test/ad_display_container_test.dart @@ -14,7 +14,7 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); testWidgets('build', (WidgetTester tester) async { - final TestPlatformAdDisplayContainer adDisplayContainer = + final adDisplayContainer = TestPlatformAdDisplayContainer( PlatformAdDisplayContainerCreationParams(onContainerAdded: (_) {}), onBuild: (_) => Container(), @@ -50,7 +50,7 @@ void main() { }, ); - final AdDisplayContainer adDisplayContainer = AdDisplayContainer( + final adDisplayContainer = AdDisplayContainer( key: GlobalKey(), onContainerAdded: (_) {}, ); diff --git a/packages/interactive_media_ads/test/ads_loader_test.dart b/packages/interactive_media_ads/test/ads_loader_test.dart index 8895810cf1e..8fbc27b5c9c 100644 --- a/packages/interactive_media_ads/test/ads_loader_test.dart +++ b/packages/interactive_media_ads/test/ads_loader_test.dart @@ -11,7 +11,7 @@ import 'test_stubs.dart'; void main() { test('contentComplete', () async { - final TestPlatformAdsLoader adsLoader = TestPlatformAdsLoader( + final adsLoader = TestPlatformAdsLoader( PlatformAdsLoaderCreationParams( container: createTestAdDisplayContainer(), settings: TestImaSettings(const PlatformImaSettingsCreationParams()), @@ -22,12 +22,12 @@ void main() { onRequestAds: (PlatformAdsRequest request) async {}, ); - final AdsLoader loader = AdsLoader.fromPlatform(adsLoader); + final loader = AdsLoader.fromPlatform(adsLoader); await loader.contentComplete(); }); test('requestAds', () async { - final PlatformAdsRequest platformRequest = PlatformAdsRequest.withAdTagUrl( + final platformRequest = PlatformAdsRequest.withAdTagUrl( adTagUrl: 'adTagUrl', adWillAutoPlay: true, adWillPlayMuted: false, @@ -42,7 +42,7 @@ void main() { ), ); - final TestPlatformAdsLoader adsLoader = TestPlatformAdsLoader( + final adsLoader = TestPlatformAdsLoader( PlatformAdsLoaderCreationParams( container: createTestAdDisplayContainer(), settings: TestImaSettings(const PlatformImaSettingsCreationParams()), @@ -73,7 +73,7 @@ void main() { onContentComplete: () async {}, ); - final AdsLoader loader = AdsLoader.fromPlatform(adsLoader); + final loader = AdsLoader.fromPlatform(adsLoader); await loader.requestAds( AdsRequest( adTagUrl: (platformRequest as PlatformAdsRequestWithAdTagUrl).adTagUrl, diff --git a/packages/interactive_media_ads/test/ads_manager_delegate_test.dart b/packages/interactive_media_ads/test/ads_manager_delegate_test.dart index 8f1454bd54a..7561421eb66 100644 --- a/packages/interactive_media_ads/test/ads_manager_delegate_test.dart +++ b/packages/interactive_media_ads/test/ads_manager_delegate_test.dart @@ -28,7 +28,7 @@ void main() { void onAdErrorEvent(AdErrorEvent event) {} - final AdsManagerDelegate delegate = AdsManagerDelegate( + final delegate = AdsManagerDelegate( onAdEvent: expectAsync1((AdEvent event) { expect(event.type, AdEventType.adBreakEnded); expect(event.ad, isNotNull); diff --git a/packages/interactive_media_ads/test/ads_manager_test.dart b/packages/interactive_media_ads/test/ads_manager_test.dart index bc74489c0fc..a67065bcaa7 100644 --- a/packages/interactive_media_ads/test/ads_manager_test.dart +++ b/packages/interactive_media_ads/test/ads_manager_test.dart @@ -13,17 +13,17 @@ import 'test_stubs.dart'; void main() { test('init', () async { - final AdsRenderingSettings adsRenderingSettings = + final adsRenderingSettings = AdsRenderingSettings.fromPlatform( TestAdsRenderingSettings( const PlatformAdsRenderingSettingsCreationParams(), ), ); - final Completer settingsCompleter = + final settingsCompleter = Completer(); - final TestAdsManager platformManager = TestAdsManager( + final platformManager = TestAdsManager( onInit: ({PlatformAdsRenderingSettings? settings}) async { settingsCompleter.complete(settings); }, @@ -35,7 +35,7 @@ void main() { }); test('start', () async { - final TestAdsManager platformManager = TestAdsManager( + final platformManager = TestAdsManager( onStart: expectAsync1((_) async {}), ); @@ -44,7 +44,7 @@ void main() { }); test('setAdsManagerDelegate', () async { - final TestAdsManager platformManager = TestAdsManager( + final platformManager = TestAdsManager( onSetAdsManagerDelegate: expectAsync1((_) async {}), ); @@ -59,7 +59,7 @@ void main() { }); test('discardAdBreak', () async { - final TestAdsManager platformManager = TestAdsManager( + final platformManager = TestAdsManager( onDiscardAdBreak: expectAsync0(() async {}), ); @@ -68,7 +68,7 @@ void main() { }); test('pause', () async { - final TestAdsManager platformManager = TestAdsManager( + final platformManager = TestAdsManager( onPause: expectAsync0(() async {}), ); @@ -77,7 +77,7 @@ void main() { }); test('resume', () async { - final TestAdsManager platformManager = TestAdsManager( + final platformManager = TestAdsManager( onResume: expectAsync0(() async {}), ); @@ -86,7 +86,7 @@ void main() { }); test('skip', () async { - final TestAdsManager platformManager = TestAdsManager( + final platformManager = TestAdsManager( onSkip: expectAsync0(() async {}), ); @@ -95,7 +95,7 @@ void main() { }); test('destroy', () async { - final TestAdsManager platformManager = TestAdsManager( + final platformManager = TestAdsManager( onDestroy: expectAsync0(() async {}), ); @@ -104,7 +104,7 @@ void main() { }); test('adCuePoints', () async { - final TestAdsManager platformManager = TestAdsManager( + final platformManager = TestAdsManager( adCuePoints: const [Duration(seconds: 5)], ); @@ -135,7 +135,7 @@ AdsManager createAdsManager(PlatformAdsManager platformManager) { late final AdsManager manager; - final AdsLoader loader = AdsLoader( + final loader = AdsLoader( container: AdDisplayContainer.fromPlatform( platform: TestPlatformAdDisplayContainer( PlatformAdDisplayContainerCreationParams(onContainerAdded: (_) {}), diff --git a/packages/interactive_media_ads/test/android/ad_display_container_test.dart b/packages/interactive_media_ads/test/android/ad_display_container_test.dart index 854b8048f44..79e058a14b9 100644 --- a/packages/interactive_media_ads/test/android/ad_display_container_test.dart +++ b/packages/interactive_media_ads/test/android/ad_display_container_test.dart @@ -39,7 +39,7 @@ void main() { group('AndroidAdDisplayContainer', () { testWidgets('build with key', (WidgetTester tester) async { - final AndroidAdDisplayContainer container = AndroidAdDisplayContainer( + final container = AndroidAdDisplayContainer( AndroidAdDisplayContainerCreationParams( key: const Key('testKey'), onContainerAdded: (_) {}, @@ -55,7 +55,7 @@ void main() { }); testWidgets('onContainerAdded is called', (WidgetTester tester) async { - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => MockFrameLayout(), newVideoView: ({ @@ -78,9 +78,9 @@ void main() { }) => MockVideoAdPlayer(), ); - final MockPlatformViewsServiceProxy mockPlatformViewsProxy = + final mockPlatformViewsProxy = MockPlatformViewsServiceProxy(); - final MockSurfaceAndroidViewController mockAndroidViewController = + final mockAndroidViewController = MockSurfaceAndroidViewController(); late final int platformViewId; @@ -98,7 +98,7 @@ void main() { return mockAndroidViewController; }); - final AndroidAdDisplayContainer container = AndroidAdDisplayContainer( + final container = AndroidAdDisplayContainer( AndroidAdDisplayContainerCreationParams( onContainerAdded: expectAsync1((_) {}), platformViewsProxy: mockPlatformViewsProxy, @@ -110,7 +110,7 @@ void main() { Builder(builder: (BuildContext context) => container.build(context)), ); - final void Function(int) onPlatformCreatedCallback = + final onPlatformCreatedCallback = verify( mockAndroidViewController.addOnPlatformViewCreatedListener( captureAny, @@ -137,7 +137,7 @@ void main() { late final void Function(ima.VideoView, ima.MediaPlayer) onCompletionCallback; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => MockFrameLayout(), newVideoView: ({ @@ -186,7 +186,7 @@ void main() { final ima.AdMediaInfo mockAdMediaInfo = MockAdMediaInfo(); loadAdCallback(MockVideoAdPlayer(), mockAdMediaInfo, MockAdPodInfo()); - final MockVideoAdPlayerCallback mockPlayerCallback = + final mockPlayerCallback = MockVideoAdPlayerCallback(); addCallbackCallback(MockVideoAdPlayer(), mockPlayerCallback); @@ -209,7 +209,7 @@ void main() { late final void Function(ima.VideoView, ima.MediaPlayer, int, int) onErrorCallback; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => MockFrameLayout(), newVideoView: ({ @@ -259,7 +259,7 @@ void main() { final ima.AdMediaInfo mockAdMediaInfo = MockAdMediaInfo(); loadAdCallback(MockVideoAdPlayer(), mockAdMediaInfo, MockAdPodInfo()); - final MockVideoAdPlayerCallback mockPlayerCallback = + final mockPlayerCallback = MockVideoAdPlayerCallback(); addCallbackCallback(MockVideoAdPlayer(), mockPlayerCallback); @@ -285,10 +285,10 @@ void main() { late final void Function(ima.VideoAdPlayer, ima.AdMediaInfo) playAdCallback; - const int adDuration = 100; - const int adProgress = 10; + const adDuration = 100; + const adProgress = 10; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => MockFrameLayout(), newVideoView: ({ @@ -297,7 +297,7 @@ void main() { dynamic onCompletion, }) { onPreparedCallback = onPrepared!; - final MockVideoView mockVideoView = MockVideoView(); + final mockVideoView = MockVideoView(); when( mockVideoView.getCurrentPosition(), ).thenAnswer((_) async => adProgress); @@ -349,11 +349,11 @@ void main() { loadAdCallback(MockVideoAdPlayer(), mockAdMediaInfo, MockAdPodInfo()); playAdCallback(MockVideoAdPlayer(), mockAdMediaInfo); - final MockVideoAdPlayerCallback mockPlayerCallback = + final mockPlayerCallback = MockVideoAdPlayerCallback(); addCallbackCallback(MockVideoAdPlayer(), mockPlayerCallback); - final MockMediaPlayer mockMediaPlayer = MockMediaPlayer(); + final mockMediaPlayer = MockMediaPlayer(); when(mockMediaPlayer.getDuration()).thenAnswer((_) async => adDuration); await onPreparedCallback(MockVideoView(), mockMediaPlayer); @@ -380,7 +380,7 @@ void main() { late final Future Function(ima.VideoAdPlayer, ima.AdMediaInfo) pauseAdCallback; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => MockFrameLayout(), newVideoView: ({ @@ -393,7 +393,7 @@ void main() { onPreparedCallback = onPrepared! as Future Function(ima.VideoView, ima.MediaPlayer); - final MockVideoView mockVideoView = MockVideoView(); + final mockVideoView = MockVideoView(); when( mockVideoView.getCurrentPosition(), ).thenAnswer((_) async => 10); @@ -444,7 +444,7 @@ void main() { final ima.AdMediaInfo mockAdMediaInfo = MockAdMediaInfo(); loadAdCallback(MockVideoAdPlayer(), mockAdMediaInfo, MockAdPodInfo()); - final MockMediaPlayer mockMediaPlayer = MockMediaPlayer(); + final mockMediaPlayer = MockMediaPlayer(); when(mockMediaPlayer.getDuration()).thenAnswer((_) async => 100); await onPreparedCallback(MockVideoView(), mockMediaPlayer); @@ -470,7 +470,7 @@ void main() { late final Future Function(ima.VideoAdPlayer, ima.AdMediaInfo) pauseAdCallback; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => MockFrameLayout(), newVideoView: ({ @@ -483,7 +483,7 @@ void main() { onPreparedCallback = onPrepared! as Future Function(ima.VideoView, ima.MediaPlayer); - final MockVideoView mockVideoView = MockVideoView(); + final mockVideoView = MockVideoView(); when( mockVideoView.getCurrentPosition(), ).thenAnswer((_) async => 10); @@ -535,7 +535,7 @@ void main() { final ima.AdMediaInfo mockAdMediaInfo = MockAdMediaInfo(); loadAdCallback(MockVideoAdPlayer(), mockAdMediaInfo, MockAdPodInfo()); - final MockMediaPlayer mockMediaPlayer = MockMediaPlayer(); + final mockMediaPlayer = MockMediaPlayer(); when(mockMediaPlayer.getDuration()).thenAnswer((_) async => 100); await onPreparedCallback(MockVideoView(), mockMediaPlayer); @@ -562,7 +562,7 @@ void main() { late final void Function(ima.VideoAdPlayer, ima.AdMediaInfo) playAdCallback; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => MockFrameLayout(), newVideoView: ({ @@ -575,7 +575,7 @@ void main() { onPreparedCallback = onPrepared! as Future Function(ima.VideoView, ima.MediaPlayer); - final MockVideoView mockVideoView = MockVideoView(); + final mockVideoView = MockVideoView(); when( mockVideoView.getCurrentPosition(), ).thenAnswer((_) async => 10); @@ -628,7 +628,7 @@ void main() { when(mockAdMediaInfo.url).thenReturn('url'); loadAdCallback(MockVideoAdPlayer(), mockAdMediaInfo, MockAdPodInfo()); - final MockMediaPlayer mockMediaPlayer = MockMediaPlayer(); + final mockMediaPlayer = MockMediaPlayer(); when(mockMediaPlayer.getDuration()).thenAnswer((_) async => 100); await onPreparedCallback(MockVideoView(), mockMediaPlayer); @@ -658,8 +658,8 @@ void main() { late final void Function(ima.VideoAdPlayer, ima.AdMediaInfo) playAdCallback; - final MockVideoView mockVideoView = MockVideoView(); - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final mockVideoView = MockVideoView(); + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => MockFrameLayout(), newVideoView: ({dynamic onError, dynamic onPrepared, dynamic onCompletion}) { @@ -696,7 +696,7 @@ void main() { ), ); - const String videoUrl = 'url'; + const videoUrl = 'url'; final ima.AdMediaInfo mockAdMediaInfo = MockAdMediaInfo(); when(mockAdMediaInfo.url).thenReturn(videoUrl); loadAdCallback(MockVideoAdPlayer(), mockAdMediaInfo, MockAdPodInfo()); @@ -709,11 +709,11 @@ void main() { late final void Function(ima.VideoAdPlayer, ima.AdMediaInfo) stopAdCallback; - final MockFrameLayout mockFrameLayout = MockFrameLayout(); - late final MockVideoView mockVideoView = MockVideoView(); - late final MockVideoView mockVideoView2 = MockVideoView(); - int newViewVideoCallCount = 0; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final mockFrameLayout = MockFrameLayout(); + late final mockVideoView = MockVideoView(); + late final mockVideoView2 = MockVideoView(); + var newViewVideoCallCount = 0; + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => mockFrameLayout, newVideoView: ({dynamic onError, dynamic onPrepared, dynamic onCompletion}) { @@ -768,11 +768,11 @@ void main() { test('release resets state and sets a new VideoView', () async { late final void Function(ima.VideoAdPlayer) releaseCallback; - final MockFrameLayout mockFrameLayout = MockFrameLayout(); - late final MockVideoView mockVideoView = MockVideoView(); - late final MockVideoView mockVideoView2 = MockVideoView(); - int newViewVideoCallCount = 0; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final mockFrameLayout = MockFrameLayout(); + late final mockVideoView = MockVideoView(); + late final mockVideoView2 = MockVideoView(); + var newViewVideoCallCount = 0; + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => mockFrameLayout, newVideoView: ({dynamic onError, dynamic onPrepared, dynamic onCompletion}) { @@ -827,10 +827,10 @@ void main() { testWidgets('AdDisplayContainer adds CompanionAdSlots', ( WidgetTester tester, ) async { - final MockAdDisplayContainer mockAdDisplayContainer = + final mockAdDisplayContainer = MockAdDisplayContainer(); - final MockCompanionAdSlot mockCompanionAdSlot = MockCompanionAdSlot(); - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final mockCompanionAdSlot = MockCompanionAdSlot(); + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => MockFrameLayout(), newVideoView: ({ @@ -852,7 +852,7 @@ void main() { required dynamic stopAd, }) => MockVideoAdPlayer(), instanceImaSdkFactory: () { - final MockImaSdkFactory mockFactory = MockImaSdkFactory(); + final mockFactory = MockImaSdkFactory(); when( mockFactory.createCompanionAdSlot(), ).thenAnswer((_) async => mockCompanionAdSlot); @@ -860,9 +860,9 @@ void main() { }, ); - final MockPlatformViewsServiceProxy mockPlatformViewsProxy = + final mockPlatformViewsProxy = MockPlatformViewsServiceProxy(); - final MockSurfaceAndroidViewController mockAndroidViewController = + final mockAndroidViewController = MockSurfaceAndroidViewController(); late final int platformViewId; @@ -880,9 +880,9 @@ void main() { return mockAndroidViewController; }); - final Completer onContainerAddedCompleter = Completer(); + final onContainerAddedCompleter = Completer(); - final AndroidAdDisplayContainer container = AndroidAdDisplayContainer( + final container = AndroidAdDisplayContainer( AndroidAdDisplayContainerCreationParams( onContainerAdded: (_) => onContainerAddedCompleter.complete(), platformViewsProxy: mockPlatformViewsProxy, @@ -902,7 +902,7 @@ void main() { Builder(builder: (BuildContext context) => container.build(context)), ); - final void Function(int) onPlatformCreatedCallback = + final onPlatformCreatedCallback = verify( mockAndroidViewController.addOnPlatformViewCreatedListener( captureAny, @@ -937,8 +937,8 @@ void main() { late final void Function(ima.VideoAdPlayer, ima.AdMediaInfo) stopAdCallback; - final MockVideoView mockVideoView = MockVideoView(); - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final mockVideoView = MockVideoView(); + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => MockFrameLayout(), newVideoView: ({ @@ -985,7 +985,7 @@ void main() { ), ); - final MockVideoAdPlayerCallback mockPlayerCallback = + final mockPlayerCallback = MockVideoAdPlayerCallback(); addCallbackCallback(MockVideoAdPlayer(), mockPlayerCallback); diff --git a/packages/interactive_media_ads/test/android/ad_test.dart b/packages/interactive_media_ads/test/android/ad_test.dart index 94153f8a725..ebcecf6b884 100644 --- a/packages/interactive_media_ads/test/android/ad_test.dart +++ b/packages/interactive_media_ads/test/android/ad_test.dart @@ -26,7 +26,7 @@ void main() { }); test('UniversalAdId sets unknown values to null', () async { - final MockAdsManager mockAdsManager = MockAdsManager(); + final mockAdsManager = MockAdsManager(); late final void Function(ima.AdEventListener, ima.AdEvent) onAdEventCallback; @@ -47,7 +47,7 @@ void main() { return MockAdErrorListener(); }; - final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager); + final adsManager = AndroidAdsManager(mockAdsManager); await adsManager.setAdsManagerDelegate( AndroidAdsManagerDelegate( @@ -60,7 +60,7 @@ void main() { ), ); - final MockAdEvent mockAdEvent = MockAdEvent(); + final mockAdEvent = MockAdEvent(); when(mockAdEvent.type).thenReturn(ima.AdEventType.allAdsCompleted); when(mockAdEvent.ad).thenReturn( createTestAd( @@ -77,7 +77,7 @@ void main() { }); test('CompanionAd sets 0 values for height/width to null', () async { - final MockAdsManager mockAdsManager = MockAdsManager(); + final mockAdsManager = MockAdsManager(); late final void Function(ima.AdEventListener, ima.AdEvent) onAdEventCallback; @@ -98,7 +98,7 @@ void main() { return MockAdErrorListener(); }; - final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager); + final adsManager = AndroidAdsManager(mockAdsManager); await adsManager.setAdsManagerDelegate( AndroidAdsManagerDelegate( @@ -111,7 +111,7 @@ void main() { ), ); - final MockAdEvent mockAdEvent = MockAdEvent(); + final mockAdEvent = MockAdEvent(); when(mockAdEvent.type).thenReturn(ima.AdEventType.allAdsCompleted); when(mockAdEvent.ad).thenReturn( createTestAd( @@ -125,7 +125,7 @@ void main() { }); test('Ad sets durations of -1 to null', () async { - final MockAdsManager mockAdsManager = MockAdsManager(); + final mockAdsManager = MockAdsManager(); late final void Function(ima.AdEventListener, ima.AdEvent) onAdEventCallback; @@ -146,7 +146,7 @@ void main() { return MockAdErrorListener(); }; - final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager); + final adsManager = AndroidAdsManager(mockAdsManager); await adsManager.setAdsManagerDelegate( AndroidAdsManagerDelegate( @@ -160,7 +160,7 @@ void main() { ), ); - final MockAdEvent mockAdEvent = MockAdEvent(); + final mockAdEvent = MockAdEvent(); when(mockAdEvent.type).thenReturn(ima.AdEventType.allAdsCompleted); when(mockAdEvent.ad).thenReturn( createTestAd( diff --git a/packages/interactive_media_ads/test/android/ads_loader_test.dart b/packages/interactive_media_ads/test/android/ads_loader_test.dart index e07d8fa6f17..b8708f4fa15 100644 --- a/packages/interactive_media_ads/test/android/ads_loader_test.dart +++ b/packages/interactive_media_ads/test/android/ads_loader_test.dart @@ -51,12 +51,12 @@ void main() { tester, ); - final MockImaSdkSettings mockImaSdkSettings = MockImaSdkSettings(); + final mockImaSdkSettings = MockImaSdkSettings(); final MockImaSdkFactory mockSdkFactory = _mockImaSdkFactoryInstance( imaSdkSettings: mockImaSdkSettings, ); - final AndroidImaSettings settings = AndroidImaSettings( + final settings = AndroidImaSettings( const PlatformImaSettingsCreationParams(), ); @@ -79,7 +79,7 @@ void main() { }); testWidgets('contentComplete', (WidgetTester tester) async { - final MockVideoAdPlayerCallback mockAdPlayerCallback = + final mockAdPlayerCallback = MockVideoAdPlayerCallback(); final AndroidAdDisplayContainer container = await _pumpAdDisplayContainer( tester, @@ -88,7 +88,7 @@ void main() { _mockImaSdkFactoryInstance(); - final AndroidAdsLoader loader = AndroidAdsLoader( + final loader = AndroidAdsLoader( AndroidAdsLoaderCreationParams( container: container, settings: AndroidImaSettings( @@ -108,19 +108,19 @@ void main() { tester, ); - final MockAdsLoader mockAdsLoader = MockAdsLoader(); - final MockAdsRequest mockAdsRequest = MockAdsRequest(); + final mockAdsLoader = MockAdsLoader(); + final mockAdsRequest = MockAdsRequest(); _mockImaSdkFactoryInstance( adsRequest: mockAdsRequest, adsLoader: mockAdsLoader, ); - final InteractiveMediaAdsProxy proxy = InteractiveMediaAdsProxy( + final proxy = InteractiveMediaAdsProxy( newContentProgressProvider: () => ima.ContentProgressProvider.pigeon_detached(), ); - final AndroidAdsLoader adsLoader = AndroidAdsLoader( + final adsLoader = AndroidAdsLoader( AndroidAdsLoaderCreationParams( container: container, settings: AndroidImaSettings( @@ -132,7 +132,7 @@ void main() { ), ); - final AndroidContentProgressProvider progressProvider = + final progressProvider = AndroidContentProgressProvider( AndroidContentProgressProviderCreationParams(proxy: proxy), ); @@ -174,19 +174,19 @@ void main() { tester, ); - final MockAdsLoader mockAdsLoader = MockAdsLoader(); - final MockAdsRequest mockAdsRequest = MockAdsRequest(); + final mockAdsLoader = MockAdsLoader(); + final mockAdsRequest = MockAdsRequest(); _mockImaSdkFactoryInstance( adsRequest: mockAdsRequest, adsLoader: mockAdsLoader, ); - final InteractiveMediaAdsProxy proxy = InteractiveMediaAdsProxy( + final proxy = InteractiveMediaAdsProxy( newContentProgressProvider: () => ima.ContentProgressProvider.pigeon_detached(), ); - final AndroidAdsLoader adsLoader = AndroidAdsLoader( + final adsLoader = AndroidAdsLoader( AndroidAdsLoaderCreationParams( container: container, settings: AndroidImaSettings( @@ -198,7 +198,7 @@ void main() { ), ); - final AndroidContentProgressProvider progressProvider = + final progressProvider = AndroidContentProgressProvider( AndroidContentProgressProviderCreationParams(proxy: proxy), ); @@ -240,8 +240,8 @@ void main() { tester, ); - final MockAdsLoader mockAdsLoader = MockAdsLoader(); - final Completer addEventListenerCompleter = Completer(); + final mockAdsLoader = MockAdsLoader(); + final addEventListenerCompleter = Completer(); when(mockAdsLoader.addAdsLoadedListener(any)).thenAnswer((_) async { addEventListenerCompleter.complete(); }); @@ -250,7 +250,7 @@ void main() { late final void Function(ima.AdsLoadedListener, ima.AdsManagerLoadedEvent) onAdsManagerLoadedCallback; - final InteractiveMediaAdsProxy proxy = InteractiveMediaAdsProxy( + final proxy = InteractiveMediaAdsProxy( newAdsLoadedListener: ({ required void Function( @@ -279,7 +279,7 @@ void main() { ), ); - final MockAdsManagerLoadedEvent mockLoadedEvent = + final mockLoadedEvent = MockAdsManagerLoadedEvent(); when(mockLoadedEvent.manager).thenReturn(MockAdsManager()); @@ -293,8 +293,8 @@ void main() { tester, ); - final MockAdsLoader mockAdsLoader = MockAdsLoader(); - final Completer addErrorListenerCompleter = Completer(); + final mockAdsLoader = MockAdsLoader(); + final addErrorListenerCompleter = Completer(); when(mockAdsLoader.addAdErrorListener(any)).thenAnswer((_) async { addErrorListenerCompleter.complete(); }); @@ -303,7 +303,7 @@ void main() { late final void Function(ima.AdErrorListener, ima.AdErrorEvent) onAdErrorCallback; - final InteractiveMediaAdsProxy proxy = InteractiveMediaAdsProxy( + final proxy = InteractiveMediaAdsProxy( newAdsLoadedListener: ({required dynamic onAdsManagerLoaded}) { return MockAdsLoadedListener(); }, @@ -329,8 +329,8 @@ void main() { ), ); - final MockAdErrorEvent mockErrorEvent = MockAdErrorEvent(); - final MockAdError mockError = MockAdError(); + final mockErrorEvent = MockAdErrorEvent(); + final mockError = MockAdError(); when(mockError.errorType).thenReturn(ima.AdErrorType.load); when( mockError.errorCode, @@ -350,7 +350,7 @@ MockImaSdkFactory _mockImaSdkFactoryInstance({ MockAdsRequest? adsRequest, MockAdsLoader? adsLoader, }) { - final MockImaSdkFactory mockSdkFactory = MockImaSdkFactory(); + final mockSdkFactory = MockImaSdkFactory(); when(mockSdkFactory.createImaSdkSettings()).thenAnswer((_) async { return imaSdkSettings ?? MockImaSdkSettings(); }); @@ -368,7 +368,7 @@ Future _pumpAdDisplayContainer( WidgetTester tester, { MockVideoAdPlayerCallback? mockAdPlayerCallback, }) async { - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newFrameLayout: () => MockFrameLayout(), newVideoView: ({ @@ -397,9 +397,9 @@ Future _pumpAdDisplayContainer( }, ); - final MockPlatformViewsServiceProxy mockPlatformViewsProxy = + final mockPlatformViewsProxy = MockPlatformViewsServiceProxy(); - final MockSurfaceAndroidViewController mockAndroidViewController = + final mockAndroidViewController = MockSurfaceAndroidViewController(); late final int platformViewId; @@ -417,10 +417,10 @@ Future _pumpAdDisplayContainer( return mockAndroidViewController; }); - final Completer adDisplayContainerCompleter = + final adDisplayContainerCompleter = Completer(); - final AndroidAdDisplayContainer container = AndroidAdDisplayContainer( + final container = AndroidAdDisplayContainer( AndroidAdDisplayContainerCreationParams( onContainerAdded: (PlatformAdDisplayContainer container) { adDisplayContainerCompleter.complete( @@ -436,7 +436,7 @@ Future _pumpAdDisplayContainer( Builder(builder: (BuildContext context) => container.build(context)), ); - final void Function(int) onPlatformCreatedCallback = + final onPlatformCreatedCallback = verify( mockAndroidViewController.addOnPlatformViewCreatedListener( captureAny, diff --git a/packages/interactive_media_ads/test/android/ads_manager_test.dart b/packages/interactive_media_ads/test/android/ads_manager_test.dart index e67fe38b112..ad9a59d7e55 100644 --- a/packages/interactive_media_ads/test/android/ads_manager_test.dart +++ b/packages/interactive_media_ads/test/android/ads_manager_test.dart @@ -28,26 +28,26 @@ import 'ads_manager_test.mocks.dart'; void main() { group('AndroidAdsManager', () { test('destroy', () { - final MockAdsManager mockAdsManager = MockAdsManager(); - final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager); + final mockAdsManager = MockAdsManager(); + final adsManager = AndroidAdsManager(mockAdsManager); adsManager.destroy(); verify(mockAdsManager.destroy()); }); test('init', () async { - final MockAdsManager mockAdsManager = MockAdsManager(); + final mockAdsManager = MockAdsManager(); - final MockImaSdkFactory mockImaSdkFactory = MockImaSdkFactory(); - final MockAdsRenderingSettings mockAdsRenderingSettings = + final mockImaSdkFactory = MockImaSdkFactory(); + final mockAdsRenderingSettings = MockAdsRenderingSettings(); when(mockImaSdkFactory.createAdsRenderingSettings()).thenAnswer( (_) => Future.value(mockAdsRenderingSettings), ); - final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager); + final adsManager = AndroidAdsManager(mockAdsManager); - final AndroidAdsRenderingSettings settings = AndroidAdsRenderingSettings( + final settings = AndroidAdsRenderingSettings( AndroidAdsRenderingSettingsCreationParams( bitrate: 1000, enablePreloading: false, @@ -78,52 +78,52 @@ void main() { }); test('start', () { - final MockAdsManager mockAdsManager = MockAdsManager(); - final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager); + final mockAdsManager = MockAdsManager(); + final adsManager = AndroidAdsManager(mockAdsManager); adsManager.start(AdsManagerStartParams()); verify(mockAdsManager.start()); }); test('discardAdBreak', () { - final MockAdsManager mockAdsManager = MockAdsManager(); - final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager); + final mockAdsManager = MockAdsManager(); + final adsManager = AndroidAdsManager(mockAdsManager); adsManager.discardAdBreak(); verify(mockAdsManager.discardAdBreak()); }); test('pause', () { - final MockAdsManager mockAdsManager = MockAdsManager(); - final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager); + final mockAdsManager = MockAdsManager(); + final adsManager = AndroidAdsManager(mockAdsManager); adsManager.pause(); verify(mockAdsManager.pause()); }); test('skip', () { - final MockAdsManager mockAdsManager = MockAdsManager(); - final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager); + final mockAdsManager = MockAdsManager(); + final adsManager = AndroidAdsManager(mockAdsManager); adsManager.skip(); verify(mockAdsManager.skip()); }); test('resume', () { - final MockAdsManager mockAdsManager = MockAdsManager(); - final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager); + final mockAdsManager = MockAdsManager(); + final adsManager = AndroidAdsManager(mockAdsManager); adsManager.resume(); verify(mockAdsManager.resume()); }); test('onAdEvent', () async { - final MockAdsManager mockAdsManager = MockAdsManager(); + final mockAdsManager = MockAdsManager(); late final void Function(ima.AdEventListener, ima.AdEvent) onAdEventCallback; - final InteractiveMediaAdsProxy proxy = InteractiveMediaAdsProxy( + final proxy = InteractiveMediaAdsProxy( newAdEventListener: ({ required void Function(ima.AdEventListener, ima.AdEvent) @@ -137,7 +137,7 @@ void main() { }, ); - final AndroidAdsManager adsManager = AndroidAdsManager( + final adsManager = AndroidAdsManager( mockAdsManager, proxy: proxy, ); @@ -152,19 +152,19 @@ void main() { ), ); - final MockAdEvent mockAdEvent = MockAdEvent(); + final mockAdEvent = MockAdEvent(); when(mockAdEvent.type).thenReturn(ima.AdEventType.allAdsCompleted); when(mockAdEvent.adData).thenReturn({'hello': 'world'}); onAdEventCallback(MockAdEventListener(), mockAdEvent); }); test('onAdErrorEvent', () async { - final MockAdsManager mockAdsManager = MockAdsManager(); + final mockAdsManager = MockAdsManager(); late final void Function(ima.AdErrorListener, ima.AdErrorEvent) onAdErrorCallback; - final InteractiveMediaAdsProxy proxy = InteractiveMediaAdsProxy( + final proxy = InteractiveMediaAdsProxy( newAdEventListener: ({required dynamic onAdEvent}) { return MockAdEventListener(); }, @@ -178,7 +178,7 @@ void main() { }, ); - final AndroidAdsManager adsManager = AndroidAdsManager( + final adsManager = AndroidAdsManager( mockAdsManager, proxy: proxy, ); @@ -190,8 +190,8 @@ void main() { ), ); - final MockAdErrorEvent mockErrorEvent = MockAdErrorEvent(); - final MockAdError mockError = MockAdError(); + final mockErrorEvent = MockAdErrorEvent(); + final mockError = MockAdError(); when(mockError.errorType).thenReturn(ima.AdErrorType.load); when( mockError.errorCode, @@ -202,11 +202,11 @@ void main() { }); test('adCuePoints', () { - final MockAdsManager mockAdsManager = MockAdsManager(); + final mockAdsManager = MockAdsManager(); - final List cuePoints = [1.0]; + final cuePoints = [1.0]; when(mockAdsManager.adCuePoints).thenReturn(cuePoints); - final AndroidAdsManager adsManager = AndroidAdsManager(mockAdsManager); + final adsManager = AndroidAdsManager(mockAdsManager); expect(adsManager.adCuePoints, [const Duration(seconds: 1)]); }); diff --git a/packages/interactive_media_ads/test/android/companion_ad_slot_test.dart b/packages/interactive_media_ads/test/android/companion_ad_slot_test.dart index ffde3f4d2c1..d27f4f55989 100644 --- a/packages/interactive_media_ads/test/android/companion_ad_slot_test.dart +++ b/packages/interactive_media_ads/test/android/companion_ad_slot_test.dart @@ -21,11 +21,11 @@ import 'companion_ad_slot_test.mocks.dart'; void main() { group('AndroidCompanionAdSlot', () { test('instantiate CompanionAdSlot with size', () async { - final ima.FrameLayout frameLayout = ima.FrameLayout.pigeon_detached( + final frameLayout = ima.FrameLayout.pigeon_detached( pigeon_instanceManager: _TestInstanceManager(), ); - final MockCompanionAdSlot mockCompanionAdSlot = MockCompanionAdSlot(); - final AndroidCompanionAdSlotCreationParams params = + final mockCompanionAdSlot = MockCompanionAdSlot(); + final params = AndroidCompanionAdSlotCreationParams( size: CompanionAdSlotSize.fixed(width: 300, height: 400), proxy: InteractiveMediaAdsProxy( @@ -33,7 +33,7 @@ void main() { return frameLayout; }, instanceImaSdkFactory: () { - final MockImaSdkFactory mockFactory = MockImaSdkFactory(); + final mockFactory = MockImaSdkFactory(); when( mockFactory.createCompanionAdSlot(), ).thenAnswer((_) async => mockCompanionAdSlot); @@ -42,7 +42,7 @@ void main() { ), ); - final AndroidCompanionAdSlot adSlot = AndroidCompanionAdSlot(params); + final adSlot = AndroidCompanionAdSlot(params); await adSlot.getNativeCompanionAdSlot(); verify(mockCompanionAdSlot.setContainer(frameLayout)); @@ -50,8 +50,8 @@ void main() { }); test('AndroidCompanionAdSlot receives onClick', () async { - final MockCompanionAdSlot mockCompanionAdSlot = MockCompanionAdSlot(); - final AndroidCompanionAdSlotCreationParams params = + final mockCompanionAdSlot = MockCompanionAdSlot(); + final params = AndroidCompanionAdSlotCreationParams( size: CompanionAdSlotSize.fixed(width: 300, height: 400), onClicked: expectAsync0(() {}), @@ -62,7 +62,7 @@ void main() { ); }, instanceImaSdkFactory: () { - final MockImaSdkFactory mockFactory = MockImaSdkFactory(); + final mockFactory = MockImaSdkFactory(); when( mockFactory.createCompanionAdSlot(), ).thenAnswer((_) async => mockCompanionAdSlot); @@ -81,10 +81,10 @@ void main() { ), ); - final AndroidCompanionAdSlot adSlot = AndroidCompanionAdSlot(params); + final adSlot = AndroidCompanionAdSlot(params); await adSlot.getNativeCompanionAdSlot(); - final ima.CompanionAdSlotClickListener clickListener = + final clickListener = verify( mockCompanionAdSlot.addClickListener(captureAny), ).captured.single diff --git a/packages/interactive_media_ads/test/android/content_progress_provider_test.dart b/packages/interactive_media_ads/test/android/content_progress_provider_test.dart index 19d161485d5..48f2b76bec4 100644 --- a/packages/interactive_media_ads/test/android/content_progress_provider_test.dart +++ b/packages/interactive_media_ads/test/android/content_progress_provider_test.dart @@ -16,10 +16,10 @@ import 'content_progress_provider_test.mocks.dart'; void main() { group('AndroidContentProgressProvider', () { test('setProgress', () async { - final MockContentProgressProvider mockContentProgressProvider = + final mockContentProgressProvider = MockContentProgressProvider(); - final AndroidContentProgressProvider provider = + final provider = AndroidContentProgressProvider( AndroidContentProgressProviderCreationParams( proxy: InteractiveMediaAdsProxy( diff --git a/packages/interactive_media_ads/test/android/ima_settings_test.dart b/packages/interactive_media_ads/test/android/ima_settings_test.dart index fbd9da60c57..91a1fa6fe48 100644 --- a/packages/interactive_media_ads/test/android/ima_settings_test.dart +++ b/packages/interactive_media_ads/test/android/ima_settings_test.dart @@ -25,8 +25,8 @@ void main() { test('language', () async { final MockImaSdkSettings mockImaSdkSettings = _mockImaSdkSettings(); - const String language = 'en'; - final AndroidImaSettings settings = AndroidImaSettings( + const language = 'en'; + final settings = AndroidImaSettings( const PlatformImaSettingsCreationParams(language: language), ); @@ -37,8 +37,8 @@ void main() { test('setAutoPlayAdBreaks', () async { final MockImaSdkSettings mockImaSdkSettings = _mockImaSdkSettings(); - const bool autoPlayAdBreaks = true; - final AndroidImaSettings settings = AndroidImaSettings( + const autoPlayAdBreaks = true; + final settings = AndroidImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setAutoPlayAdBreaks(autoPlayAdBreaks); @@ -49,8 +49,8 @@ void main() { test('setDebugMode', () async { final MockImaSdkSettings mockImaSdkSettings = _mockImaSdkSettings(); - const bool debugMode = false; - final AndroidImaSettings settings = AndroidImaSettings( + const debugMode = false; + final settings = AndroidImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setDebugMode(debugMode); @@ -61,8 +61,8 @@ void main() { test('setFeatureFlags', () async { final MockImaSdkSettings mockImaSdkSettings = _mockImaSdkSettings(); - const Map featureFlags = {'a': 'flag'}; - final AndroidImaSettings settings = AndroidImaSettings( + const featureFlags = {'a': 'flag'}; + final settings = AndroidImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setFeatureFlags(featureFlags); @@ -73,8 +73,8 @@ void main() { test('setMaxRedirects', () async { final MockImaSdkSettings mockImaSdkSettings = _mockImaSdkSettings(); - const int maxRedirects = 12; - final AndroidImaSettings settings = AndroidImaSettings( + const maxRedirects = 12; + final settings = AndroidImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setMaxRedirects(maxRedirects); @@ -85,8 +85,8 @@ void main() { test('setPlayerType', () async { final MockImaSdkSettings mockImaSdkSettings = _mockImaSdkSettings(); - const String playerType = 'playerType'; - final AndroidImaSettings settings = AndroidImaSettings( + const playerType = 'playerType'; + final settings = AndroidImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setPlayerType(playerType); @@ -97,8 +97,8 @@ void main() { test('setPlayerVersion', () async { final MockImaSdkSettings mockImaSdkSettings = _mockImaSdkSettings(); - const String playerVersion = 'playerVersion'; - final AndroidImaSettings settings = AndroidImaSettings( + const playerVersion = 'playerVersion'; + final settings = AndroidImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setPlayerVersion(playerVersion); @@ -109,8 +109,8 @@ void main() { test('setPpid', () async { final MockImaSdkSettings mockImaSdkSettings = _mockImaSdkSettings(); - const String ppid = 'ppid'; - final AndroidImaSettings settings = AndroidImaSettings( + const ppid = 'ppid'; + final settings = AndroidImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setPpid(ppid); @@ -121,8 +121,8 @@ void main() { test('setSessionID', () async { final MockImaSdkSettings mockImaSdkSettings = _mockImaSdkSettings(); - const String sessionID = 'sessionID'; - final AndroidImaSettings settings = AndroidImaSettings( + const sessionID = 'sessionID'; + final settings = AndroidImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setSessionID(sessionID); @@ -133,8 +133,8 @@ void main() { } MockImaSdkSettings _mockImaSdkSettings() { - final MockImaSdkFactory mockImaSdkFactory = MockImaSdkFactory(); - final MockImaSdkSettings mockImaSdkSettings = MockImaSdkSettings(); + final mockImaSdkFactory = MockImaSdkFactory(); + final mockImaSdkSettings = MockImaSdkSettings(); when( mockImaSdkFactory.createImaSdkSettings(), ).thenAnswer((_) async => mockImaSdkSettings); diff --git a/packages/interactive_media_ads/test/companion_ad_slot_test.dart b/packages/interactive_media_ads/test/companion_ad_slot_test.dart index 75b12054626..ab51c8556c1 100644 --- a/packages/interactive_media_ads/test/companion_ad_slot_test.dart +++ b/packages/interactive_media_ads/test/companion_ad_slot_test.dart @@ -13,7 +13,7 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); testWidgets('buildWidget', (WidgetTester tester) async { - final TestCompanionAdSlot slot = TestCompanionAdSlot( + final slot = TestCompanionAdSlot( PlatformCompanionAdSlotCreationParams(size: CompanionAdSlotSize.fluid()), onBuildWidget: (_) => Container(), ); diff --git a/packages/interactive_media_ads/test/content_progress_provider_test.dart b/packages/interactive_media_ads/test/content_progress_provider_test.dart index b35b29656de..7d74fb3613d 100644 --- a/packages/interactive_media_ads/test/content_progress_provider_test.dart +++ b/packages/interactive_media_ads/test/content_progress_provider_test.dart @@ -13,7 +13,7 @@ void main() { late final Duration callbackProgress; late final Duration callbackDuration; - final TestContentProgressProvider platformProvider = + final platformProvider = TestContentProgressProvider( const PlatformContentProgressProviderCreationParams(), onSetProgress: @@ -23,7 +23,7 @@ void main() { }, ); - final ContentProgressProvider provider = + final provider = ContentProgressProvider.fromPlatform(platformProvider); await provider.setProgress( diff --git a/packages/interactive_media_ads/test/ima_settings_test.dart b/packages/interactive_media_ads/test/ima_settings_test.dart index 4886ca2b987..75507272340 100644 --- a/packages/interactive_media_ads/test/ima_settings_test.dart +++ b/packages/interactive_media_ads/test/ima_settings_test.dart @@ -10,106 +10,106 @@ import 'test_stubs.dart'; void main() { test('setAutoPlayAdBreaks', () async { - const bool autoPlayAdBreaks = false; - final TestImaSettings platformSettings = TestImaSettings( + const autoPlayAdBreaks = false; + final platformSettings = TestImaSettings( const PlatformImaSettingsCreationParams(), onSetAutoPlayAdBreaks: expectAsync1((bool value) { expect(autoPlayAdBreaks, value); }), ); - final ImaSettings settings = ImaSettings.fromPlatform(platformSettings); + final settings = ImaSettings.fromPlatform(platformSettings); await settings.setAutoPlayAdBreaks(autoPlayAdBreaks); }); test('setDebugMode', () async { - const bool debugMode = true; - final TestImaSettings platformSettings = TestImaSettings( + const debugMode = true; + final platformSettings = TestImaSettings( const PlatformImaSettingsCreationParams(), onSetDebugMode: expectAsync1((bool value) { expect(debugMode, value); }), ); - final ImaSettings settings = ImaSettings.fromPlatform(platformSettings); + final settings = ImaSettings.fromPlatform(platformSettings); await settings.setDebugMode(debugMode); }); test('setFeatureFlags', () async { - const Map featureFlags = {}; - final TestImaSettings platformSettings = TestImaSettings( + const featureFlags = {}; + final platformSettings = TestImaSettings( const PlatformImaSettingsCreationParams(), onSetFeatureFlags: expectAsync1((Map value) { expect(featureFlags, value); }), ); - final ImaSettings settings = ImaSettings.fromPlatform(platformSettings); + final settings = ImaSettings.fromPlatform(platformSettings); await settings.setFeatureFlags(featureFlags); }); test('setMaxRedirects', () async { - const int maxRedirects = 11; - final TestImaSettings platformSettings = TestImaSettings( + const maxRedirects = 11; + final platformSettings = TestImaSettings( const PlatformImaSettingsCreationParams(), onSetMaxRedirects: expectAsync1((int value) { expect(maxRedirects, value); }), ); - final ImaSettings settings = ImaSettings.fromPlatform(platformSettings); + final settings = ImaSettings.fromPlatform(platformSettings); await settings.setMaxRedirects(maxRedirects); }); test('setPlayerType', () async { - const String playerType = 'playerType'; - final TestImaSettings platformSettings = TestImaSettings( + const playerType = 'playerType'; + final platformSettings = TestImaSettings( const PlatformImaSettingsCreationParams(), onSetPlayerType: expectAsync1((String value) { expect(playerType, value); }), ); - final ImaSettings settings = ImaSettings.fromPlatform(platformSettings); + final settings = ImaSettings.fromPlatform(platformSettings); await settings.setPlayerType(playerType); }); test('setPlayerVersion', () async { - const String playerVersion = 'playerVersion'; - final TestImaSettings platformSettings = TestImaSettings( + const playerVersion = 'playerVersion'; + final platformSettings = TestImaSettings( const PlatformImaSettingsCreationParams(), onSetPlayerVersion: expectAsync1((String value) { expect(playerVersion, value); }), ); - final ImaSettings settings = ImaSettings.fromPlatform(platformSettings); + final settings = ImaSettings.fromPlatform(platformSettings); await settings.setPlayerVersion(playerVersion); }); test('setPpid', () async { - const String ppid = 'ppid'; - final TestImaSettings platformSettings = TestImaSettings( + const ppid = 'ppid'; + final platformSettings = TestImaSettings( const PlatformImaSettingsCreationParams(), onSetPpid: expectAsync1((String value) { expect(ppid, value); }), ); - final ImaSettings settings = ImaSettings.fromPlatform(platformSettings); + final settings = ImaSettings.fromPlatform(platformSettings); await settings.setPpid(ppid); }); test('setSessionID', () async { - const String sessionID = 'session'; - final TestImaSettings platformSettings = TestImaSettings( + const sessionID = 'session'; + final platformSettings = TestImaSettings( const PlatformImaSettingsCreationParams(), onSetSessionID: expectAsync1((String value) { expect(sessionID, value); }), ); - final ImaSettings settings = ImaSettings.fromPlatform(platformSettings); + final settings = ImaSettings.fromPlatform(platformSettings); await settings.setSessionID(sessionID); }); } diff --git a/packages/interactive_media_ads/test/ios/ad_display_container_test.dart b/packages/interactive_media_ads/test/ios/ad_display_container_test.dart index bb343feaae8..b970ea5a59b 100644 --- a/packages/interactive_media_ads/test/ios/ad_display_container_test.dart +++ b/packages/interactive_media_ads/test/ios/ad_display_container_test.dart @@ -27,7 +27,7 @@ void main() { group('IOSAdDisplayContainer', () { testWidgets('build with key', (WidgetTester tester) async { - final IOSAdDisplayContainer container = IOSAdDisplayContainer( + final container = IOSAdDisplayContainer( IOSAdDisplayContainerCreationParams( key: const Key('testKey'), onContainerAdded: (_) {}, @@ -44,19 +44,19 @@ void main() { testWidgets('onContainerAdded is called', (WidgetTester tester) async { late final void Function(UIViewController, bool) viewDidAppearCallback; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newUIViewController: ({void Function(UIViewController, bool)? viewDidAppear}) { viewDidAppearCallback = viewDidAppear!; - final PigeonInstanceManager instanceManager = + final instanceManager = PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); - final UIView view = UIView.pigeon_detached( + final view = UIView.pigeon_detached( pigeon_instanceManager: instanceManager, ); instanceManager.addDartCreatedInstance(view); - final MockUIViewController mockController = + final mockController = MockUIViewController(); when(mockController.view).thenReturn(view); return mockController; @@ -69,9 +69,9 @@ void main() { }) => MockIMAAdDisplayContainer(), ); - final Completer onContainerAddedCompleter = Completer(); + final onContainerAddedCompleter = Completer(); - final IOSAdDisplayContainer container = IOSAdDisplayContainer( + final container = IOSAdDisplayContainer( IOSAdDisplayContainerCreationParams( onContainerAdded: (_) => onContainerAddedCompleter.complete(), imaProxy: imaProxy, @@ -82,7 +82,7 @@ void main() { Builder(builder: (BuildContext context) => container.build(context)), ); - final UiKitView view = + final view = find.byType(UiKitView).evaluate().single.widget as UiKitView; view.onPlatformViewCreated!.call(0); @@ -98,26 +98,26 @@ void main() { testWidgets('AdDisplayContainer ads CompanionAdSlots', ( WidgetTester tester, ) async { - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final MockIMACompanionAdSlot mockCompanionAdSlot = + final mockCompanionAdSlot = MockIMACompanionAdSlot(); late final void Function(UIViewController, bool) viewDidAppearCallback; - final Completer?> addedAdSlotsCompleter = + final addedAdSlotsCompleter = Completer?>(); - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newUIViewController: ({void Function(UIViewController, bool)? viewDidAppear}) { viewDidAppearCallback = viewDidAppear!; - final UIView view = UIView.pigeon_detached( + final view = UIView.pigeon_detached( pigeon_instanceManager: instanceManager, ); instanceManager.addDartCreatedInstance(view); - final MockUIViewController mockController = + final mockController = MockUIViewController(); when(mockController.view).thenReturn(view); return mockController; @@ -144,9 +144,9 @@ void main() { }, ); - final Completer onContainerAddedCompleter = Completer(); + final onContainerAddedCompleter = Completer(); - final IOSAdDisplayContainer container = IOSAdDisplayContainer( + final container = IOSAdDisplayContainer( IOSAdDisplayContainerCreationParams( onContainerAdded: (_) => onContainerAddedCompleter.complete(), companionSlots: [ @@ -165,7 +165,7 @@ void main() { Builder(builder: (BuildContext context) => container.build(context)), ); - final UiKitView view = + final view = find.byType(UiKitView).evaluate().single.widget as UiKitView; view.onPlatformViewCreated!.call(0); diff --git a/packages/interactive_media_ads/test/ios/ad_test.dart b/packages/interactive_media_ads/test/ios/ad_test.dart index 8151a24631d..35606233097 100644 --- a/packages/interactive_media_ads/test/ios/ad_test.dart +++ b/packages/interactive_media_ads/test/ios/ad_test.dart @@ -48,7 +48,7 @@ void main() { return delegate; }; - final IOSAdsManagerDelegate adsManagerDelegate = IOSAdsManagerDelegate( + final adsManagerDelegate = IOSAdsManagerDelegate( IOSAdsManagerDelegateCreationParams( onAdEvent: expectAsync1((PlatformAdEvent event) { expect(event.ad!.universalAdIds.single.adIdValue, isNull); @@ -113,7 +113,7 @@ void main() { return delegate; }; - final IOSAdsManagerDelegate adsManagerDelegate = IOSAdsManagerDelegate( + final adsManagerDelegate = IOSAdsManagerDelegate( IOSAdsManagerDelegateCreationParams( onAdEvent: expectAsync1((PlatformAdEvent event) { expect(event.ad!.companionAds.single.width, isNull); @@ -175,7 +175,7 @@ void main() { return delegate; }; - final IOSAdsManagerDelegate adsManagerDelegate = IOSAdsManagerDelegate( + final adsManagerDelegate = IOSAdsManagerDelegate( IOSAdsManagerDelegateCreationParams( onAdEvent: expectAsync1((PlatformAdEvent event) { expect(event.ad!.duration, isNull); diff --git a/packages/interactive_media_ads/test/ios/ads_loader_test.dart b/packages/interactive_media_ads/test/ios/ads_loader_test.dart index 171ea2c1411..e7501805fc2 100644 --- a/packages/interactive_media_ads/test/ios/ads_loader_test.dart +++ b/packages/interactive_media_ads/test/ios/ads_loader_test.dart @@ -55,12 +55,12 @@ void main() { ima.PigeonOverrides.iMASettings_new = () => MockIMASettings(); - final MockIMAAdsLoader mockLoader = MockIMAAdsLoader(); - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final mockLoader = MockIMAAdsLoader(); + final imaProxy = InteractiveMediaAdsProxy( newIMAAdsLoader: ({ima.IMASettings? settings}) => mockLoader, ); - final IOSAdsLoader loader = IOSAdsLoader( + final loader = IOSAdsLoader( IOSAdsLoaderCreationParams( container: container, settings: IOSImaSettings(const PlatformImaSettingsCreationParams()), @@ -81,13 +81,13 @@ void main() { ima.PigeonOverrides.iMASettings_new = () => MockIMASettings(); - const String adTag = 'myAdTag'; + const adTag = 'myAdTag'; - final MockIMAAdsLoader mockLoader = MockIMAAdsLoader(); - final ima.IMAContentPlayhead contentPlayheadInstance = + final mockLoader = MockIMAAdsLoader(); + final contentPlayheadInstance = ima.IMAContentPlayhead(); - final MockIMAAdsRequest mockRequest = MockIMAAdsRequest(); - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final mockRequest = MockIMAAdsRequest(); + final imaProxy = InteractiveMediaAdsProxy( newIMAAdsLoader: ({ima.IMASettings? settings}) => mockLoader, newIMAContentPlayhead: () => contentPlayheadInstance, ); @@ -104,7 +104,7 @@ void main() { return mockRequest; }; - final IOSAdsLoader loader = IOSAdsLoader( + final loader = IOSAdsLoader( IOSAdsLoaderCreationParams( container: container, settings: IOSImaSettings(const PlatformImaSettingsCreationParams()), @@ -114,7 +114,7 @@ void main() { ), ); - final IOSContentProgressProvider provider = IOSContentProgressProvider( + final provider = IOSContentProgressProvider( IOSContentProgressProviderCreationParams(proxy: imaProxy), ); @@ -159,7 +159,7 @@ void main() { ) adLoaderLoadedWithCallback; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newIMAAdsLoader: ({ima.IMASettings? settings}) => MockIMAAdsLoader(), newIMAAdsLoaderDelegate: ({ @@ -176,7 +176,7 @@ void main() { }, ); - final IOSAdsLoader adsLoader = IOSAdsLoader( + final adsLoader = IOSAdsLoader( IOSAdsLoaderCreationParams( container: container, settings: IOSImaSettings(const PlatformImaSettingsCreationParams()), @@ -214,7 +214,7 @@ void main() { ) adsLoaderFailedWithErrorDataCallback; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newIMAAdsLoader: ({ima.IMASettings? settings}) => MockIMAAdsLoader(), newIMAAdsLoaderDelegate: ({ @@ -232,7 +232,7 @@ void main() { }, ); - final IOSAdsLoader adsLoader = IOSAdsLoader( + final adsLoader = IOSAdsLoader( IOSAdsLoaderCreationParams( container: container, settings: IOSImaSettings(const PlatformImaSettingsCreationParams()), @@ -247,7 +247,7 @@ void main() { // Trigger lazy initialization of native IMAAdsLoader await adsLoader.contentComplete(); - final ima.PigeonInstanceManager instanceManager = + final instanceManager = ima.PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); adsLoaderFailedWithErrorDataCallback( @@ -269,17 +269,17 @@ void main() { Future _pumpAdDisplayContainer( WidgetTester tester, ) async { - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newUIViewController: ({void Function(ima.UIViewController, bool)? viewDidAppear}) { - final ima.PigeonInstanceManager instanceManager = + final instanceManager = ima.PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); - final ima.UIView view = ima.UIView.pigeon_detached( + final view = ima.UIView.pigeon_detached( pigeon_instanceManager: instanceManager, ); instanceManager.addDartCreatedInstance(view); - final MockUIViewController mockController = MockUIViewController(); + final mockController = MockUIViewController(); viewDidAppear!.call(mockController, true); when(mockController.view).thenReturn(view); return mockController; @@ -292,7 +292,7 @@ Future _pumpAdDisplayContainer( }) => MockIMAAdDisplayContainer(), ); - final IOSAdDisplayContainer container = IOSAdDisplayContainer( + final container = IOSAdDisplayContainer( IOSAdDisplayContainerCreationParams( onContainerAdded: expectAsync1((_) {}), imaProxy: imaProxy, @@ -303,7 +303,7 @@ Future _pumpAdDisplayContainer( Builder(builder: (BuildContext context) => container.build(context)), ); - final UiKitView view = + final view = find.byType(UiKitView).evaluate().single.widget as UiKitView; view.onPlatformViewCreated!.call(0); diff --git a/packages/interactive_media_ads/test/ios/ads_manager_delegate_test.dart b/packages/interactive_media_ads/test/ios/ads_manager_delegate_test.dart index 4662ed0535c..33ef0ca9986 100644 --- a/packages/interactive_media_ads/test/ios/ads_manager_delegate_test.dart +++ b/packages/interactive_media_ads/test/ios/ads_manager_delegate_test.dart @@ -12,7 +12,7 @@ import 'package:interactive_media_ads/src/platform_interface/platform_interface. void main() { group('IOSAdsManagerDelegate', () { test('didReceiveAdEvent calls onAdEvent', () { - final ima.PigeonInstanceManager instanceManager = + final instanceManager = ima.PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); late final void Function( @@ -23,7 +23,7 @@ void main() { didReceiveAdEventCallback; late final ima.IMAAdsManagerDelegate delegate; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newIMAAdsManagerDelegate: ({ required void Function( @@ -61,7 +61,7 @@ void main() { }, ); - final IOSAdsManagerDelegate adsManagerDelegate = IOSAdsManagerDelegate( + final adsManagerDelegate = IOSAdsManagerDelegate( IOSAdsManagerDelegateCreationParams( onAdEvent: expectAsync1((PlatformAdEvent event) { expect(event.type, AdEventType.allAdsCompleted); @@ -91,14 +91,14 @@ void main() { }); test('didRequestContentPause calls onAdEvent', () { - final ima.PigeonInstanceManager instanceManager = + final instanceManager = ima.PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); late final void Function(ima.IMAAdsManagerDelegate, ima.IMAAdsManager) didRequestContentPauseCallback; late final ima.IMAAdsManagerDelegate delegate; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newIMAAdsManagerDelegate: ({ required void Function( @@ -136,7 +136,7 @@ void main() { }, ); - final IOSAdsManagerDelegate adsManagerDelegate = IOSAdsManagerDelegate( + final adsManagerDelegate = IOSAdsManagerDelegate( IOSAdsManagerDelegateCreationParams( onAdEvent: expectAsync1((PlatformAdEvent event) { expect(event.type, AdEventType.contentPauseRequested); @@ -159,14 +159,14 @@ void main() { }); test('didRequestContentResume calls onAdEvent', () { - final ima.PigeonInstanceManager instanceManager = + final instanceManager = ima.PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); late final void Function(ima.IMAAdsManagerDelegate, ima.IMAAdsManager) didRequestContentResumeCallback; late final ima.IMAAdsManagerDelegate delegate; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newIMAAdsManagerDelegate: ({ required void Function( @@ -204,7 +204,7 @@ void main() { }, ); - final IOSAdsManagerDelegate adsManagerDelegate = IOSAdsManagerDelegate( + final adsManagerDelegate = IOSAdsManagerDelegate( IOSAdsManagerDelegateCreationParams( onAdEvent: expectAsync1((PlatformAdEvent event) { expect(event.type, AdEventType.contentResumeRequested); @@ -227,7 +227,7 @@ void main() { }); test('didReceiveAdError calls onAdErrorEvent', () { - final ima.PigeonInstanceManager instanceManager = + final instanceManager = ima.PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); late final void Function( @@ -238,7 +238,7 @@ void main() { didReceiveAdErrorCallback; late final ima.IMAAdsManagerDelegate delegate; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newIMAAdsManagerDelegate: ({ required void Function( @@ -276,7 +276,7 @@ void main() { }, ); - final IOSAdsManagerDelegate adsManagerDelegate = IOSAdsManagerDelegate( + final adsManagerDelegate = IOSAdsManagerDelegate( IOSAdsManagerDelegateCreationParams( onAdErrorEvent: expectAsync1((AdErrorEvent event) { expect(event.error.type, AdErrorType.loading); diff --git a/packages/interactive_media_ads/test/ios/ads_manager_test.dart b/packages/interactive_media_ads/test/ios/ads_manager_test.dart index e042f78777d..d517bec62c2 100644 --- a/packages/interactive_media_ads/test/ios/ads_manager_test.dart +++ b/packages/interactive_media_ads/test/ios/ads_manager_test.dart @@ -22,22 +22,22 @@ import 'ads_manager_test.mocks.dart'; void main() { group('IOSAdsManager', () { test('destroy', () { - final MockIMAAdsManager mockAdsManager = MockIMAAdsManager(); - final IOSAdsManager adsManager = IOSAdsManager(mockAdsManager); + final mockAdsManager = MockIMAAdsManager(); + final adsManager = IOSAdsManager(mockAdsManager); adsManager.destroy(); verify(mockAdsManager.destroy()); }); test('init', () async { - final MockIMAAdsManager mockAdsManager = MockIMAAdsManager(); + final mockAdsManager = MockIMAAdsManager(); - final MockIMAAdsRenderingSettings mockAdsRenderingSettings = + final mockAdsRenderingSettings = MockIMAAdsRenderingSettings(); - final IOSAdsManager adsManager = IOSAdsManager(mockAdsManager); + final adsManager = IOSAdsManager(mockAdsManager); - final IOSAdsRenderingSettings settings = IOSAdsRenderingSettings( + final settings = IOSAdsRenderingSettings( IOSAdsRenderingSettingsCreationParams( bitrate: 1000, enablePreloading: false, @@ -66,51 +66,51 @@ void main() { }); test('start', () { - final MockIMAAdsManager mockAdsManager = MockIMAAdsManager(); - final IOSAdsManager adsManager = IOSAdsManager(mockAdsManager); + final mockAdsManager = MockIMAAdsManager(); + final adsManager = IOSAdsManager(mockAdsManager); adsManager.start(AdsManagerStartParams()); verify(mockAdsManager.start()); }); test('discardAdBreak', () { - final MockIMAAdsManager mockAdsManager = MockIMAAdsManager(); - final IOSAdsManager adsManager = IOSAdsManager(mockAdsManager); + final mockAdsManager = MockIMAAdsManager(); + final adsManager = IOSAdsManager(mockAdsManager); adsManager.discardAdBreak(); verify(mockAdsManager.discardAdBreak()); }); test('pause', () { - final MockIMAAdsManager mockAdsManager = MockIMAAdsManager(); - final IOSAdsManager adsManager = IOSAdsManager(mockAdsManager); + final mockAdsManager = MockIMAAdsManager(); + final adsManager = IOSAdsManager(mockAdsManager); adsManager.pause(); verify(mockAdsManager.pause()); }); test('skip', () { - final MockIMAAdsManager mockAdsManager = MockIMAAdsManager(); - final IOSAdsManager adsManager = IOSAdsManager(mockAdsManager); + final mockAdsManager = MockIMAAdsManager(); + final adsManager = IOSAdsManager(mockAdsManager); adsManager.skip(); verify(mockAdsManager.skip()); }); test('resume', () { - final MockIMAAdsManager mockAdsManager = MockIMAAdsManager(); - final IOSAdsManager adsManager = IOSAdsManager(mockAdsManager); + final mockAdsManager = MockIMAAdsManager(); + final adsManager = IOSAdsManager(mockAdsManager); adsManager.resume(); verify(mockAdsManager.resume()); }); test('setAdsManagerDelegate', () { - final MockIMAAdsManager mockAdsManager = MockIMAAdsManager(); - final IOSAdsManager adsManager = IOSAdsManager(mockAdsManager); + final mockAdsManager = MockIMAAdsManager(); + final adsManager = IOSAdsManager(mockAdsManager); late final ima.IMAAdsManagerDelegate delegate; - final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + final imaProxy = InteractiveMediaAdsProxy( newIMAAdsManagerDelegate: ({ required void Function( @@ -159,11 +159,11 @@ void main() { }); test('adCuePoints', () { - final MockIMAAdsManager mockAdsManager = MockIMAAdsManager(); + final mockAdsManager = MockIMAAdsManager(); - final List cuePoints = [1.0]; + final cuePoints = [1.0]; when(mockAdsManager.adCuePoints).thenReturn(cuePoints); - final IOSAdsManager adsManager = IOSAdsManager(mockAdsManager); + final adsManager = IOSAdsManager(mockAdsManager); expect(adsManager.adCuePoints, [const Duration(seconds: 1)]); }); diff --git a/packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart b/packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart index 451e7e2f0fc..edb498927e2 100644 --- a/packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart +++ b/packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart @@ -16,9 +16,9 @@ import 'companion_ad_slot_test.mocks.dart'; void main() { group('IOSCompanionAdSlot', () { test('instantiate CompanionAdSlot with size', () async { - final MockIMACompanionAdSlot mockCompanionAdSlot = + final mockCompanionAdSlot = MockIMACompanionAdSlot(); - final IOSCompanionAdSlotCreationParams params = + final params = IOSCompanionAdSlotCreationParams( size: CompanionAdSlotSize.fixed(width: 300, height: 400), proxy: InteractiveMediaAdsProxy( @@ -40,14 +40,14 @@ void main() { ), ); - final IOSCompanionAdSlot adSlot = IOSCompanionAdSlot(params); + final adSlot = IOSCompanionAdSlot(params); expect(adSlot.nativeCompanionAdSlot, mockCompanionAdSlot); }); test('IOSCompanionAdSlot receives onClick', () async { - final MockIMACompanionAdSlot mockCompanionAdSlot = + final mockCompanionAdSlot = MockIMACompanionAdSlot(); - final IOSCompanionAdSlotCreationParams params = + final params = IOSCompanionAdSlotCreationParams( size: CompanionAdSlotSize.fixed(width: 300, height: 400), onClicked: expectAsync0(() {}), @@ -85,10 +85,10 @@ void main() { ), ); - final IOSCompanionAdSlot adSlot = IOSCompanionAdSlot(params); + final adSlot = IOSCompanionAdSlot(params); expect(adSlot.nativeCompanionAdSlot, mockCompanionAdSlot); - final IMACompanionDelegate delegate = + final delegate = verify(mockCompanionAdSlot.setDelegate(captureAny)).captured.single as IMACompanionDelegate; diff --git a/packages/interactive_media_ads/test/ios/content_progress_provider_test.dart b/packages/interactive_media_ads/test/ios/content_progress_provider_test.dart index 46e3db8ff35..499d3af6f61 100644 --- a/packages/interactive_media_ads/test/ios/content_progress_provider_test.dart +++ b/packages/interactive_media_ads/test/ios/content_progress_provider_test.dart @@ -15,10 +15,10 @@ import 'content_progress_provider_test.mocks.dart'; void main() { group('IOSContentProgressProvider', () { test('setProgress', () async { - final MockIMAContentPlayhead mockContentPlayhead = + final mockContentPlayhead = MockIMAContentPlayhead(); - final IOSContentProgressProvider provider = IOSContentProgressProvider( + final provider = IOSContentProgressProvider( IOSContentProgressProviderCreationParams( proxy: InteractiveMediaAdsProxy( newIMAContentPlayhead: () => mockContentPlayhead, diff --git a/packages/interactive_media_ads/test/ios/ima_settings_test.dart b/packages/interactive_media_ads/test/ios/ima_settings_test.dart index adb2f2fdf0a..5f7a2ca2170 100644 --- a/packages/interactive_media_ads/test/ios/ima_settings_test.dart +++ b/packages/interactive_media_ads/test/ios/ima_settings_test.dart @@ -21,8 +21,8 @@ void main() { test('language', () async { final MockIMASettings mockIMASettings = _mockIMASettings(); - const String language = 'en'; - final IOSImaSettings settings = IOSImaSettings( + const language = 'en'; + final settings = IOSImaSettings( const PlatformImaSettingsCreationParams(language: language), ); @@ -36,8 +36,8 @@ void main() { test('setAutoPlayAdBreaks', () async { final MockIMASettings mockIMASettings = _mockIMASettings(); - const bool autoPlayAdBreaks = true; - final IOSImaSettings settings = IOSImaSettings( + const autoPlayAdBreaks = true; + final settings = IOSImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setAutoPlayAdBreaks(autoPlayAdBreaks); @@ -48,8 +48,8 @@ void main() { test('setDebugMode', () async { final MockIMASettings mockIMASettings = _mockIMASettings(); - const bool debugMode = false; - final IOSImaSettings settings = IOSImaSettings( + const debugMode = false; + final settings = IOSImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setDebugMode(debugMode); @@ -60,8 +60,8 @@ void main() { test('setFeatureFlags', () async { final MockIMASettings mockIMASettings = _mockIMASettings(); - const Map featureFlags = {'a': 'flag'}; - final IOSImaSettings settings = IOSImaSettings( + const featureFlags = {'a': 'flag'}; + final settings = IOSImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setFeatureFlags(featureFlags); @@ -72,8 +72,8 @@ void main() { test('setMaxRedirects', () async { final MockIMASettings mockIMASettings = _mockIMASettings(); - const int maxRedirects = 12; - final IOSImaSettings settings = IOSImaSettings( + const maxRedirects = 12; + final settings = IOSImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setMaxRedirects(maxRedirects); @@ -84,8 +84,8 @@ void main() { test('setPlayerType', () async { final MockIMASettings mockIMASettings = _mockIMASettings(); - const String playerType = 'playerType'; - final IOSImaSettings settings = IOSImaSettings( + const playerType = 'playerType'; + final settings = IOSImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setPlayerType(playerType); @@ -96,8 +96,8 @@ void main() { test('setPlayerVersion', () async { final MockIMASettings mockIMASettings = _mockIMASettings(); - const String playerVersion = 'playerVersion'; - final IOSImaSettings settings = IOSImaSettings( + const playerVersion = 'playerVersion'; + final settings = IOSImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setPlayerVersion(playerVersion); @@ -108,8 +108,8 @@ void main() { test('setPpid', () async { final MockIMASettings mockIMASettings = _mockIMASettings(); - const String ppid = 'ppid'; - final IOSImaSettings settings = IOSImaSettings( + const ppid = 'ppid'; + final settings = IOSImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setPpid(ppid); @@ -120,8 +120,8 @@ void main() { test('setSessionID', () async { final MockIMASettings mockIMASettings = _mockIMASettings(); - const String sessionID = 'sessionID'; - final IOSImaSettings settings = IOSImaSettings( + const sessionID = 'sessionID'; + final settings = IOSImaSettings( const PlatformImaSettingsCreationParams(), ); await settings.setSessionID(sessionID); @@ -132,7 +132,7 @@ void main() { } MockIMASettings _mockIMASettings() { - final MockIMASettings mockIMASettings = MockIMASettings(); + final mockIMASettings = MockIMASettings(); PigeonOverrides.iMASettings_new = () => mockIMASettings; return mockIMASettings; diff --git a/packages/interactive_media_ads/test/version_test.dart b/packages/interactive_media_ads/test/version_test.dart index 6f3c3d3bb8c..176bd79af5b 100644 --- a/packages/interactive_media_ads/test/version_test.dart +++ b/packages/interactive_media_ads/test/version_test.dart @@ -10,7 +10,7 @@ void main() { test('AdsRequestProxyApi.pluginVersion matches pubspec version', () { final String pubspecVersion = _getPubspecVersion(); - final String adsRequestProxyApiPath = + final adsRequestProxyApiPath = '${Directory.current.path}/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt'; final String apiFileAsString = File( adsRequestProxyApiPath, @@ -25,7 +25,7 @@ void main() { test('AdsRequestProxyAPIDelegate.pluginVersion matches pubspec version', () { final String pubspecVersion = _getPubspecVersion(); - final String adsRequestProxyApiDelegatePath = + final adsRequestProxyApiDelegatePath = '${Directory.current.path}/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift'; final String apiFileAsString = File( adsRequestProxyApiDelegatePath, @@ -39,10 +39,10 @@ void main() { } String _getPubspecVersion() { - final String pubspecPath = '${Directory.current.path}/pubspec.yaml'; + final pubspecPath = '${Directory.current.path}/pubspec.yaml'; final String pubspec = File(pubspecPath).readAsStringSync(); - final RegExp regex = RegExp(r'version:\s*(.*?) #'); + final regex = RegExp(r'version:\s*(.*?) #'); final RegExpMatch? match = regex.firstMatch(pubspec); return match!.group(1)!.trim(); diff --git a/packages/local_auth/local_auth/example/lib/main.dart b/packages/local_auth/local_auth/example/lib/main.dart index 384f71f801c..4dfc1b86b79 100644 --- a/packages/local_auth/local_auth/example/lib/main.dart +++ b/packages/local_auth/local_auth/example/lib/main.dart @@ -76,7 +76,7 @@ class _MyAppState extends State { } Future _authenticate() async { - bool authenticated = false; + var authenticated = false; try { setState(() { _isAuthenticating = true; @@ -118,7 +118,7 @@ class _MyAppState extends State { } Future _authenticateWithBiometrics() async { - bool authenticated = false; + var authenticated = false; try { setState(() { _isAuthenticating = true; @@ -157,7 +157,7 @@ class _MyAppState extends State { return; } - final String message = authenticated ? 'Authorized' : 'Not Authorized'; + final message = authenticated ? 'Authorized' : 'Not Authorized'; setState(() { _authorized = message; }); diff --git a/packages/local_auth/local_auth_android/example/lib/main.dart b/packages/local_auth/local_auth_android/example/lib/main.dart index 7e1ac81d1b1..ed2cfea7216 100644 --- a/packages/local_auth/local_auth_android/example/lib/main.dart +++ b/packages/local_auth/local_auth_android/example/lib/main.dart @@ -78,7 +78,7 @@ class _MyAppState extends State { } Future _authenticate() async { - bool authenticated = false; + var authenticated = false; try { setState(() { _isAuthenticating = true; @@ -120,7 +120,7 @@ class _MyAppState extends State { } Future _authenticateWithBiometrics() async { - bool authenticated = false; + var authenticated = false; try { setState(() { _isAuthenticating = true; @@ -161,7 +161,7 @@ class _MyAppState extends State { return; } - final String message = authenticated ? 'Authorized' : 'Not Authorized'; + final message = authenticated ? 'Authorized' : 'Not Authorized'; setState(() { _authorized = message; }); diff --git a/packages/local_auth/local_auth_android/lib/local_auth_android.dart b/packages/local_auth/local_auth_android/lib/local_auth_android.dart index af9289be3f2..017eb07a897 100644 --- a/packages/local_auth/local_auth_android/lib/local_auth_android.dart +++ b/packages/local_auth/local_auth_android/lib/local_auth_android.dart @@ -148,7 +148,7 @@ class LocalAuthAndroid extends LocalAuthPlatform { Iterable messagesList, ) { AndroidAuthMessages? messages; - for (final AuthMessages entry in messagesList) { + for (final entry in messagesList) { if (entry is AndroidAuthMessages) { messages = entry; } diff --git a/packages/local_auth/local_auth_android/test/local_auth_test.dart b/packages/local_auth/local_auth_android/test/local_auth_test.dart index 8b2a109f96a..ffc36392ade 100644 --- a/packages/local_auth/local_auth_android/test/local_auth_test.dart +++ b/packages/local_auth/local_auth_android/test/local_auth_test.dart @@ -109,7 +109,7 @@ void main() { api.authenticate(any, any), ).thenAnswer((_) async => AuthResult(code: AuthResultCode.success)); - const String reason = 'test reason'; + const reason = 'test reason'; await plugin.authenticate( localizedReason: reason, authMessages: [], @@ -118,7 +118,7 @@ void main() { final VerificationResult result = verify( api.authenticate(any, captureAny), ); - final AuthStrings strings = result.captured[0] as AuthStrings; + final strings = result.captured[0] as AuthStrings; expect(strings.reason, reason); // These should all be the default values from // auth_messages_android.dart @@ -134,7 +134,7 @@ void main() { api.authenticate(any, any), ).thenAnswer((_) async => AuthResult(code: AuthResultCode.success)); - const String reason = 'test reason'; + const reason = 'test reason'; await plugin.authenticate( localizedReason: reason, authMessages: [AnotherPlatformAuthMessages()], @@ -143,7 +143,7 @@ void main() { final VerificationResult result = verify( api.authenticate(any, captureAny), ); - final AuthStrings strings = result.captured[0] as AuthStrings; + final strings = result.captured[0] as AuthStrings; expect(strings.reason, reason); // These should all be the default values from // auth_messages_android.dart @@ -161,10 +161,10 @@ void main() { // These are arbitrary values; all that matters is that: // - they are different from the defaults, and // - they are different from each other. - const String reason = 'A'; - const String hint = 'B'; - const String cancel = 'C'; - const String signInTitle = 'D'; + const reason = 'A'; + const hint = 'B'; + const cancel = 'C'; + const signInTitle = 'D'; await plugin.authenticate( localizedReason: reason, authMessages: [ @@ -180,7 +180,7 @@ void main() { final VerificationResult result = verify( api.authenticate(any, captureAny), ); - final AuthStrings strings = result.captured[0] as AuthStrings; + final strings = result.captured[0] as AuthStrings; expect(strings.reason, reason); expect(strings.signInHint, hint); expect(strings.cancelButton, cancel); @@ -195,9 +195,9 @@ void main() { // These are arbitrary values; all that matters is that: // - they are different from the defaults, and // - they are different from each other. - const String reason = 'A'; - const String hint = 'B'; - const String cancel = 'C'; + const reason = 'A'; + const hint = 'B'; + const cancel = 'C'; await plugin.authenticate( localizedReason: reason, authMessages: [ @@ -208,7 +208,7 @@ void main() { final VerificationResult result = verify( api.authenticate(any, captureAny), ); - final AuthStrings strings = result.captured[0] as AuthStrings; + final strings = result.captured[0] as AuthStrings; expect(strings.reason, reason); // These should all be the provided values. expect(strings.signInHint, hint); @@ -233,7 +233,7 @@ void main() { final VerificationResult result = verify( api.authenticate(captureAny, any), ); - final AuthOptions options = result.captured[0] as AuthOptions; + final options = result.captured[0] as AuthOptions; expect(options.biometricOnly, false); expect(options.sensitiveTransaction, true); expect(options.sticky, false); @@ -257,7 +257,7 @@ void main() { final VerificationResult result = verify( api.authenticate(captureAny, any), ); - final AuthOptions options = result.captured[0] as AuthOptions; + final options = result.captured[0] as AuthOptions; expect(options.biometricOnly, true); expect(options.sensitiveTransaction, false); expect(options.sticky, true); @@ -630,7 +630,7 @@ void main() { test( 'converts unknownError to unknownError LocalAuthException, passing error message', () async { - const String errorMessage = 'Some error message'; + const errorMessage = 'Some error message'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResult( code: AuthResultCode.unknownError, diff --git a/packages/local_auth/local_auth_darwin/example/lib/main.dart b/packages/local_auth/local_auth_darwin/example/lib/main.dart index 0c9fabec413..c14e5862d97 100644 --- a/packages/local_auth/local_auth_darwin/example/lib/main.dart +++ b/packages/local_auth/local_auth_darwin/example/lib/main.dart @@ -78,7 +78,7 @@ class _MyAppState extends State { } Future _authenticate() async { - bool authenticated = false; + var authenticated = false; try { setState(() { _isAuthenticating = true; @@ -120,7 +120,7 @@ class _MyAppState extends State { } Future _authenticateWithBiometrics() async { - bool authenticated = false; + var authenticated = false; try { setState(() { _isAuthenticating = true; @@ -161,7 +161,7 @@ class _MyAppState extends State { return; } - final String message = authenticated ? 'Authorized' : 'Not Authorized'; + final message = authenticated ? 'Authorized' : 'Not Authorized'; setState(() { _authorized = message; }); diff --git a/packages/local_auth/local_auth_darwin/lib/local_auth_darwin.dart b/packages/local_auth/local_auth_darwin/lib/local_auth_darwin.dart index 82ee3554e39..461c0c57c74 100644 --- a/packages/local_auth/local_auth_darwin/lib/local_auth_darwin.dart +++ b/packages/local_auth/local_auth_darwin/lib/local_auth_darwin.dart @@ -124,7 +124,7 @@ class LocalAuthDarwin extends LocalAuthPlatform { Iterable messagesList, ) { IOSAuthMessages? messages; - for (final AuthMessages entry in messagesList) { + for (final entry in messagesList) { if (entry is IOSAuthMessages) { messages = entry; break; @@ -142,7 +142,7 @@ class LocalAuthDarwin extends LocalAuthPlatform { Iterable messagesList, ) { MacOSAuthMessages? messages; - for (final AuthMessages entry in messagesList) { + for (final entry in messagesList) { if (entry is MacOSAuthMessages) { messages = entry; break; diff --git a/packages/local_auth/local_auth_darwin/test/local_auth_darwin_test.dart b/packages/local_auth/local_auth_darwin/test/local_auth_darwin_test.dart index 4f6e37515e8..169cb467788 100644 --- a/packages/local_auth/local_auth_darwin/test/local_auth_darwin_test.dart +++ b/packages/local_auth/local_auth_darwin/test/local_auth_darwin_test.dart @@ -94,7 +94,7 @@ void main() { (_) async => AuthResultDetails(result: AuthResult.success), ); - const String reason = 'test reason'; + const reason = 'test reason'; await plugin.authenticate( localizedReason: reason, authMessages: [], @@ -103,7 +103,7 @@ void main() { final VerificationResult result = verify( api.authenticate(any, captureAny), ); - final AuthStrings strings = result.captured[0] as AuthStrings; + final strings = result.captured[0] as AuthStrings; expect(strings.reason, reason); // These should all be the default values from // auth_messages_ios.dart @@ -123,7 +123,7 @@ void main() { (_) async => AuthResultDetails(result: AuthResult.success), ); - const String reason = 'test reason'; + const reason = 'test reason'; await plugin.authenticate( localizedReason: reason, authMessages: [AnotherPlatformAuthMessages()], @@ -132,7 +132,7 @@ void main() { final VerificationResult result = verify( api.authenticate(any, captureAny), ); - final AuthStrings strings = result.captured[0] as AuthStrings; + final strings = result.captured[0] as AuthStrings; expect(strings.reason, reason); // These should all be the default values from // auth_messages_ios.dart @@ -153,7 +153,7 @@ void main() { (_) async => AuthResultDetails(result: AuthResult.success), ); - const String reason = 'test reason'; + const reason = 'test reason'; await plugin.authenticate( localizedReason: reason, authMessages: [const MacOSAuthMessages()], @@ -162,7 +162,7 @@ void main() { final VerificationResult result = verify( api.authenticate(any, captureAny), ); - final AuthStrings strings = result.captured[0] as AuthStrings; + final strings = result.captured[0] as AuthStrings; expect(strings.reason, reason); // These should all be the default values from // auth_messages_ios.dart @@ -186,9 +186,9 @@ void main() { // These are arbitrary values; all that matters is that: // - they are different from the defaults, and // - they are different from each other. - const String reason = 'A'; - const String cancel = 'B'; - const String localizedFallbackTitle = 'C'; + const reason = 'A'; + const cancel = 'B'; + const localizedFallbackTitle = 'C'; await plugin.authenticate( localizedReason: reason, @@ -204,7 +204,7 @@ void main() { final VerificationResult result = verify( api.authenticate(any, captureAny), ); - final AuthStrings strings = result.captured[0] as AuthStrings; + final strings = result.captured[0] as AuthStrings; expect(strings.reason, reason); expect(strings.cancelButton, cancel); expect(strings.localizedFallbackTitle, localizedFallbackTitle); @@ -225,9 +225,9 @@ void main() { // These are arbitrary values; all that matters is that: // - they are different from the defaults, and // - they are different from each other. - const String reason = 'A'; - const String cancel = 'B'; - const String localizedFallbackTitle = 'C'; + const reason = 'A'; + const cancel = 'B'; + const localizedFallbackTitle = 'C'; await plugin.authenticate( localizedReason: reason, authMessages: [ @@ -242,7 +242,7 @@ void main() { final VerificationResult result = verify( api.authenticate(any, captureAny), ); - final AuthStrings strings = result.captured[0] as AuthStrings; + final strings = result.captured[0] as AuthStrings; expect(strings.reason, reason); expect(strings.cancelButton, cancel); expect(strings.localizedFallbackTitle, localizedFallbackTitle); @@ -259,8 +259,8 @@ void main() { // These are arbitrary values; all that matters is that: // - they are different from the defaults, and // - they are different from each other. - const String reason = 'A'; - const String localizedFallbackTitle = 'B'; + const reason = 'A'; + const localizedFallbackTitle = 'B'; await plugin.authenticate( localizedReason: reason, authMessages: [ @@ -273,7 +273,7 @@ void main() { final VerificationResult result = verify( api.authenticate(any, captureAny), ); - final AuthStrings strings = result.captured[0] as AuthStrings; + final strings = result.captured[0] as AuthStrings; // These should all be the provided values. expect(strings.reason, reason); expect(strings.localizedFallbackTitle, localizedFallbackTitle); @@ -299,7 +299,7 @@ void main() { final VerificationResult result = verify( api.authenticate(captureAny, any), ); - final AuthOptions options = result.captured[0] as AuthOptions; + final options = result.captured[0] as AuthOptions; expect(options.biometricOnly, false); expect(options.sticky, false); }); @@ -321,7 +321,7 @@ void main() { final VerificationResult result = verify( api.authenticate(captureAny, any), ); - final AuthOptions options = result.captured[0] as AuthOptions; + final options = result.captured[0] as AuthOptions; expect(options.biometricOnly, true); expect(options.sticky, true); }); @@ -371,8 +371,8 @@ void main() { test( 'converts uiUnavailable to LocalAuthExceptionCode.uiUnavailable', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.uiUnavailable, @@ -411,8 +411,8 @@ void main() { test( 'converts systemCancel to LocalAuthExceptionCode.systemCanceled', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.systemCancel, @@ -451,8 +451,8 @@ void main() { test( 'converts userCancel to LocalAuthExceptionCode.userCanceled', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.userCancel, @@ -491,8 +491,8 @@ void main() { test( 'converts biometryDisconnected to LocalAuthExceptionCode.biometricHardwareTemporarilyUnavailable', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.biometryDisconnected, @@ -532,8 +532,8 @@ void main() { test( 'converts biometryLockout to LocalAuthExceptionCode.biometricLockout', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.biometryLockout, @@ -572,8 +572,8 @@ void main() { test( 'converts biometryNotAvailable to LocalAuthExceptionCode.noBiometricHardware', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.biometryNotAvailable, @@ -612,8 +612,8 @@ void main() { test( 'converts biometryNotPaired to LocalAuthExceptionCode.noBiometricHardware', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.biometryNotPaired, @@ -652,8 +652,8 @@ void main() { test( 'converts biometryNotEnrolled to LocalAuthExceptionCode.noBiometricsEnrolled', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.biometryNotEnrolled, @@ -692,8 +692,8 @@ void main() { test( 'converts invalidContext to LocalAuthExceptionCode.uiUnavailable', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.invalidContext, @@ -732,8 +732,8 @@ void main() { test( 'converts invalidDimensions to LocalAuthExceptionCode.uiUnavailable', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.invalidDimensions, @@ -772,8 +772,8 @@ void main() { test( 'converts notInteractive to LocalAuthExceptionCode.uiUnavailable', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.notInteractive, @@ -812,8 +812,8 @@ void main() { test( 'converts passcodeNotSet to LocalAuthExceptionCode.noCredentialsSet', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.passcodeNotSet, @@ -852,8 +852,8 @@ void main() { test( 'converts userFallback to LocalAuthExceptionCode.userRequestedFallback', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.userFallback, @@ -892,8 +892,8 @@ void main() { test( 'converts unknownError to LocalAuthExceptionCode.unknownError', () async { - const String errorMessage = 'a message'; - const String errorDetails = 'some details'; + const errorMessage = 'a message'; + const errorDetails = 'some details'; when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails( result: AuthResult.unknownError, diff --git a/packages/local_auth/local_auth_platform_interface/lib/default_method_channel_platform.dart b/packages/local_auth/local_auth_platform_interface/lib/default_method_channel_platform.dart index 822b3573046..ec4606f8979 100644 --- a/packages/local_auth/local_auth_platform_interface/lib/default_method_channel_platform.dart +++ b/packages/local_auth/local_auth_platform_interface/lib/default_method_channel_platform.dart @@ -22,14 +22,14 @@ class DefaultLocalAuthPlatform extends LocalAuthPlatform { AuthenticationOptions options = const AuthenticationOptions(), }) async { assert(localizedReason.isNotEmpty); - final Map args = { + final args = { 'localizedReason': localizedReason, 'useErrorDialogs': options.useErrorDialogs, 'stickyAuth': options.stickyAuth, 'sensitiveTransaction': options.sensitiveTransaction, 'biometricOnly': options.biometricOnly, }; - for (final AuthMessages messages in authMessages) { + for (final messages in authMessages) { args.addAll(messages.args); } return (await _channel.invokeMethod('authenticate', args)) ?? false; @@ -40,8 +40,8 @@ class DefaultLocalAuthPlatform extends LocalAuthPlatform { final List result = (await _channel.invokeListMethod('getAvailableBiometrics')) ?? []; - final List biometrics = []; - for (final String value in result) { + final biometrics = []; + for (final value in result) { switch (value) { case 'face': biometrics.add(BiometricType.face); diff --git a/packages/local_auth/local_auth_platform_interface/test/default_method_channel_platform_test.dart b/packages/local_auth/local_auth_platform_interface/test/default_method_channel_platform_test.dart index c538336e1fc..5372ca1b151 100644 --- a/packages/local_auth/local_auth_platform_interface/test/default_method_channel_platform_test.dart +++ b/packages/local_auth/local_auth_platform_interface/test/default_method_channel_platform_test.dart @@ -10,7 +10,7 @@ import 'package:local_auth_platform_interface/local_auth_platform_interface.dart void main() { TestWidgetsFlutterBinding.ensureInitialized(); - const MethodChannel channel = MethodChannel('plugins.flutter.io/local_auth'); + const channel = MethodChannel('plugins.flutter.io/local_auth'); late List log; late LocalAuthPlatform localAuthentication; diff --git a/packages/local_auth/local_auth_windows/example/lib/main.dart b/packages/local_auth/local_auth_windows/example/lib/main.dart index 1c76c6abb15..5d76d8a34de 100644 --- a/packages/local_auth/local_auth_windows/example/lib/main.dart +++ b/packages/local_auth/local_auth_windows/example/lib/main.dart @@ -78,7 +78,7 @@ class _MyAppState extends State { } Future _authenticate() async { - bool authenticated = false; + var authenticated = false; try { setState(() { _isAuthenticating = true; diff --git a/packages/metrics_center/lib/src/common.dart b/packages/metrics_center/lib/src/common.dart index 126f66554ce..07223c59729 100644 --- a/packages/metrics_center/lib/src/common.dart +++ b/packages/metrics_center/lib/src/common.dart @@ -52,12 +52,12 @@ abstract class MetricDestination { /// credentials json. It's currently the case for Chrmoium LUCI bots. AuthClient authClientFromAccessToken(String token, List scopes) { final DateTime anHourLater = DateTime.now().add(const Duration(hours: 1)); - final AccessToken accessToken = AccessToken( + final accessToken = AccessToken( 'Bearer', token, anHourLater.toUtc(), ); - final AccessCredentials accessCredentials = AccessCredentials( + final accessCredentials = AccessCredentials( accessToken, null, scopes, diff --git a/packages/metrics_center/lib/src/gcs_lock.dart b/packages/metrics_center/lib/src/gcs_lock.dart index 0c1d05a3ed8..74a41fa7e09 100644 --- a/packages/metrics_center/lib/src/gcs_lock.dart +++ b/packages/metrics_center/lib/src/gcs_lock.dart @@ -43,13 +43,13 @@ class GcsLock { } Future _lock(String lockFileName) async { - final Object object = Object(); + final object = Object(); object.bucket = _bucketName; object.name = lockFileName; - final Media content = Media(const Stream>.empty(), 0); + final content = Media(const Stream>.empty(), 0); - Duration waitPeriod = const Duration(milliseconds: 10); - bool locked = false; + var waitPeriod = const Duration(milliseconds: 10); + var locked = false; while (!locked) { try { await _api.objects.insert( @@ -82,8 +82,8 @@ class GcsLock { } Future _unlock(String lockFileName) async { - Duration waitPeriod = const Duration(milliseconds: 10); - bool unlocked = false; + var waitPeriod = const Duration(milliseconds: 10); + var unlocked = false; // Retry in the case of GCS returning an API error, but rethrow if unable // to unlock after a certain period of time. while (!unlocked) { diff --git a/packages/metrics_center/lib/src/google_benchmark.dart b/packages/metrics_center/lib/src/google_benchmark.dart index 8c907c214d9..4fb18159c3c 100644 --- a/packages/metrics_center/lib/src/google_benchmark.dart +++ b/packages/metrics_center/lib/src/google_benchmark.dart @@ -41,17 +41,17 @@ const List _kContextIgnoreKeys = [ class GoogleBenchmarkParser { /// Given a Google benchmark json output, parse its content into a list of [MetricPoint]. static Future> parse(String jsonFileName) async { - final Map jsonResult = + final jsonResult = jsonDecode(File(jsonFileName).readAsStringSync()) as Map; - final Map rawContext = + final rawContext = jsonResult['context'] as Map; final Map context = rawContext.map( (String k, dynamic v) => MapEntry(k, v.toString()), )..removeWhere((String k, String v) => _kContextIgnoreKeys.contains(k)); - final List points = []; + final points = []; for (final dynamic item in jsonResult['benchmarks'] as List) { _parseAnItem(item as Map, points, context); } @@ -64,8 +64,8 @@ void _parseAnItem( List points, Map context, ) { - final String name = item[kNameKey] as String; - final Map timeUnitMap = { + final name = item[kNameKey] as String; + final timeUnitMap = { if (item.containsKey(_kTimeUnitKey)) kUnitKey: item[_kTimeUnitKey] as String, }; diff --git a/packages/metrics_center/lib/src/skiaperf.dart b/packages/metrics_center/lib/src/skiaperf.dart index d218e1ebbcd..d12b4716afc 100644 --- a/packages/metrics_center/lib/src/skiaperf.dart +++ b/packages/metrics_center/lib/src/skiaperf.dart @@ -99,7 +99,7 @@ class SkiaPerfPoint extends MetricPoint { final String subResult = p.tags[kSubResultKey] ?? kSkiaPerfValueKey; - final Map options = {} + final options = {} ..addEntries( p.tags.entries.where( (MapEntry entry) => @@ -169,7 +169,7 @@ class SkiaPerfPoint extends MetricPoint { static Map toSkiaPerfJson(List points) { assert(points.isNotEmpty); assert(() { - for (final SkiaPerfPoint p in points) { + for (final p in points) { if (p.githubRepo != points[0].githubRepo || p.gitHash != points[0].gitHash) { return false; @@ -178,8 +178,8 @@ class SkiaPerfPoint extends MetricPoint { return true; }(), 'All points must have same githubRepo and gitHash'); - final Map results = {}; - for (final SkiaPerfPoint p in points) { + final results = {}; + for (final p in points) { final Map subResultJson = p._toSubResultJson(); if (results[p.testName] == null) { results[p.testName] = { @@ -238,7 +238,7 @@ class SkiaPerfGcsAdaptor { final List content = utf8.encode(jsonString); // Retry multiple times as GCS may return 504 timeout. - for (int retry = 0; retry < 5; retry += 1) { + for (var retry = 0; retry < 5; retry += 1) { try { await _gcsBucket.writeBytes(objectName, content); return; @@ -265,7 +265,7 @@ class SkiaPerfGcsAdaptor { /// 504 happens. Future> readPoints(String objectName) async { // Retry multiple times as GCS may return 504 timeout. - for (int retry = 0; retry < 5; retry += 1) { + for (var retry = 0; retry < 5; retry += 1) { try { return await _readPointsWithoutRetry(objectName); } catch (e) { @@ -294,21 +294,21 @@ class SkiaPerfGcsAdaptor { final Stream> stream = _gcsBucket.read(objectName); final Stream byteStream = stream.expand((List x) => x); - final Map decodedJson = + final decodedJson = jsonDecode(utf8.decode(await byteStream.toList())) as Map; - final List points = []; + final points = []; final String firstGcsNameComponent = objectName.split('/')[0]; _populateGcsNameToGithubRepoMapIfNeeded(); final String githubRepo = _gcsNameToGithubRepo[firstGcsNameComponent]!; - final String? gitHash = decodedJson[kSkiaPerfGitHashKey] as String?; - final Map results = + final gitHash = decodedJson[kSkiaPerfGitHashKey] as String?; + final results = decodedJson[kSkiaPerfResultsKey] as Map; for (final String name in results.keys) { - final Map subResultMap = + final subResultMap = results[name][kSkiaPerfDefaultConfig] as Map; for (final String subResult in subResultMap.keys.where( (String s) => s != kSkiaPerfOptionsKey, @@ -352,7 +352,7 @@ class SkiaPerfGcsAdaptor { final String month = commitUtcTime.month.toString().padLeft(2, '0'); final String day = commitUtcTime.day.toString().padLeft(2, '0'); final String hour = commitUtcTime.hour.toString().padLeft(2, '0'); - final String dateComponents = '${commitUtcTime.year}/$month/$day/$hour'; + final dateComponents = '${commitUtcTime.year}/$month/$day/$hour'; return '$topComponent/$dateComponents/$revision/${taskName}_values.json'; } @@ -414,15 +414,15 @@ class SkiaPerfDestination extends MetricDestination { String projectId, { bool isTesting = false, }) async { - final Storage storage = Storage(client, projectId); + final storage = Storage(client, projectId); final String bucketName = isTesting ? kTestBucketName : kBucketName; if (!await storage.bucketExists(bucketName)) { throw StateError('Bucket $bucketName does not exist.'); } - final SkiaPerfGcsAdaptor adaptor = SkiaPerfGcsAdaptor( + final adaptor = SkiaPerfGcsAdaptor( storage.bucket(bucketName), ); - final GcsLock lock = GcsLock(StorageApi(client), bucketName); + final lock = GcsLock(StorageApi(client), bucketName); return SkiaPerfDestination(adaptor, lock); } @@ -446,7 +446,7 @@ class SkiaPerfDestination extends MetricDestination { } // All created locks must be released before returning - final List> lockFutures = >[]; + final lockFutures = >[]; // 2nd, read existing points from the gcs object and update with new ones. for (final String repo in pointMap.keys) { @@ -468,7 +468,7 @@ class SkiaPerfDestination extends MetricDestination { final List oldPoints = await _gcs.readPoints( objectName, ); - for (final SkiaPerfPoint p in oldPoints) { + for (final p in oldPoints) { if (newPoints![p.id] == null) { newPoints[p.id] = p; } diff --git a/packages/metrics_center/test/flutter_test.dart b/packages/metrics_center/test/flutter_test.dart index eb27f65ce38..44cb155d41d 100644 --- a/packages/metrics_center/test/flutter_test.dart +++ b/packages/metrics_center/test/flutter_test.dart @@ -9,8 +9,8 @@ import 'common.dart'; import 'utility.dart'; void main() { - const String gitRevision = 'ca799fa8b2254d09664b78ee80c43b434788d112'; - final FlutterEngineMetricPoint simplePoint = FlutterEngineMetricPoint( + const gitRevision = 'ca799fa8b2254d09664b78ee80c43b434788d112'; + final simplePoint = FlutterEngineMetricPoint( 'BM_ParagraphLongLayout', 287235, gitRevision, @@ -22,7 +22,7 @@ void main() { expect(simplePoint.tags[kGitRevisionKey], gitRevision); expect(simplePoint.tags[kNameKey], 'BM_ParagraphLongLayout'); - final FlutterEngineMetricPoint detailedPoint = FlutterEngineMetricPoint( + final detailedPoint = FlutterEngineMetricPoint( 'BM_ParagraphLongLayout', 287224, 'ca799fa8b2254d09664b78ee80c43b434788d112', diff --git a/packages/metrics_center/test/gcs_lock_test.dart b/packages/metrics_center/test/gcs_lock_test.dart index 8d3180e030d..4dbbb2b1cd6 100644 --- a/packages/metrics_center/test/gcs_lock_test.dart +++ b/packages/metrics_center/test/gcs_lock_test.dart @@ -26,20 +26,20 @@ enum TestPhase { run1, run2 } ], ) void main() { - const Duration kDelayStep = Duration(milliseconds: 10); + const kDelayStep = Duration(milliseconds: 10); final Map? credentialsJson = getTestGcpCredentialsJson(); test('GcsLock prints warnings for long waits', () { // Capture print to verify error messages. - final List prints = []; - final ZoneSpecification spec = ZoneSpecification( + final prints = []; + final spec = ZoneSpecification( print: (_, __, ___, String msg) => prints.add(msg), ); Zone.current.fork(specification: spec).run(() { fakeAsync((FakeAsync fakeAsync) { - final MockAuthClient mockClient = MockAuthClient(); - final GcsLock lock = GcsLock(StorageApi(mockClient), 'mockBucket'); + final mockClient = MockAuthClient(); + final lock = GcsLock(StorageApi(mockClient), 'mockBucket'); when(mockClient.send(any)).thenThrow(DetailedApiRequestError(412, '')); final Future runFinished = lock.protectedRun( 'mock.lock', @@ -48,7 +48,7 @@ void main() { fakeAsync.elapse(const Duration(seconds: 10)); when(mockClient.send(any)).thenThrow(AssertionError('Stop!')); runFinished.catchError((dynamic e) { - final AssertionError error = e as AssertionError; + final error = e as AssertionError; expect(error.message, 'Stop!'); // TODO(goderbauer): We should not be printing from a test. // ignore: avoid_print @@ -58,7 +58,7 @@ void main() { }); }); - const String kExpectedErrorMessage = + const kExpectedErrorMessage = 'The lock is waiting for a long time: ' '0:00:10.240000. If the lock file mock.lock in bucket mockBucket ' 'seems to be stuck (i.e., it was created a long time ago and no one ' @@ -73,8 +73,8 @@ void main() { ServiceAccountCredentials.fromJson(credentialsJson), Storage.SCOPES, ); - final GcsLock lock = GcsLock(StorageApi(client), kTestBucketName); - int testValue = 0; + final lock = GcsLock(StorageApi(client), kTestBucketName); + var testValue = 0; await lock.protectedRun('test.lock', () async { testValue = 1; }); @@ -90,11 +90,11 @@ void main() { ServiceAccountCredentials.fromJson(credentialsJson), Storage.SCOPES, ); - final GcsLock lock1 = GcsLock(StorageApi(client), kTestBucketName); - final GcsLock lock2 = GcsLock(StorageApi(client), kTestBucketName); + final lock1 = GcsLock(StorageApi(client), kTestBucketName); + final lock2 = GcsLock(StorageApi(client), kTestBucketName); TestPhase phase = TestPhase.run1; - final Completer started1 = Completer(); + final started1 = Completer(); final Future finished1 = lock1.protectedRun('test.lock', () async { started1.complete(); while (phase == TestPhase.run1) { @@ -104,7 +104,7 @@ void main() { await started1.future; - final Completer started2 = Completer(); + final started2 = Completer(); final Future finished2 = lock2.protectedRun('test.lock', () async { started2.complete(); }); @@ -128,8 +128,8 @@ void main() { fakeAsync((FakeAsync fakeAsync) { final StorageApi mockStorageApi = MockStorageApi(); final ObjectsResource mockObjectsResource = MockObjectsResource(); - final GcsLock gcsLock = GcsLock(mockStorageApi, kTestBucketName); - const String lockFileName = 'test.lock'; + final gcsLock = GcsLock(mockStorageApi, kTestBucketName); + const lockFileName = 'test.lock'; when(mockStorageApi.objects).thenReturn(mockObjectsResource); // Simulate a failure to delete a lock file. diff --git a/packages/metrics_center/test/google_benchmark_test.dart b/packages/metrics_center/test/google_benchmark_test.dart index 6f856ac07ba..8e7a7625737 100644 --- a/packages/metrics_center/test/google_benchmark_test.dart +++ b/packages/metrics_center/test/google_benchmark_test.dart @@ -43,7 +43,7 @@ void main() { 'ParagraphFixture/TextBigO_BigO', 'ParagraphFixture/TextBigO_RMS', ]); - for (final MetricPoint p in points) { + for (final p in points) { expect(p.tags.containsKey('host_name'), false); expect(p.tags.containsKey('load_avg'), false); expect(p.tags.containsKey('caches'), false); diff --git a/packages/metrics_center/test/skiaperf_test.dart b/packages/metrics_center/test/skiaperf_test.dart index 424d8b123af..4a1e3ff311f 100644 --- a/packages/metrics_center/test/skiaperf_test.dart +++ b/packages/metrics_center/test/skiaperf_test.dart @@ -59,19 +59,19 @@ class MockSkiaPerfGcsAdaptor implements SkiaPerfGcsAdaptor { @GenerateMocks([Bucket, ObjectInfo]) Future main() async { - const double kValue1 = 1.0; - const double kValue2 = 2.0; - const double kValue3 = 3.0; - - const String kFrameworkRevision1 = '9011cece2595447eea5dd91adaa241c1c9ef9a33'; - const String kFrameworkRevision2 = '372fe290e4d4f3f97cbf02a57d235771a9412f10'; - const String kEngineRevision1 = '617938024315e205f26ed72ff0f0647775fa6a71'; - const String kEngineRevision2 = '5858519139c22484aaff1cf5b26bdf7951259344'; - const String kTaskName = 'analyzer_benchmark'; - const String kMetric1 = 'flutter_repo_batch_maximum'; - const String kMetric2 = 'flutter_repo_watch_maximum'; - - final MetricPoint cocoonPointRev1Metric1 = + const kValue1 = 1.0; + const kValue2 = 2.0; + const kValue3 = 3.0; + + const kFrameworkRevision1 = '9011cece2595447eea5dd91adaa241c1c9ef9a33'; + const kFrameworkRevision2 = '372fe290e4d4f3f97cbf02a57d235771a9412f10'; + const kEngineRevision1 = '617938024315e205f26ed72ff0f0647775fa6a71'; + const kEngineRevision2 = '5858519139c22484aaff1cf5b26bdf7951259344'; + const kTaskName = 'analyzer_benchmark'; + const kMetric1 = 'flutter_repo_batch_maximum'; + const kMetric2 = 'flutter_repo_watch_maximum'; + + final cocoonPointRev1Metric1 = MetricPoint(kValue1, const { kGithubRepoKey: kFlutterFrameworkRepo, kGitRevisionKey: kFrameworkRevision1, @@ -80,7 +80,7 @@ Future main() async { kUnitKey: 's', }); - final MetricPoint cocoonPointRev1Metric2 = + final cocoonPointRev1Metric2 = MetricPoint(kValue2, const { kGithubRepoKey: kFlutterFrameworkRepo, kGitRevisionKey: kFrameworkRevision1, @@ -89,7 +89,7 @@ Future main() async { kUnitKey: 's', }); - final MetricPoint cocoonPointRev2Metric1 = + final cocoonPointRev2Metric1 = MetricPoint(kValue3, const { kGithubRepoKey: kFlutterFrameworkRepo, kGitRevisionKey: kFrameworkRevision2, @@ -98,7 +98,7 @@ Future main() async { kUnitKey: 's', }); - final MetricPoint cocoonPointBetaRev1Metric1 = + final cocoonPointBetaRev1Metric1 = MetricPoint(kValue1, const { kGithubRepoKey: kFlutterFrameworkRepo, kGitRevisionKey: kFrameworkRevision1, @@ -108,8 +108,7 @@ Future main() async { 'branch': 'beta', }); - final MetricPoint - cocoonPointBetaRev1Metric1BadBranch = MetricPoint(kValue1, const < + final cocoonPointBetaRev1Metric1BadBranch = MetricPoint(kValue1, const < String, String >{ @@ -126,12 +125,12 @@ Future main() async { 'branch': 'beta', }); - const String engineMetricName = 'BM_PaintRecordInit'; - const String engineRevision = 'ca799fa8b2254d09664b78ee80c43b434788d112'; + const engineMetricName = 'BM_PaintRecordInit'; + const engineRevision = 'ca799fa8b2254d09664b78ee80c43b434788d112'; const double engineValue1 = 101; const double engineValue2 = 102; - final FlutterEngineMetricPoint enginePoint1 = FlutterEngineMetricPoint( + final enginePoint1 = FlutterEngineMetricPoint( engineMetricName, engineValue1, engineRevision, @@ -146,7 +145,7 @@ Future main() async { }, ); - final FlutterEngineMetricPoint enginePoint2 = FlutterEngineMetricPoint( + final enginePoint2 = FlutterEngineMetricPoint( engineMetricName, engineValue2, engineRevision, @@ -162,7 +161,7 @@ Future main() async { ); test('Throw if invalid points are converted to SkiaPoint', () { - final MetricPoint noGithubRepoPoint = MetricPoint( + final noGithubRepoPoint = MetricPoint( kValue1, const { kGitRevisionKey: kFrameworkRevision1, @@ -170,7 +169,7 @@ Future main() async { }, ); - final MetricPoint noGitRevisionPoint = MetricPoint( + final noGitRevisionPoint = MetricPoint( kValue1, const { kGithubRepoKey: kFlutterFrameworkRepo, @@ -178,7 +177,7 @@ Future main() async { }, ); - final MetricPoint noTestNamePoint = MetricPoint( + final noTestNamePoint = MetricPoint( kValue1, const { kGithubRepoKey: kFlutterFrameworkRepo, @@ -195,7 +194,7 @@ Future main() async { }); test('Correctly convert a metric point from cocoon to SkiaPoint', () { - final SkiaPerfPoint skiaPoint1 = SkiaPerfPoint.fromPoint( + final skiaPoint1 = SkiaPerfPoint.fromPoint( cocoonPointRev1Metric1, ); expect(skiaPoint1, isNotNull); @@ -206,13 +205,13 @@ Future main() async { }); test('Cocoon points correctly encode into Skia perf json format', () { - final SkiaPerfPoint p1 = SkiaPerfPoint.fromPoint(cocoonPointRev1Metric1); - final SkiaPerfPoint p2 = SkiaPerfPoint.fromPoint(cocoonPointRev1Metric2); - final SkiaPerfPoint p3 = SkiaPerfPoint.fromPoint( + final p1 = SkiaPerfPoint.fromPoint(cocoonPointRev1Metric1); + final p2 = SkiaPerfPoint.fromPoint(cocoonPointRev1Metric2); + final p3 = SkiaPerfPoint.fromPoint( cocoonPointBetaRev1Metric1, ); - const JsonEncoder encoder = JsonEncoder.withIndent(' '); + const encoder = JsonEncoder.withIndent(' '); expect( encoder.convert( @@ -246,7 +245,7 @@ Future main() async { }); test('Engine metric points correctly encode into Skia perf json format', () { - const JsonEncoder encoder = JsonEncoder.withIndent(' '); + const encoder = JsonEncoder.withIndent(' '); expect( encoder.convert( SkiaPerfPoint.toSkiaPerfJson([ @@ -280,7 +279,7 @@ Future main() async { 'Throw if engine points with the same test name but different options are converted to ' 'Skia perf points', () { - final FlutterEngineMetricPoint enginePoint1 = FlutterEngineMetricPoint( + final enginePoint1 = FlutterEngineMetricPoint( 'BM_PaintRecordInit', 101, 'ca799fa8b2254d09664b78ee80c43b434788d112', @@ -290,7 +289,7 @@ Future main() async { 'cpu_scaling_enabled': 'true', }, ); - final FlutterEngineMetricPoint enginePoint2 = FlutterEngineMetricPoint( + final enginePoint2 = FlutterEngineMetricPoint( 'BM_PaintRecordInit', 102, 'ca799fa8b2254d09664b78ee80c43b434788d112', @@ -301,7 +300,7 @@ Future main() async { }, ); - const JsonEncoder encoder = JsonEncoder.withIndent(' '); + const encoder = JsonEncoder.withIndent(' '); expect( () => encoder.convert( SkiaPerfPoint.toSkiaPerfJson([ @@ -318,8 +317,8 @@ Future main() async { 'Throw if two Cocoon metric points with the same name and subResult keys ' 'but different options are converted to Skia perf points', () { - final SkiaPerfPoint p1 = SkiaPerfPoint.fromPoint(cocoonPointRev1Metric1); - final SkiaPerfPoint p2 = SkiaPerfPoint.fromPoint( + final p1 = SkiaPerfPoint.fromPoint(cocoonPointRev1Metric1); + final p2 = SkiaPerfPoint.fromPoint( cocoonPointBetaRev1Metric1BadBranch, ); @@ -363,8 +362,8 @@ Future main() async { }); test('Successfully read mock GCS that fails 1st time with 504', () async { - final MockBucket testBucket = MockBucket(); - final SkiaPerfGcsAdaptor skiaPerfGcs = SkiaPerfGcsAdaptor(testBucket); + final testBucket = MockBucket(); + final skiaPerfGcs = SkiaPerfGcsAdaptor(testBucket); final String testObjectName = await SkiaPerfGcsAdaptor.computeObjectName( kFlutterFrameworkRepo, @@ -373,7 +372,7 @@ Future main() async { 'test', ); - final List writePoints = [ + final writePoints = [ SkiaPerfPoint.fromPoint(cocoonPointRev1Metric1), ]; final String skiaPerfJson = jsonEncode( @@ -390,7 +389,7 @@ Future main() async { testBucket.info(testObjectName), ).thenThrow(DetailedApiRequestError(504, 'Test Failure')); - final MockObjectInfo mockObjectInfo = MockObjectInfo(); + final mockObjectInfo = MockObjectInfo(); when( mockObjectInfo.downloadLink, ).thenReturn(Uri.https('test.com', 'mock.json')); @@ -414,8 +413,8 @@ Future main() async { }); test('Return empty list if the GCS file does not exist', () async { - final MockBucket testBucket = MockBucket(); - final SkiaPerfGcsAdaptor skiaPerfGcs = SkiaPerfGcsAdaptor(testBucket); + final testBucket = MockBucket(); + final skiaPerfGcs = SkiaPerfGcsAdaptor(testBucket); final String testObjectName = await SkiaPerfGcsAdaptor.computeObjectName( kFlutterFrameworkRepo, kFrameworkRevision1, @@ -433,19 +432,19 @@ Future main() async { GcsLock? testLock; final Map? credentialsJson = getTestGcpCredentialsJson(); if (credentialsJson != null) { - final ServiceAccountCredentials credentials = + final credentials = ServiceAccountCredentials.fromJson(credentialsJson); final AutoRefreshingAuthClient client = await clientViaServiceAccount( credentials, Storage.SCOPES, ); - final Storage storage = Storage( + final storage = Storage( client, credentialsJson['project_id'] as String, ); - const String kTestBucketName = 'flutter-skia-perf-test'; + const kTestBucketName = 'flutter-skia-perf-test'; assert(await storage.bucketExists(kTestBucketName)); testBucket = storage.bucket(kTestBucketName); @@ -453,7 +452,7 @@ Future main() async { } Future skiaPerfGcsAdapterIntegrationTest() async { - final SkiaPerfGcsAdaptor skiaPerfGcs = SkiaPerfGcsAdaptor(testBucket!); + final skiaPerfGcs = SkiaPerfGcsAdaptor(testBucket!); final String testObjectName = await SkiaPerfGcsAdaptor.computeObjectName( kFlutterFrameworkRepo, @@ -488,13 +487,13 @@ Future main() async { expectSetMatch(points.map((SkiaPerfPoint p) => p.gitHash), [ kFrameworkRevision1, ]); - for (int i = 0; i < 2; i += 1) { + for (var i = 0; i < 2; i += 1) { expect(points[0].jsonUrl, startsWith('https://')); } } Future skiaPerfGcsIntegrationTestWithEnginePoints() async { - final SkiaPerfGcsAdaptor skiaPerfGcs = SkiaPerfGcsAdaptor(testBucket!); + final skiaPerfGcs = SkiaPerfGcsAdaptor(testBucket!); final String testObjectName = await SkiaPerfGcsAdaptor.computeObjectName( kFlutterEngineRepo, @@ -526,7 +525,7 @@ Future main() async { expectSetMatch(points.map((SkiaPerfPoint p) => p.gitHash), [ engineRevision, ]); - for (int i = 0; i < 2; i += 1) { + for (var i = 0; i < 2; i += 1) { expect(points[0].jsonUrl, startsWith('https://')); } } @@ -591,13 +590,13 @@ Future main() async { ); test('SkiaPerfDestination.update awaits locks', () async { - bool updateCompleted = false; - final Completer callbackCompleter = Completer(); + var updateCompleted = false; + final callbackCompleter = Completer(); final SkiaPerfGcsAdaptor mockGcs = MockSkiaPerfGcsAdaptor( writePointsOverride: () => callbackCompleter.future, ); final GcsLock mockLock = MockGcsLock(); - final SkiaPerfDestination dst = SkiaPerfDestination(mockGcs, mockLock); + final dst = SkiaPerfDestination(mockGcs, mockLock); final Future updateFuture = dst.update( [cocoonPointRev1Metric1], DateTime.fromMillisecondsSinceEpoch(123), @@ -620,7 +619,7 @@ Future main() async { test('SkiaPerfDestination correctly updates points', () async { final SkiaPerfGcsAdaptor mockGcs = MockSkiaPerfGcsAdaptor(); final GcsLock mockLock = MockGcsLock(); - final SkiaPerfDestination dst = SkiaPerfDestination(mockGcs, mockLock); + final dst = SkiaPerfDestination(mockGcs, mockLock); await dst.update( [cocoonPointRev1Metric1], DateTime.fromMillisecondsSinceEpoch(123), @@ -652,7 +651,7 @@ Future main() async { kValue2, ]); - final MetricPoint updated = MetricPoint( + final updated = MetricPoint( kValue3, cocoonPointRev1Metric1.tags, ); @@ -690,7 +689,7 @@ Future main() async { }); Future skiaPerfDestinationIntegrationTest() async { - final SkiaPerfDestination destination = SkiaPerfDestination( + final destination = SkiaPerfDestination( SkiaPerfGcsAdaptor(testBucket!), testLock, ); diff --git a/packages/metrics_center/test/utility.dart b/packages/metrics_center/test/utility.dart index 78f52d93526..321b5762568 100644 --- a/packages/metrics_center/test/utility.dart +++ b/packages/metrics_center/test/utility.dart @@ -14,7 +14,7 @@ void expectSetMatch(Iterable actual, Iterable expected) { // May return null if the credentials file doesn't exist. Map? getTestGcpCredentialsJson() { - final File f = File('secret/test_gcp_credentials.json'); + final f = File('secret/test_gcp_credentials.json'); if (!f.existsSync()) { return null; } diff --git a/packages/multicast_dns/example/main.dart b/packages/multicast_dns/example/main.dart index 360d5a3273b..bb441d7495d 100644 --- a/packages/multicast_dns/example/main.dart +++ b/packages/multicast_dns/example/main.dart @@ -12,8 +12,8 @@ import 'package:multicast_dns/multicast_dns.dart'; Future main() async { // Parse the command line arguments. - const String name = '_dartobservatory._tcp.local'; - final MDnsClient client = MDnsClient(); + const name = '_dartobservatory._tcp.local'; + final client = MDnsClient(); // Start the client with default options. await client.start(); diff --git a/packages/multicast_dns/example/mdns_resolve.dart b/packages/multicast_dns/example/mdns_resolve.dart index 97ef0d8c88b..ed4301476c5 100644 --- a/packages/multicast_dns/example/mdns_resolve.dart +++ b/packages/multicast_dns/example/mdns_resolve.dart @@ -21,7 +21,7 @@ For example: final String name = args[0]; - final MDnsClient client = MDnsClient(); + final client = MDnsClient(); await client.start(); await for (final IPAddressResourceRecord record in client.lookup( diff --git a/packages/multicast_dns/example/mdns_sd.dart b/packages/multicast_dns/example/mdns_sd.dart index 4c4d5fea7a8..1d2f3623007 100644 --- a/packages/multicast_dns/example/mdns_sd.dart +++ b/packages/multicast_dns/example/mdns_sd.dart @@ -21,7 +21,7 @@ For example: final bool verbose = args.contains('--verbose') || args.contains('-v'); final String name = args.last; - final MDnsClient client = MDnsClient(); + final client = MDnsClient(); await client.start(); await for (final PtrResourceRecord ptr in client.lookup( diff --git a/packages/multicast_dns/lib/multicast_dns.dart b/packages/multicast_dns/lib/multicast_dns.dart index 0a0c7d74062..3b5b2b5fc8e 100644 --- a/packages/multicast_dns/lib/multicast_dns.dart +++ b/packages/multicast_dns/lib/multicast_dns.dart @@ -143,7 +143,7 @@ class MDnsClient { listenAddress.type, )).toList(); - for (final NetworkInterface interface in interfaces) { + for (final interface in interfaces) { final InternetAddress targetAddress = interface.addresses[0]; // Ensure that we're using this address/interface for multicast. @@ -217,14 +217,14 @@ class MDnsClient { throw StateError('mDNS client must be started before calling lookup.'); } // Look for entries in the cache. - final List cached = []; + final cached = []; _cache.lookup( query.fullyQualifiedName, query.resourceRecordType, cached, ); if (cached.isNotEmpty) { - final StreamController controller = StreamController(); + final controller = StreamController(); cached.forEach(controller.add); controller.close(); return controller.stream; diff --git a/packages/multicast_dns/lib/src/lookup_resolver.dart b/packages/multicast_dns/lib/src/lookup_resolver.dart index 531be38f2b1..bca9c16cbcb 100644 --- a/packages/multicast_dns/lib/src/lookup_resolver.dart +++ b/packages/multicast_dns/lib/src/lookup_resolver.dart @@ -40,9 +40,9 @@ class LookupResolver { String name, Duration timeout, ) { - final StreamController controller = StreamController(); - final PendingRequest request = PendingRequest(type, name, controller); - final Timer timer = Timer(timeout, () { + final controller = StreamController(); + final request = PendingRequest(type, name, controller); + final timer = Timer(timeout, () { request.unlink(); controller.close(); }); @@ -54,7 +54,7 @@ class LookupResolver { /// Parses [ResoureRecord]s received and delivers them to the appropriate /// listener(s) added via [addPendingRequest]. void handleResponse(List response) { - for (final ResourceRecord r in response) { + for (final r in response) { final int type = r.resourceRecordType; String name = r.name.toLowerCase(); if (name.endsWith('.')) { diff --git a/packages/multicast_dns/lib/src/native_protocol_client.dart b/packages/multicast_dns/lib/src/native_protocol_client.dart index 4c07df865df..89ea986d33c 100644 --- a/packages/multicast_dns/lib/src/native_protocol_client.dart +++ b/packages/multicast_dns/lib/src/native_protocol_client.dart @@ -25,7 +25,7 @@ class ResourceRecordCache { /// The number of entries in the cache. int get entryCount { - int count = 0; + var count = 0; for (final SplayTreeMap> map in _cache.values) { for (final List records in map.values) { @@ -40,8 +40,8 @@ class ResourceRecordCache { // TODO(karlklose): include flush bit in the record and only flush if // necessary. // Clear the cache for all name/type combinations to be updated. - final Map> seenRecordTypes = >{}; - for (final ResourceRecord record in records) { + final seenRecordTypes = >{}; + for (final record in records) { // TODO(dnfield): Update this to use set literal syntax when we're able to bump the SDK constraint. seenRecordTypes[record.resourceRecordType] ??= Set(); // ignore: prefer_collection_literals diff --git a/packages/multicast_dns/lib/src/packet.dart b/packages/multicast_dns/lib/src/packet.dart index 60e1b07fe5e..e5a6756c0b9 100644 --- a/packages/multicast_dns/lib/src/packet.dart +++ b/packages/multicast_dns/lib/src/packet.dart @@ -56,14 +56,14 @@ List encodeMDnsQuery( // Calculate the size of the packet. int size = _kHeaderSize; - for (int i = 0; i < rawNameParts.length; i++) { + for (var i = 0; i < rawNameParts.length; i++) { size += 1 + rawNameParts[i].length; } size += 1; // End with empty part size += 4; // Trailer (QTYPE and QCLASS). - final Uint8List data = Uint8List(size); - final ByteData packetByteData = ByteData.view(data.buffer); + final data = Uint8List(size); + final packetByteData = ByteData.view(data.buffer); // Query identifier - just use 0. packetByteData.setUint16(_kIdOffset, 0); // Flags - 0 for query. @@ -77,7 +77,7 @@ List encodeMDnsQuery( // Number of resource records - 0 for query. packetByteData.setUint16(_kArcountOffset, 0); int offset = _kHeaderSize; - for (int i = 0; i < rawNameParts.length; i++) { + for (var i = 0; i < rawNameParts.length; i++) { data[offset++] = rawNameParts[i].length; data.setRange(offset, offset + rawNameParts[i].length, rawNameParts[i]); offset += rawNameParts[i].length; @@ -119,7 +119,7 @@ String readFQDN(List packet, [int offset = 0]) { final Uint8List data = packet is Uint8List ? packet : Uint8List.fromList(packet); - final ByteData byteData = ByteData.view(data.buffer); + final byteData = ByteData.view(data.buffer); return _readFQDN(data, byteData, offset, data.length).fqdn; } @@ -140,11 +140,11 @@ _FQDNReadResult _readFQDN( } } - final List parts = []; - final int prevOffset = offset; - final List offsetsToVisit = [offset]; - int upperLimitOffset = offset; - int highestOffsetRead = offset; + final parts = []; + final prevOffset = offset; + final offsetsToVisit = [offset]; + var upperLimitOffset = offset; + var highestOffsetRead = offset; while (offsetsToVisit.isNotEmpty) { offset = offsetsToVisit.removeLast(); @@ -175,7 +175,7 @@ _FQDNReadResult _readFQDN( offset++; if (partLength > 0) { checkLength(offset + partLength); - final Uint8List partBytes = Uint8List.view( + final partBytes = Uint8List.view( data.buffer, offset, partLength, @@ -210,7 +210,7 @@ List? decodeMDnsResponse(List packet) { final Uint8List data = packet is Uint8List ? packet : Uint8List.fromList(packet); - final ByteData packetBytes = ByteData.view(data.buffer); + final packetBytes = ByteData.view(data.buffer); final int answerCount = packetBytes.getUint16(_kAncountOffset); final int authorityCount = packetBytes.getUint16(_kNscountOffset); @@ -261,7 +261,7 @@ List? decodeMDnsResponse(List packet) { switch (type) { case ResourceRecordType.addressIPv4: checkLength(offset + readDataLength); - final StringBuffer addr = StringBuffer(); + final addr = StringBuffer(); final int stop = offset + readDataLength; addr.write(packetBytes.getUint8(offset)); offset++; @@ -276,7 +276,7 @@ List? decodeMDnsResponse(List packet) { ); case ResourceRecordType.addressIPv6: checkLength(offset + readDataLength); - final StringBuffer addr = StringBuffer(); + final addr = StringBuffer(); final int stop = offset + readDataLength; addr.write(packetBytes.getUint16(offset).toRadixString(16)); offset += 2; @@ -329,8 +329,8 @@ List? decodeMDnsResponse(List packet) { // The first byte of the buffer is the length of the first string of // the TXT record. Further length-prefixed strings may follow. We // concatenate them with newlines. - final StringBuffer strings = StringBuffer(); - int index = 0; + final strings = StringBuffer(); + var index = 0; while (index < readDataLength) { final int txtLength = data[offset + index]; index++; @@ -356,10 +356,10 @@ List? decodeMDnsResponse(List packet) { // This list can't be fixed length right now because we might get // resource record types we don't support, and consumers expect this list // to not have null entries. - final List result = []; + final result = []; try { - for (int i = 0; i < questionCount; i++) { + for (var i = 0; i < questionCount; i++) { final _FQDNReadResult result = _readFQDN( data, packetBytes, @@ -370,7 +370,7 @@ List? decodeMDnsResponse(List packet) { checkLength(offset + 4); offset += 4; } - for (int i = 0; i < remainingCount; i++) { + for (var i = 0; i < remainingCount; i++) { final ResourceRecord? record = readResourceRecord(); if (record != null) { result.add(record); diff --git a/packages/multicast_dns/lib/src/resource_record.dart b/packages/multicast_dns/lib/src/resource_record.dart index bb2cc9c23d6..f16d9a163dc 100644 --- a/packages/multicast_dns/lib/src/resource_record.dart +++ b/packages/multicast_dns/lib/src/resource_record.dart @@ -310,8 +310,8 @@ class SrvResourceRecord extends ResourceRecord { @override Uint8List encodeResponseRecord() { final List data = utf8.encode(target); - final Uint8List result = Uint8List(data.length + 7); - final ByteData resultData = ByteData.view(result.buffer); + final result = Uint8List(data.length + 7); + final resultData = ByteData.view(result.buffer); resultData.setUint16(0, priority); resultData.setUint16(2, weight); resultData.setUint16(4, port); diff --git a/packages/multicast_dns/test/client_test.dart b/packages/multicast_dns/test/client_test.dart index 79483e5ef71..e5570d8628d 100644 --- a/packages/multicast_dns/test/client_test.dart +++ b/packages/multicast_dns/test/client_test.dart @@ -12,8 +12,8 @@ import 'package:test/test.dart'; void main() { test('Can inject datagram socket factory and configure mdns port', () async { late int lastPort; - final FakeRawDatagramSocket datagramSocket = FakeRawDatagramSocket(); - final MDnsClient client = MDnsClient( + final datagramSocket = FakeRawDatagramSocket(); + final client = MDnsClient( rawDatagramSocketFactory: ( dynamic host, @@ -37,8 +37,8 @@ void main() { }); test('Closes IPv4 sockets', () async { - final FakeRawDatagramSocket datagramSocket = FakeRawDatagramSocket(); - final MDnsClient client = MDnsClient( + final datagramSocket = FakeRawDatagramSocket(); + final client = MDnsClient( rawDatagramSocketFactory: ( dynamic host, @@ -62,9 +62,9 @@ void main() { }); test('Closes IPv6 sockets', () async { - final FakeRawDatagramSocket datagramSocket = FakeRawDatagramSocket(); + final datagramSocket = FakeRawDatagramSocket(); datagramSocket.address = InternetAddress.anyIPv6; - final MDnsClient client = MDnsClient( + final client = MDnsClient( rawDatagramSocketFactory: ( dynamic host, @@ -88,9 +88,9 @@ void main() { }); test('start() is idempotent', () async { - final FakeRawDatagramSocket datagramSocket = FakeRawDatagramSocket(); + final datagramSocket = FakeRawDatagramSocket(); datagramSocket.address = InternetAddress.anyIPv4; - final MDnsClient client = MDnsClient( + final client = MDnsClient( rawDatagramSocketFactory: ( dynamic host, @@ -112,7 +112,7 @@ void main() { }); group('Bind a single socket to ANY IPv4 and more than one when IPv6', () { - final List> testCases = >[ + final testCases = >[ { 'name': 'IPv4', 'datagramSocketType': InternetAddress.anyIPv4, @@ -125,15 +125,15 @@ void main() { }, ]; - for (final Map testCase in testCases) { + for (final testCase in testCases) { test('Bind a single socket to ANY ${testCase["name"]}', () async { - final FakeRawDatagramSocket datagramSocket = FakeRawDatagramSocket(); + final datagramSocket = FakeRawDatagramSocket(); datagramSocket.address = testCase['datagramSocketType']! as InternetAddress; - final List selectedInterfacesForSendingPackets = []; - final MDnsClient client = MDnsClient( + final selectedInterfacesForSendingPackets = []; + final client = MDnsClient( rawDatagramSocketFactory: ( dynamic host, @@ -147,14 +147,14 @@ void main() { }, ); - const int numberOfFakeInterfaces = 10; + const numberOfFakeInterfaces = 10; Future> fakeNetworkInterfacesFactory( InternetAddressType type, ) async { - final List fakeInterfaces = []; + final fakeInterfaces = []; // Generate "fake" interfaces - for (int i = 0; i < numberOfFakeInterfaces; i++) { + for (var i = 0; i < numberOfFakeInterfaces; i++) { fakeInterfaces.add( FakeNetworkInterface('inetfake$i', [ InternetAddress("${testCase['interfacePrefix']! as String}$i"), @@ -166,7 +166,7 @@ void main() { return Future.value(fakeInterfaces); } - final InternetAddress listenAddress = + final listenAddress = testCase['datagramSocketType']! as InternetAddress; await client.start( @@ -191,9 +191,9 @@ void main() { }); test('Calls onError callback in case of socket error', () async { - final FakeRawDatagramSocketThatSendsError datagramSocket = + final datagramSocket = FakeRawDatagramSocketThatSendsError(); - final MDnsClient client = MDnsClient( + final client = MDnsClient( rawDatagramSocketFactory: ( dynamic host, @@ -206,7 +206,7 @@ void main() { }, ); - final Completer onErrorCalledCompleter = Completer(); + final onErrorCalledCompleter = Completer(); await client.start( mDnsPort: 1234, interfacesFactory: (InternetAddressType type) async => diff --git a/packages/multicast_dns/test/decode_test.dart b/packages/multicast_dns/test/decode_test.dart index acadeed165d..b4712c881cc 100644 --- a/packages/multicast_dns/test/decode_test.dart +++ b/packages/multicast_dns/test/decode_test.dart @@ -24,7 +24,7 @@ void testValidPackages() { List result = decodeMDnsResponse(package1)!; expect(result, isNotNull); expect(result.length, 1); - IPAddressResourceRecord ipResult = result[0] as IPAddressResourceRecord; + var ipResult = result[0] as IPAddressResourceRecord; expect(ipResult.name, 'raspberrypi.local'); expect(ipResult.address.address, '192.168.1.191'); @@ -193,8 +193,8 @@ void testValidPackages() { void testBadPackages() { test('Returns null for invalid packets', () { - for (final List p in >[package1, package2, package3]) { - for (int i = 0; i < p.length; i++) { + for (final p in >[package1, package2, package3]) { + for (var i = 0; i < p.length; i++) { expect(decodeMDnsResponse(p.sublist(0, i)), isNull); } } @@ -226,7 +226,7 @@ void testNonUtf8DomainName() { final List result = decodeMDnsResponse(nonUtf8Package)!; expect(result, isNotNull); expect(result[0] is TxtResourceRecord, isTrue); - final TxtResourceRecord txt = result[0] as TxtResourceRecord; + final txt = result[0] as TxtResourceRecord; expect(txt.name, contains('�')); }); } diff --git a/packages/multicast_dns/test/lookup_resolver_test.dart b/packages/multicast_dns/test/lookup_resolver_test.dart index dde83f9f8d8..c067ad255f4 100644 --- a/packages/multicast_dns/test/lookup_resolver_test.dart +++ b/packages/multicast_dns/test/lookup_resolver_test.dart @@ -22,8 +22,8 @@ ResourceRecord ip4Result(String name, InternetAddress address) { void testTimeout() { test('Resolver does not return with short timeout', () async { - const Duration shortTimeout = Duration(milliseconds: 1); - final LookupResolver resolver = LookupResolver(); + const shortTimeout = Duration(milliseconds: 1); + final resolver = LookupResolver(); final Stream result = resolver.addPendingRequest( ResourceRecordType.addressIPv4, 'xxx', @@ -36,8 +36,8 @@ void testTimeout() { // One pending request and one response. void testResult() { test('One pending request and one response', () async { - const Duration noTimeout = Duration(days: 1); - final LookupResolver resolver = LookupResolver(); + const noTimeout = Duration(days: 1); + final resolver = LookupResolver(); final Stream futureResult = resolver.addPendingRequest( ResourceRecordType.addressIPv4, 'xxx.local', @@ -48,7 +48,7 @@ void testResult() { InternetAddress('1.2.3.4'), ); resolver.handleResponse([response]); - final IPAddressResourceRecord result = + final result = await futureResult.first as IPAddressResourceRecord; expect('1.2.3.4', result.address.address); resolver.clearPendingRequests(); @@ -57,8 +57,8 @@ void testResult() { void testResult2() { test('Two requests', () async { - const Duration noTimeout = Duration(days: 1); - final LookupResolver resolver = LookupResolver(); + const noTimeout = Duration(days: 1); + final resolver = LookupResolver(); final Stream futureResult1 = resolver.addPendingRequest( ResourceRecordType.addressIPv4, 'xxx.local', @@ -78,9 +78,9 @@ void testResult2() { InternetAddress('2.3.4.5'), ); resolver.handleResponse([response2, response1]); - final IPAddressResourceRecord result1 = + final result1 = await futureResult1.first as IPAddressResourceRecord; - final IPAddressResourceRecord result2 = + final result2 = await futureResult2.first as IPAddressResourceRecord; expect('1.2.3.4', result1.address.address); expect('2.3.4.5', result2.address.address); @@ -90,8 +90,8 @@ void testResult2() { void testResult3() { test('Multiple requests', () async { - const Duration noTimeout = Duration(days: 1); - final LookupResolver resolver = LookupResolver(); + const noTimeout = Duration(days: 1); + final resolver = LookupResolver(); final ResourceRecord response0 = ip4Result( 'zzz.local', InternetAddress('2.3.4.5'), @@ -121,9 +121,9 @@ void testResult3() { resolver.handleResponse([response0]); resolver.handleResponse([response2, response1]); resolver.handleResponse([response0]); - final IPAddressResourceRecord result1 = + final result1 = await futureResult1.first as IPAddressResourceRecord; - final IPAddressResourceRecord result2 = + final result2 = await futureResult2.first as IPAddressResourceRecord; expect('1.2.3.4', result1.address.address); expect('2.3.4.5', result2.address.address); diff --git a/packages/multicast_dns/test/resource_record_cache_test.dart b/packages/multicast_dns/test/resource_record_cache_test.dart index 703211eea49..9ecb88d1eab 100644 --- a/packages/multicast_dns/test/resource_record_cache_test.dart +++ b/packages/multicast_dns/test/resource_record_cache_test.dart @@ -20,11 +20,11 @@ void main() { void testOverwrite() { test('Cache can overwrite entries', () { - final InternetAddress ip1 = InternetAddress('192.168.1.1'); - final InternetAddress ip2 = InternetAddress('192.168.1.2'); + final ip1 = InternetAddress('192.168.1.1'); + final ip2 = InternetAddress('192.168.1.2'); final int valid = DateTime.now().millisecondsSinceEpoch + 86400 * 1000; - final ResourceRecordCache cache = ResourceRecordCache(); + final cache = ResourceRecordCache(); // Add two different records. cache.updateRecords([ @@ -58,11 +58,11 @@ void testOverwrite() { void testTimeout() { test('Cache can evict records after timeout', () { - final InternetAddress ip1 = InternetAddress('192.168.1.1'); + final ip1 = InternetAddress('192.168.1.1'); final int valid = DateTime.now().millisecondsSinceEpoch + 86400 * 1000; final int notValid = DateTime.now().millisecondsSinceEpoch - 1; - final ResourceRecordCache cache = ResourceRecordCache(); + final cache = ResourceRecordCache(); cache.updateRecords([ IPAddressResourceRecord('hest', valid, address: ip1), @@ -73,7 +73,7 @@ void testTimeout() { IPAddressResourceRecord('fisk', notValid, address: ip1), ]); - List results = []; + var results = []; cache.lookup('hest', ResourceRecordType.addressIPv4, results); expect(results.isEmpty, isFalse); diff --git a/packages/multicast_dns/tool/packet_gen.dart b/packages/multicast_dns/tool/packet_gen.dart index de4e5b635bd..d3df26c9fad 100644 --- a/packages/multicast_dns/tool/packet_gen.dart +++ b/packages/multicast_dns/tool/packet_gen.dart @@ -9,8 +9,8 @@ import 'dart:io'; void formatHexStream(String hexStream) { - String s = ''; - for (int i = 0; i < hexStream.length / 2; i++) { + var s = ''; + for (var i = 0; i < hexStream.length / 2; i++) { if (s.isNotEmpty) { s += ', '; } @@ -30,8 +30,8 @@ void formatHexStream(String hexStream) { // Support code for generating the hex-lists in test/decode_test.dart. void hexDumpList(List package) { - String s = ''; - for (int i = 0; i < package.length; i++) { + var s = ''; + for (var i = 0; i < package.length; i++) { if (s.isNotEmpty) { s += ', '; } @@ -54,8 +54,8 @@ void hexDumpList(List package) { void dumpDatagram(Datagram datagram) { String toHex(List ints) { - final StringBuffer buffer = StringBuffer(); - for (int i = 0; i < ints.length; i++) { + final buffer = StringBuffer(); + for (var i = 0; i < ints.length; i++) { buffer.write(ints[i].toRadixString(16).padLeft(2, '0')); if ((i + 1) % 10 == 0) { buffer.writeln(); diff --git a/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart index 41606be831d..69647b68dce 100644 --- a/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart +++ b/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart @@ -71,7 +71,7 @@ void main() { } }); - final List allDirs = [ + final allDirs = [ null, StorageDirectory.music, StorageDirectory.podcasts, @@ -82,7 +82,7 @@ void main() { StorageDirectory.movies, ]; - for (final StorageDirectory? type in allDirs) { + for (final type in allDirs) { testWidgets('getExternalStorageDirectories (type: $type)', ( WidgetTester tester, ) async { @@ -117,7 +117,7 @@ void _verifySampleFile(Directory? directory, String name) { if (directory == null) { return; } - final File file = File('${directory.path}/$name'); + final file = File('${directory.path}/$name'); if (file.existsSync()) { file.deleteSync(); diff --git a/packages/path_provider/path_provider/example/lib/main.dart b/packages/path_provider/path_provider/example/lib/main.dart index e60a40e944c..a3aeb6cc657 100644 --- a/packages/path_provider/path_provider/example/lib/main.dart +++ b/packages/path_provider/path_provider/example/lib/main.dart @@ -55,7 +55,7 @@ class _MyHomePageState extends State { BuildContext context, AsyncSnapshot snapshot, ) { - Text text = const Text(''); + var text = const Text(''); if (snapshot.connectionState == ConnectionState.done) { if (snapshot.hasError) { text = Text('Error: ${snapshot.error}'); @@ -72,7 +72,7 @@ class _MyHomePageState extends State { BuildContext context, AsyncSnapshot?> snapshot, ) { - Text text = const Text(''); + var text = const Text(''); if (snapshot.connectionState == ConnectionState.done) { if (snapshot.hasError) { text = Text('Error: ${snapshot.error}'); diff --git a/packages/path_provider/path_provider/lib/path_provider.dart b/packages/path_provider/path_provider/lib/path_provider.dart index 9ccad357ae5..d855c260889 100644 --- a/packages/path_provider/path_provider/lib/path_provider.dart +++ b/packages/path_provider/path_provider/lib/path_provider.dart @@ -30,7 +30,7 @@ class MissingPlatformDirectoryException implements Exception { @override String toString() { - final String detailsAddition = details == null ? '' : ': $details'; + final detailsAddition = details == null ? '' : ': $details'; return 'MissingPlatformDirectoryException($message)$detailsAddition'; } } diff --git a/packages/path_provider/path_provider_android/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider_android/example/integration_test/path_provider_test.dart index af788344fac..ab6b1b76eaf 100644 --- a/packages/path_provider/path_provider_android/example/integration_test/path_provider_test.dart +++ b/packages/path_provider/path_provider_android/example/integration_test/path_provider_test.dart @@ -57,7 +57,7 @@ void main() { } }); - final List allDirs = [ + final allDirs = [ null, StorageDirectory.music, StorageDirectory.podcasts, @@ -68,7 +68,7 @@ void main() { StorageDirectory.movies, ]; - for (final StorageDirectory? type in allDirs) { + for (final type in allDirs) { testWidgets('getExternalStorageDirectories (type: $type)', ( WidgetTester tester, ) async { @@ -93,8 +93,8 @@ void _verifySampleFile(String? directoryPath, String name) { if (directoryPath == null) { return; } - final Directory directory = Directory(directoryPath); - final File file = File('${directory.path}${Platform.pathSeparator}$name'); + final directory = Directory(directoryPath); + final file = File('${directory.path}${Platform.pathSeparator}$name'); if (file.existsSync()) { file.deleteSync(); diff --git a/packages/path_provider/path_provider_android/example/lib/main.dart b/packages/path_provider/path_provider_android/example/lib/main.dart index 546d3f125f2..1bec8806abb 100644 --- a/packages/path_provider/path_provider_android/example/lib/main.dart +++ b/packages/path_provider/path_provider_android/example/lib/main.dart @@ -53,7 +53,7 @@ class _MyHomePageState extends State { BuildContext context, AsyncSnapshot snapshot, ) { - Text text = const Text(''); + var text = const Text(''); if (snapshot.connectionState == ConnectionState.done) { if (snapshot.hasError) { text = Text('Error: ${snapshot.error}'); @@ -70,7 +70,7 @@ class _MyHomePageState extends State { BuildContext context, AsyncSnapshot?> snapshot, ) { - Text text = const Text(''); + var text = const Text(''); if (snapshot.connectionState == ConnectionState.done) { if (snapshot.hasError) { text = Text('Error: ${snapshot.error}'); diff --git a/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart index 2bd88a2c98f..0f9f0508603 100644 --- a/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart +++ b/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart @@ -76,7 +76,7 @@ void main() { testWidgets('getContainerDirectory', (WidgetTester tester) async { if (Platform.isIOS) { - final PathProviderFoundation provider = PathProviderFoundation(); + final provider = PathProviderFoundation(); final String? result = await provider.getContainerPath( appGroupIdentifier: 'group.flutter.appGroupTest', ); @@ -90,7 +90,7 @@ void main() { // NSString, etc.) that aren't available in an actual unit test. For these // tests, the platform is stubbed out. group('unit', () { - final ValueVariant platformVariants = + final platformVariants = ValueVariant({ FakePlatformProvider(isIOS: true), FakePlatformProvider(isMacOS: true), @@ -110,8 +110,8 @@ void main() { }); testWidgets('getTemporaryPath iOS', (_) async { - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, platform: FakePlatformProvider(isIOS: true), ); @@ -131,8 +131,8 @@ void main() { }); testWidgets('getTemporaryPath macOS', (_) async { - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, platform: FakePlatformProvider(isMacOS: true), ); @@ -153,8 +153,8 @@ void main() { }); testWidgets('getApplicationSupportPath iOS', (_) async { - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, platform: FakePlatformProvider(isIOS: true), ); @@ -179,8 +179,8 @@ void main() { }); testWidgets('getApplicationSupportPath macOS', (_) async { - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, platform: FakePlatformProvider(isMacOS: true), ); @@ -211,8 +211,8 @@ void main() { testWidgets( 'getApplicationSupportPath creates the directory if necessary', (_) async { - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, platform: platformVariants.currentValue, ); @@ -239,8 +239,8 @@ void main() { ); testWidgets('getLibraryPath', (_) async { - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, platform: platformVariants.currentValue, ); @@ -260,8 +260,8 @@ void main() { }, variant: platformVariants); testWidgets('getApplicationDocumentsPath', (_) async { - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, platform: platformVariants.currentValue, ); @@ -286,8 +286,8 @@ void main() { }, variant: platformVariants); testWidgets('getApplicationCachePath iOS', (_) async { - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, platform: FakePlatformProvider(isIOS: true), ); @@ -312,8 +312,8 @@ void main() { }); testWidgets('getApplicationCachePath macOS', (_) async { - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, platform: FakePlatformProvider(isMacOS: true), ); @@ -344,8 +344,8 @@ void main() { testWidgets( 'getApplicationCachePath creates the directory if necessary', (_) async { - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, platform: platformVariants.currentValue, ); @@ -372,8 +372,8 @@ void main() { ); testWidgets('getDownloadsPath', (_) async { - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, platform: platformVariants.currentValue, ); @@ -396,14 +396,14 @@ void main() { final String containerPath = p.join(testRoot.path, 'container', 'path'); final NSURL containerUrl = NSURL.fileURLWithPath(NSString(containerPath)); - final MockFoundationFFI mockFfiLib = MockFoundationFFI(); - final PathProviderFoundation pathProvider = PathProviderFoundation( + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( ffiLib: mockFfiLib, containerURLForSecurityApplicationGroupIdentifier: (_) => containerUrl, platform: FakePlatformProvider(isIOS: true), ); - const String appGroupIdentifier = 'group.example.test'; + const appGroupIdentifier = 'group.example.test'; final String? result = await pathProvider.getContainerPath( appGroupIdentifier: appGroupIdentifier, ); @@ -426,8 +426,8 @@ void _verifySampleFile(String? directoryPath, String name) { if (directoryPath == null) { return; } - final Directory directory = Directory(directoryPath); - final File file = File('${directory.path}${Platform.pathSeparator}$name'); + final directory = Directory(directoryPath); + final file = File('${directory.path}${Platform.pathSeparator}$name'); if (file.existsSync()) { file.deleteSync(); diff --git a/packages/path_provider/path_provider_foundation/example/lib/main.dart b/packages/path_provider/path_provider_foundation/example/lib/main.dart index 884f68ec7f9..ca2af824df4 100644 --- a/packages/path_provider/path_provider_foundation/example/lib/main.dart +++ b/packages/path_provider/path_provider_foundation/example/lib/main.dart @@ -45,7 +45,7 @@ class _MyAppState extends State { String? containerDirectory; String? cacheDirectory; final PathProviderPlatform provider = PathProviderPlatform.instance; - final PathProviderFoundation providerFoundation = PathProviderFoundation(); + final providerFoundation = PathProviderFoundation(); try { tempDirectory = await provider.getTemporaryPath(); diff --git a/packages/path_provider/path_provider_foundation/test/path_provider_foundation_test.dart b/packages/path_provider/path_provider_foundation/test/path_provider_foundation_test.dart index 459444bb53a..0e4bd4592cf 100644 --- a/packages/path_provider/path_provider_foundation/test/path_provider_foundation_test.dart +++ b/packages/path_provider/path_provider_foundation/test/path_provider_foundation_test.dart @@ -30,14 +30,14 @@ void main() { }); test('getExternalCachePaths throws', () async { - final PathProviderFoundation pathProvider = PathProviderFoundation( + final pathProvider = PathProviderFoundation( ffiLib: FakeFoundationFFI(), ); expect(pathProvider.getExternalCachePaths(), throwsA(isUnsupportedError)); }); test('getExternalStoragePath throws', () async { - final PathProviderFoundation pathProvider = PathProviderFoundation( + final pathProvider = PathProviderFoundation( ffiLib: FakeFoundationFFI(), ); expect( @@ -47,7 +47,7 @@ void main() { }); test('getExternalStoragePaths throws', () async { - final PathProviderFoundation pathProvider = PathProviderFoundation( + final pathProvider = PathProviderFoundation( ffiLib: FakeFoundationFFI(), ); expect( @@ -57,7 +57,7 @@ void main() { }); test('getContainerPath throws on macOS', () async { - final PathProviderFoundation pathProvider = PathProviderFoundation( + final pathProvider = PathProviderFoundation( platform: FakePlatformProvider(isMacOS: true), ffiLib: FakeFoundationFFI(), ); diff --git a/packages/path_provider/path_provider_foundation/tool/ffigen.dart b/packages/path_provider/path_provider_foundation/tool/ffigen.dart index 214cba31e6f..e07f848581e 100644 --- a/packages/path_provider/path_provider_foundation/tool/ffigen.dart +++ b/packages/path_provider/path_provider_foundation/tool/ffigen.dart @@ -33,7 +33,7 @@ void main() { }, includeMember: (Declaration declaration, String member) { final String interfaceName = declaration.originalName; - final String signature = member; + final signature = member; return switch (interfaceName) { 'NSFileManager' => { 'containerURLForSecurityApplicationGroupIdentifier:', diff --git a/packages/path_provider/path_provider_linux/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider_linux/example/integration_test/path_provider_test.dart index 8ab4e8374bb..2c916682b46 100644 --- a/packages/path_provider/path_provider_linux/example/integration_test/path_provider_test.dart +++ b/packages/path_provider/path_provider_linux/example/integration_test/path_provider_test.dart @@ -11,7 +11,7 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); testWidgets('getTemporaryDirectory', (WidgetTester tester) async { - final PathProviderLinux provider = PathProviderLinux(); + final provider = PathProviderLinux(); final String? result = await provider.getTemporaryPath(); _verifySampleFile(result, 'temporaryDirectory'); }); @@ -20,25 +20,25 @@ void main() { if (!Platform.isLinux) { return; } - final PathProviderLinux provider = PathProviderLinux(); + final provider = PathProviderLinux(); final String? result = await provider.getDownloadsPath(); _verifySampleFile(result, 'downloadDirectory'); }); testWidgets('getApplicationDocumentsDirectory', (WidgetTester tester) async { - final PathProviderLinux provider = PathProviderLinux(); + final provider = PathProviderLinux(); final String? result = await provider.getApplicationDocumentsPath(); _verifySampleFile(result, 'applicationDocuments'); }); testWidgets('getApplicationSupportDirectory', (WidgetTester tester) async { - final PathProviderLinux provider = PathProviderLinux(); + final provider = PathProviderLinux(); final String? result = await provider.getApplicationSupportPath(); _verifySampleFile(result, 'applicationSupport'); }); testWidgets('getApplicationCacheDirectory', (WidgetTester tester) async { - final PathProviderLinux provider = PathProviderLinux(); + final provider = PathProviderLinux(); final String? result = await provider.getApplicationCachePath(); _verifySampleFile(result, 'applicationCache'); }); @@ -51,8 +51,8 @@ void _verifySampleFile(String? directoryPath, String name) { if (directoryPath == null) { return; } - final Directory directory = Directory(directoryPath); - final File file = File('${directory.path}${Platform.pathSeparator}$name'); + final directory = Directory(directoryPath); + final file = File('${directory.path}${Platform.pathSeparator}$name'); if (file.existsSync()) { file.deleteSync(); diff --git a/packages/path_provider/path_provider_linux/lib/src/path_provider_linux.dart b/packages/path_provider/path_provider_linux/lib/src/path_provider_linux.dart index 64874471249..db98c908a8c 100644 --- a/packages/path_provider/path_provider_linux/lib/src/path_provider_linux.dart +++ b/packages/path_provider/path_provider_linux/lib/src/path_provider_linux.dart @@ -47,7 +47,7 @@ class PathProviderLinux extends PathProviderPlatform { @override Future getApplicationSupportPath() async { - final Directory directory = Directory( + final directory = Directory( path.join(xdg.dataHome.path, await _getId()), ); if (directory.existsSync()) { @@ -56,7 +56,7 @@ class PathProviderLinux extends PathProviderPlatform { // This plugin originally used the executable name as a directory. // Use that if it exists for backwards compatibility. - final Directory legacyDirectory = Directory( + final legacyDirectory = Directory( path.join(xdg.dataHome.path, await _getExecutableName()), ); if (legacyDirectory.existsSync()) { @@ -75,7 +75,7 @@ class PathProviderLinux extends PathProviderPlatform { @override Future getApplicationCachePath() async { - final Directory directory = Directory( + final directory = Directory( path.join(xdg.cacheHome.path, await _getId()), ); if (!directory.existsSync()) { diff --git a/packages/path_provider/path_provider_linux/test/get_application_id_test.dart b/packages/path_provider/path_provider_linux/test/get_application_id_test.dart index 1730d897d78..4e6afb33441 100644 --- a/packages/path_provider/path_provider_linux/test/get_application_id_test.dart +++ b/packages/path_provider/path_provider_linux/test/get_application_id_test.dart @@ -53,7 +53,7 @@ void main() { test('returns value if g_application_get_application_id returns a value', () { fakeGio.libraryIsPresent = true; fakeGio.application = 1; - const String id = 'foo'; + const id = 'foo'; final Pointer idPtr = id.toNativeUtf8(); fakeGio.applicationId = idPtr; expect(getApplicationId(), id); diff --git a/packages/path_provider/path_provider_platform_interface/test/method_channel_path_provider_test.dart b/packages/path_provider/path_provider_platform_interface/test/method_channel_path_provider_test.dart index b404c977fec..b6e1fe61600 100644 --- a/packages/path_provider/path_provider_platform_interface/test/method_channel_path_provider_test.dart +++ b/packages/path_provider/path_provider_platform_interface/test/method_channel_path_provider_test.dart @@ -10,18 +10,18 @@ import 'package:platform/platform.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - const String kTemporaryPath = 'temporaryPath'; - const String kApplicationSupportPath = 'applicationSupportPath'; - const String kLibraryPath = 'libraryPath'; - const String kApplicationDocumentsPath = 'applicationDocumentsPath'; - const String kApplicationCachePath = 'applicationCachePath'; - const String kExternalCachePaths = 'externalCachePaths'; - const String kExternalStoragePaths = 'externalStoragePaths'; - const String kDownloadsPath = 'downloadsPath'; + const kTemporaryPath = 'temporaryPath'; + const kApplicationSupportPath = 'applicationSupportPath'; + const kLibraryPath = 'libraryPath'; + const kApplicationDocumentsPath = 'applicationDocumentsPath'; + const kApplicationCachePath = 'applicationCachePath'; + const kExternalCachePaths = 'externalCachePaths'; + const kExternalStoragePaths = 'externalStoragePaths'; + const kDownloadsPath = 'downloadsPath'; group('$MethodChannelPathProvider', () { late MethodChannelPathProvider methodChannelPathProvider; - final List log = []; + final log = []; setUp(() async { methodChannelPathProvider = MethodChannelPathProvider(); @@ -155,7 +155,7 @@ void main() { } }); - for (final StorageDirectory? type in [ + for (final type in [ null, ...StorageDirectory.values, ]) { diff --git a/packages/path_provider/path_provider_platform_interface/test/path_provider_platform_interface_test.dart b/packages/path_provider/path_provider_platform_interface/test/path_provider_platform_interface_test.dart index 18eeadf34ba..c01d115c352 100644 --- a/packages/path_provider/path_provider_platform_interface/test/path_provider_platform_interface_test.dart +++ b/packages/path_provider/path_provider_platform_interface/test/path_provider_platform_interface_test.dart @@ -15,7 +15,7 @@ void main() { }); test('getApplicationCachePath throws unimplemented error', () { - final ExtendsPathProviderPlatform pathProviderPlatform = + final pathProviderPlatform = ExtendsPathProviderPlatform(); expect( diff --git a/packages/path_provider/path_provider_windows/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider_windows/example/integration_test/path_provider_test.dart index 913e79cb742..214fc901499 100644 --- a/packages/path_provider/path_provider_windows/example/integration_test/path_provider_test.dart +++ b/packages/path_provider/path_provider_windows/example/integration_test/path_provider_test.dart @@ -11,31 +11,31 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); testWidgets('getTemporaryDirectory', (WidgetTester tester) async { - final PathProviderWindows provider = PathProviderWindows(); + final provider = PathProviderWindows(); final String? result = await provider.getTemporaryPath(); _verifySampleFile(result, 'temporaryDirectory'); }); testWidgets('getApplicationDocumentsDirectory', (WidgetTester tester) async { - final PathProviderWindows provider = PathProviderWindows(); + final provider = PathProviderWindows(); final String? result = await provider.getApplicationDocumentsPath(); _verifySampleFile(result, 'applicationDocuments'); }); testWidgets('getApplicationSupportDirectory', (WidgetTester tester) async { - final PathProviderWindows provider = PathProviderWindows(); + final provider = PathProviderWindows(); final String? result = await provider.getApplicationSupportPath(); _verifySampleFile(result, 'applicationSupport'); }); testWidgets('getApplicationCacheDirectory', (WidgetTester tester) async { - final PathProviderWindows provider = PathProviderWindows(); + final provider = PathProviderWindows(); final String? result = await provider.getApplicationCachePath(); _verifySampleFile(result, 'applicationCache'); }); testWidgets('getDownloadsDirectory', (WidgetTester tester) async { - final PathProviderWindows provider = PathProviderWindows(); + final provider = PathProviderWindows(); final String? result = await provider.getDownloadsPath(); _verifySampleFile(result, 'downloads'); }); @@ -48,8 +48,8 @@ void _verifySampleFile(String? directoryPath, String name) { if (directoryPath == null) { return; } - final Directory directory = Directory(directoryPath); - final File file = File('${directory.path}${Platform.pathSeparator}$name'); + final directory = Directory(directoryPath); + final file = File('${directory.path}${Platform.pathSeparator}$name'); if (file.existsSync()) { file.deleteSync(); diff --git a/packages/path_provider/path_provider_windows/example/lib/main.dart b/packages/path_provider/path_provider_windows/example/lib/main.dart index 4dc03bf414e..465492c1ece 100644 --- a/packages/path_provider/path_provider_windows/example/lib/main.dart +++ b/packages/path_provider/path_provider_windows/example/lib/main.dart @@ -39,7 +39,7 @@ class _MyAppState extends State { String? appSupportDirectory; String? documentsDirectory; String? cacheDirectory; - final PathProviderWindows provider = PathProviderWindows(); + final provider = PathProviderWindows(); try { tempDirectory = await provider.getTemporaryPath(); diff --git a/packages/path_provider/path_provider_windows/lib/src/guid.dart b/packages/path_provider/path_provider_windows/lib/src/guid.dart index 07bf17714eb..c240b809806 100644 --- a/packages/path_provider/path_provider_windows/lib/src/guid.dart +++ b/packages/path_provider/path_provider_windows/lib/src/guid.dart @@ -34,8 +34,8 @@ base class GUID extends Struct { if (hexOnly.length != 32) { throw ArgumentError.value(guid, 'guid', 'Invalid GUID string'); } - final ByteData bytes = ByteData(16); - for (int i = 0; i < 16; ++i) { + final bytes = ByteData(16); + for (var i = 0; i < 16; ++i) { bytes.setUint8( i, int.parse(hexOnly.substring(i * 2, i * 2 + 2), radix: 16), diff --git a/packages/path_provider/path_provider_windows/lib/src/path_provider_windows_real.dart b/packages/path_provider/path_provider_windows/lib/src/path_provider_windows_real.dart index 98df30bdf31..e82bafc6332 100644 --- a/packages/path_provider/path_provider_windows/lib/src/path_provider_windows_real.dart +++ b/packages/path_provider/path_provider_windows/lib/src/path_provider_windows_real.dart @@ -104,7 +104,7 @@ class PathProviderWindows extends PathProviderPlatform { } // Ensure that the directory exists, since GetTempPath doesn't. - final Directory directory = Directory(path); + final directory = Directory(path); if (!directory.existsSync()) { await directory.create(recursive: true); } @@ -255,7 +255,7 @@ class PathProviderWindows extends PathProviderPlatform { .trimRight() // Ensure that it does not end with a '.'. .replaceAll(RegExp(r'[.]+$'), ''); - const int kMaxComponentLength = 255; + const kMaxComponentLength = 255; if (sanitized.length > kMaxComponentLength) { sanitized = sanitized.substring(0, kMaxComponentLength); } @@ -267,7 +267,7 @@ class PathProviderWindows extends PathProviderPlatform { if (baseDir == null) { return null; } - final Directory directory = Directory( + final directory = Directory( path.join(baseDir, _getApplicationSpecificSubdirectory()), ); // Ensure that the directory exists if possible, since it will on other diff --git a/packages/path_provider/path_provider_windows/test/guid_test.dart b/packages/path_provider/path_provider_windows/test/guid_test.dart index 9c7cbd41f6e..dbb64d407ca 100644 --- a/packages/path_provider/path_provider_windows/test/guid_test.dart +++ b/packages/path_provider/path_provider_windows/test/guid_test.dart @@ -13,7 +13,7 @@ void main() { test('has correct byte representation', () async { final Pointer guid = calloc() ..ref.parse('{00112233-4455-6677-8899-aabbccddeeff}'); - final ByteData data = ByteData(16) + final data = ByteData(16) ..setInt32(0, guid.ref.data1, Endian.little) ..setInt16(4, guid.ref.data2, Endian.little) ..setInt16(6, guid.ref.data3, Endian.little) diff --git a/packages/path_provider/path_provider_windows/test/path_provider_windows_test.dart b/packages/path_provider/path_provider_windows/test/path_provider_windows_test.dart index ed79b00d661..5ef6c87299a 100644 --- a/packages/path_provider/path_provider_windows/test/path_provider_windows_test.dart +++ b/packages/path_provider/path_provider_windows/test/path_provider_windows_test.dart @@ -45,12 +45,12 @@ void main() { }); test('getTemporaryPath', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); expect(await pathProvider.getTemporaryPath(), contains(r'C:\')); }, skip: !Platform.isWindows); test('getApplicationSupportPath with no version info', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); pathProvider.versionInfoQuerier = FakeVersionInfoQuerier( {}, ); @@ -64,7 +64,7 @@ void main() { test( 'getApplicationSupportPath with full version info in CP1252', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ 'CompanyName': 'A Company', 'ProductName': 'Amazing App', @@ -82,7 +82,7 @@ void main() { test( 'getApplicationSupportPath with full version info in Unicode', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ 'CompanyName': 'A Company', 'ProductName': 'Amazing App', @@ -100,7 +100,7 @@ void main() { test( 'getApplicationSupportPath with full version info in Unsupported Encoding', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); pathProvider.versionInfoQuerier = FakeVersionInfoQuerier( { 'CompanyName': 'A Company', @@ -119,7 +119,7 @@ void main() { ); test('getApplicationSupportPath with missing company', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ 'ProductName': 'Amazing App', }); @@ -132,7 +132,7 @@ void main() { }, skip: !Platform.isWindows); test('getApplicationSupportPath with problematic values', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ 'CompanyName': r'A Company: Name.', 'ProductName': r'A"/Terrible\|App?*Name', @@ -153,7 +153,7 @@ void main() { test( 'getApplicationSupportPath with a completely invalid company', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ 'CompanyName': r'..', 'ProductName': r'Amazing App', @@ -169,7 +169,7 @@ void main() { ); test('getApplicationSupportPath with very long app name', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); final String truncatedName = 'A' * 255; pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ 'CompanyName': 'A Company', @@ -182,14 +182,14 @@ void main() { }, skip: !Platform.isWindows); test('getApplicationDocumentsPath', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); final String? path = await pathProvider.getApplicationDocumentsPath(); expect(path, contains(r'C:\')); expect(path, contains(r'Documents')); }, skip: !Platform.isWindows); test('getApplicationCachePath', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ 'CompanyName': 'A Company', 'ProductName': 'Amazing App', @@ -203,7 +203,7 @@ void main() { }, skip: !Platform.isWindows); test('getDownloadsPath', () async { - final PathProviderWindows pathProvider = PathProviderWindows(); + final pathProvider = PathProviderWindows(); final String? path = await pathProvider.getDownloadsPath(); expect(path, contains(r'C:\')); expect(path, contains(r'Downloads')); diff --git a/packages/pigeon/example/app/lib/main.dart b/packages/pigeon/example/app/lib/main.dart index fe1dfe9bf9d..eeb193aa1f6 100644 --- a/packages/pigeon/example/app/lib/main.dart +++ b/packages/pigeon/example/app/lib/main.dart @@ -74,7 +74,7 @@ class _MyHomePageState extends State { /// Sends message through host api using `MessageData` class /// and api `sendMessage` method. Future sendMessage(String messageText) { - final MessageData message = MessageData( + final message = MessageData( code: Code.one, data: {'header': 'this is a header'}, description: 'uri text', diff --git a/packages/pigeon/lib/src/ast.dart b/packages/pigeon/lib/src/ast.dart index 669d3bdca61..078c4acedeb 100644 --- a/packages/pigeon/lib/src/ast.dart +++ b/packages/pigeon/lib/src/ast.dart @@ -91,10 +91,10 @@ class Method extends Node { @override String toString() { - final String objcSelectorStr = objcSelector.isEmpty + final objcSelectorStr = objcSelector.isEmpty ? '' : ' objcSelector:$objcSelector'; - final String swiftFunctionStr = swiftFunction.isEmpty + final swiftFunctionStr = swiftFunction.isEmpty ? '' : ' swiftFunction:$swiftFunction'; return '(Method name:$name returnType:$returnType parameters:$parameters isAsynchronous:$isAsynchronous$objcSelectorStr$swiftFunctionStr documentationComments:$documentationComments)'; @@ -202,7 +202,7 @@ class AstProxyApi extends Api { /// This method also assumes that the type of [superClass] is annotated with /// `@ProxyApi`. Otherwise, throws an [ArgumentError]. Iterable allSuperClasses() { - final List superClassChain = []; + final superClassChain = []; if (superClass != null && !superClass!.isProxyApi) { throw ArgumentError( @@ -259,7 +259,7 @@ class AstProxyApi extends Api { final Set interfaceApisFromSuperClasses = superClass! .associatedProxyApi! ._recursiveFindAllInterfaceApis(); - for (final AstProxyApi proxyApi in interfaceApisFromSuperClasses) { + for (final proxyApi in interfaceApisFromSuperClasses) { yield* proxyApi.methods.map((Method method) => (method, proxyApi)); } } @@ -320,7 +320,7 @@ class AstProxyApi extends Api { Set _recursiveFindAllInterfaceApis([ Set seenApis = const {}, ]) { - final Set allInterfaces = {}; + final allInterfaces = {}; allInterfaces.addAll( interfaces.map((TypeDeclaration type) { @@ -339,9 +339,9 @@ class AstProxyApi extends Api { // Adds the current api since it would be invalid for it to be an interface // of itself. - final Set newSeenApis = {...seenApis, this}; + final newSeenApis = {...seenApis, this}; - for (final AstProxyApi interfaceApi in {...allInterfaces}) { + for (final interfaceApi in {...allInterfaces}) { allInterfaces.addAll( interfaceApi._recursiveFindAllInterfaceApis(newSeenApis), ); @@ -397,7 +397,7 @@ class Constructor extends Method { @override String toString() { - final String swiftFunctionStr = swiftFunction.isEmpty + final swiftFunctionStr = swiftFunction.isEmpty ? '' : ' swiftFunction:$swiftFunction'; return '(Constructor name:$name parameters:$parameters $swiftFunctionStr documentationComments:$documentationComments)'; @@ -530,7 +530,7 @@ class TypeDeclaration { int get hashCode { // This has to be implemented because TypeDeclaration is used as a Key to a // Map in generator_tools.dart. - int hash = 17; + var hash = 17; hash = hash * 37 + baseName.hashCode; hash = hash * 37 + isNullable.hashCode; for (final TypeDeclaration typeArgument in typeArguments) { @@ -599,7 +599,7 @@ class TypeDeclaration { @override String toString() { - final String typeArgumentsStr = typeArguments.isEmpty + final typeArgumentsStr = typeArguments.isEmpty ? '' : ' typeArguments:$typeArguments'; return '(TypeDeclaration baseName:$baseName isNullable:$isNullable$typeArgumentsStr isEnum:$isEnum isClass:$isClass isProxyApi:$isProxyApi)'; diff --git a/packages/pigeon/lib/src/ast_generator.dart b/packages/pigeon/lib/src/ast_generator.dart index 187d7521990..9081a094a08 100644 --- a/packages/pigeon/lib/src/ast_generator.dart +++ b/packages/pigeon/lib/src/ast_generator.dart @@ -7,11 +7,11 @@ import 'generator_tools.dart'; /// Writes the AST representation of [root] to [sink]. void generateAst(Root root, StringSink sink) { - final Indent indent = Indent(sink); - final String output = root.toString(); - bool isFirst = true; + final indent = Indent(sink); + final output = root.toString(); + var isFirst = true; for (final int ch in output.runes) { - final String chStr = String.fromCharCode(ch); + final chStr = String.fromCharCode(ch); if (chStr == '(') { if (isFirst) { isFirst = false; diff --git a/packages/pigeon/lib/src/cpp/cpp_generator.dart b/packages/pigeon/lib/src/cpp/cpp_generator.dart index 78f6eb263ee..cb59c9d0e64 100644 --- a/packages/pigeon/lib/src/cpp/cpp_generator.dart +++ b/packages/pigeon/lib/src/cpp/cpp_generator.dart @@ -87,7 +87,7 @@ class CppOptions { /// Converts a [CppOptions] to a Map representation where: /// `x = CppOptions.fromMap(x.toMap())`. Map toMap() { - final Map result = { + final result = { if (headerIncludePath != null) 'headerIncludePath': headerIncludePath!, if (namespace != null) 'namespace': namespace!, if (copyrightHeader != null) 'copyrightHeader': copyrightHeader!, @@ -232,7 +232,7 @@ class CppHeaderGenerator extends StructuredGenerator { } indent.newln(); if (generatorOptions.namespace?.endsWith('_pigeontest') ?? false) { - final String testFixtureClass = + final testFixtureClass = '${_pascalCaseFromSnakeCase(generatorOptions.namespace!.replaceAll('_pigeontest', ''))}Test'; indent.writeln('class $testFixtureClass;'); } @@ -262,7 +262,7 @@ class CppHeaderGenerator extends StructuredGenerator { member.documentationComments, _docCommentSpec, ); - final String valueName = 'k${_pascalCaseFromCamelCase(member.name)}'; + final valueName = 'k${_pascalCaseFromCamelCase(member.name)}'; indent.writeln( '$valueName = $index${index == anEnum.members.length - 1 ? '' : ','}', ); @@ -333,7 +333,7 @@ class CppHeaderGenerator extends StructuredGenerator { } indent.newln(); - const List generatedMessages = [ + const generatedMessages = [ ' Generated class from Pigeon that represents data sent in messages.', ]; @@ -417,7 +417,7 @@ class CppHeaderGenerator extends StructuredGenerator { ); } - for (final NamedType field in orderedFields) { + for (final field in orderedFields) { addDocumentationComments( indent, field.documentationComments, @@ -508,7 +508,7 @@ class CppHeaderGenerator extends StructuredGenerator { indent.writeln('friend class $testFixtureClass;'); } - for (final NamedType field in orderedFields) { + for (final field in orderedFields) { final HostDatatype hostDatatype = getFieldHostDatatype( field, _baseCppTypeForBuiltinDartType, @@ -588,7 +588,7 @@ class CppHeaderGenerator extends StructuredGenerator { AstFlutterApi api, { required String dartPackageName, }) { - const List generatedMessages = [ + const generatedMessages = [ ' Generated class from Pigeon that represents Flutter messages that can be called from C++.', ]; addDocumentationComments( @@ -643,7 +643,7 @@ class CppHeaderGenerator extends StructuredGenerator { func.parameters, _getArgumentName, ); - final List parameters = [ + final parameters = [ ...map2(argTypes, argNames, (String x, String y) => '$x $y'), ..._flutterApiCallbackParameters(returnType), ]; @@ -671,7 +671,7 @@ class CppHeaderGenerator extends StructuredGenerator { AstHostApi api, { required String dartPackageName, }) { - const List generatedMessages = [ + const generatedMessages = [ ' Generated interface from Pigeon that represents a handler of messages from Flutter.', ]; addDocumentationComments( @@ -711,7 +711,7 @@ class CppHeaderGenerator extends StructuredGenerator { ); final String returnTypeName = _hostApiReturnType(returnType); - final List parameters = []; + final parameters = []; if (method.parameters.isNotEmpty) { final Iterable argTypes = method.parameters.map(( NamedType arg, @@ -963,7 +963,7 @@ class CppSourceGenerator extends StructuredGenerator { Indent indent, { required String dartPackageName, }) { - final List usingDirectives = [ + final usingDirectives = [ 'flutter::BasicMessageChannel', 'flutter::CustomEncodableValue', 'flutter::EncodableList', @@ -971,7 +971,7 @@ class CppSourceGenerator extends StructuredGenerator { 'flutter::EncodableValue', ]; usingDirectives.sort(); - for (final String using in usingDirectives) { + for (final using in usingDirectives) { indent.writeln('using $using;'); } indent.newln(); @@ -1025,7 +1025,7 @@ class CppSourceGenerator extends StructuredGenerator { } // Getters and setters. - for (final NamedType field in orderedFields) { + for (final field in orderedFields) { _writeCppSourceClassField( generatorOptions, root, @@ -1125,7 +1125,7 @@ class CppSourceGenerator extends StructuredGenerator { returnType: classDefinition.name, parameters: ['const EncodableList& list'], body: () { - const String instanceVariable = 'decoded'; + const instanceVariable = 'decoded'; final Iterable<_IndexedField> indexedFields = indexMap( getFieldsInSerializationOrder(classDefinition), (int index, NamedType field) => _IndexedField(index, field), @@ -1154,10 +1154,10 @@ class CppSourceGenerator extends StructuredGenerator { // Add the nullable fields via setters, since converting the encodable // values to the pointer types that the convenience constructor uses for // nullable fields is non-trivial. - for (final _IndexedField entry in nullableFields) { + for (final entry in nullableFields) { final NamedType field = entry.field; final String setterName = _makeSetterName(field); - final String encodableFieldName = + final encodableFieldName = '${_encodablePrefix}_${_makeVariableName(field)}'; indent.writeln('auto& $encodableFieldName = list[${entry.index}];'); @@ -1298,7 +1298,7 @@ EncodableValue $_overflowClassName::FromEncodableList( if (enumeratedTypes.isNotEmpty) { indent.writeln('switch (type) {'); indent.inc(); - for (final EnumeratedType customType in enumeratedTypes) { + for (final customType in enumeratedTypes) { if (customType.enumeration < maximumCodecFieldKey) { indent.write('case ${customType.enumeration}: '); indent.nest(1, () { @@ -1339,12 +1339,12 @@ EncodableValue $_overflowClassName::FromEncodableList( 'if (const CustomEncodableValue* custom_value = std::get_if(&value)) ', ); indent.addScoped('{', '}', () { - for (final EnumeratedType customType in enumeratedTypes) { - final String encodeString = + for (final customType in enumeratedTypes) { + final encodeString = customType.type == CustomTypes.customClass ? 'std::any_cast<${customType.name}>(*custom_value).ToEncodableList()' : 'static_cast(std::any_cast<${customType.name}>(*custom_value))'; - final String valueString = + final valueString = customType.enumeration < maximumCodecFieldKey ? encodeString : 'wrap.ToEncodableList()'; @@ -1442,7 +1442,7 @@ EncodableValue $_overflowClassName::FromEncodableList( ); }, ); - final List parameters = [ + final parameters = [ ...hostParameters.map( (_HostNamedType arg) => '${_flutterApiArgumentType(arg.hostType)} ${arg.name}', @@ -1465,13 +1465,13 @@ EncodableValue $_overflowClassName::FromEncodableList( ); // Convert arguments to EncodableValue versions. - const String argumentListVariableName = 'encoded_api_arguments'; + const argumentListVariableName = 'encoded_api_arguments'; indent.write('EncodableValue $argumentListVariableName = '); if (func.parameters.isEmpty) { indent.addln('EncodableValue();'); } else { indent.addScoped('EncodableValue(EncodableList{', '});', () { - for (final _HostNamedType param in hostParameters) { + for (final param in hostParameters) { final String encodedArgument = _wrappedHostApiArgumentExpression( root, @@ -1494,9 +1494,9 @@ EncodableValue $_overflowClassName::FromEncodableList( indent.addScoped('{', '});', () { String successCallbackArgument; successCallbackArgument = 'return_value'; - final String encodedReplyName = + final encodedReplyName = 'encodable_$successCallbackArgument'; - final String listReplyName = 'list_$successCallbackArgument'; + final listReplyName = 'list_$successCallbackArgument'; indent.writeln( 'std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size);', ); @@ -1602,7 +1602,7 @@ EncodableValue $_overflowClassName::FromEncodableList( ); indent.addScoped('{', '});', () { indent.writeScoped('try {', '}', () { - final List methodArgument = []; + final methodArgument = []; if (method.parameters.isNotEmpty) { indent.writeln( 'const auto& args = std::get(message);', @@ -1616,7 +1616,7 @@ EncodableValue $_overflowClassName::FromEncodableList( ); final String argName = _getSafeArgumentName(index, arg); - final String encodableArgName = + final encodableArgName = '${_encodablePrefix}_$argName'; indent.writeln( 'const auto& $encodableArgName = args.at($index);', @@ -1641,7 +1641,7 @@ EncodableValue $_overflowClassName::FromEncodableList( encodableArgName: encodableArgName, apiType: ApiType.host, ); - final String unwrapEnum = + final unwrapEnum = arg.type.isEnum && arg.type.isNullable ? ' ? &(*$argName) : nullptr' : ''; @@ -1661,7 +1661,7 @@ EncodableValue $_overflowClassName::FromEncodableList( '}', ); } - final String call = + final call = 'api->${_makeMethodName(method)}(${methodArgument.join(', ')})'; if (method.isAsynchronous) { indent.format('$call;'); @@ -1797,17 +1797,17 @@ return EncodableValue(EncodableList{ returnType: '${classDefinition.name}&', parameters: ['const ${classDefinition.name}& other'], body: () { - for (final NamedType field in fields) { + for (final field in fields) { final HostDatatype hostDatatype = getFieldHostDatatype( field, _shortBaseCppTypeForBuiltinDartType, ); final String ivarName = _makeInstanceVariableName(field); - final String otherIvar = 'other.$ivarName'; + final otherIvar = 'other.$ivarName'; final String valueExpression; if (_isPointerField(hostDatatype)) { - final String constructor = + final constructor = 'std::make_unique<${hostDatatype.datatype}>(*$otherIvar)'; valueExpression = hostDatatype.isNullable ? '$otherIvar ? $constructor : nullptr' @@ -1852,7 +1852,7 @@ return EncodableValue(EncodableList{ // Writes a setter treating the type as [type], to allow generating multiple // setter variants. void writeSetter(HostDatatype type) { - const String setterArgumentName = 'value_arg'; + const setterArgumentName = 'value_arg'; _writeFunctionDefinition( indent, setterName, @@ -1901,9 +1901,9 @@ return EncodableValue(EncodableList{ bool sourceIsField = false, }) { if (_isPointerField(type)) { - final String constructor = 'std::make_unique<${type.datatype}>'; + final constructor = 'std::make_unique<${type.datatype}>'; // If the source is a pointer field, it always needs dereferencing. - final String maybeDereference = sourceIsField ? '*' : ''; + final maybeDereference = sourceIsField ? '*' : ''; return type.isNullable ? '$variable ? $constructor(*$variable) : nullptr' : '$constructor($maybeDereference$variable)'; @@ -1923,7 +1923,7 @@ return EncodableValue(EncodableList{ final String errorCondition; final String errorGetter; - const String nullValue = 'EncodableValue()'; + const nullValue = 'EncodableValue()'; if (returnType.isVoid) { nonErrorPath = '${prefix}wrapped.push_back($nullValue);'; errorCondition = 'output.has_value()'; @@ -1934,8 +1934,8 @@ return EncodableValue(EncodableList{ _shortBaseCppTypeForBuiltinDartType, ); - const String extractedValue = 'std::move(output).TakeValue()'; - final String wrapperType = hostType.isBuiltin + const extractedValue = 'std::move(output).TakeValue()'; + final wrapperType = hostType.isBuiltin ? 'EncodableValue' : 'CustomEncodableValue'; if (returnType.isNullable) { @@ -1993,16 +1993,16 @@ ${prefix}reply(EncodableValue(std::move(wrapped)));'''; ) { final String encodableValue; if (!hostType.isBuiltin) { - final String nonNullValue = + final nonNullValue = hostType.isNullable || (!hostType.isEnum && isNestedClass) ? '*$variableName' : variableName; encodableValue = 'CustomEncodableValue($nonNullValue)'; } else if (dartType.baseName == 'Object') { - final String operator = hostType.isNullable ? '*' : ''; + final operator = hostType.isNullable ? '*' : ''; encodableValue = '$operator$variableName'; } else { - final String operator = hostType.isNullable ? '*' : ''; + final operator = hostType.isNullable ? '*' : ''; encodableValue = 'EncodableValue($operator$variableName)'; } @@ -2192,8 +2192,8 @@ String? _baseCppTypeForBuiltinDartType( TypeDeclaration type, { bool includeFlutterNamespace = true, }) { - final String flutterNamespace = includeFlutterNamespace ? 'flutter::' : ''; - final Map cppTypeForDartTypeMap = { + final flutterNamespace = includeFlutterNamespace ? 'flutter::' : ''; + final cppTypeForDartTypeMap = { 'void': 'void', 'bool': 'bool', 'int': 'int64_t', @@ -2241,7 +2241,7 @@ bool _isPointerField(HostDatatype type) { /// Returns the C++ type to use in an argument context without ownership /// transfer for the given base type. String _unownedArgumentType(HostDatatype type) { - final bool isString = type.datatype == 'std::string'; + final isString = type.datatype == 'std::string'; final String baseType = isString ? 'std::string_view' : type.datatype; if (isString || _isPodType(type)) { return type.isNullable ? 'const $baseType*' : baseType; @@ -2315,7 +2315,7 @@ String _flutterApiReturnType(HostDatatype type) { } String _getGuardName(String? headerFileName) { - const String prefix = 'PIGEON_'; + const prefix = 'PIGEON_'; if (headerFileName != null) { return '$prefix${headerFileName.replaceAll('.', '_').toUpperCase()}_'; } else { @@ -2325,7 +2325,7 @@ String _getGuardName(String? headerFileName) { void _writeSystemHeaderIncludeBlock(Indent indent, List headers) { headers.sort(); - for (final String header in headers) { + for (final header in headers) { indent.writeln('#include <$header>'); } } @@ -2352,7 +2352,7 @@ void _writeFunction( // Set the initial indentation. indent.write(''); // Write any starting annotations (e.g., 'static'). - for (final String annotation in startingAnnotations) { + for (final annotation in startingAnnotations) { indent.add('$annotation '); } // Write the signature. @@ -2380,7 +2380,7 @@ void _writeFunction( }, addTrailingNewline: false); } // Write any trailing annotations (e.g., 'const'). - for (final String annotation in trailingAnnotations) { + for (final annotation in trailingAnnotations) { indent.add(' $annotation'); } // Write the initializer list, if any. @@ -2505,7 +2505,7 @@ void _writeAccessBlock( /// Validates an AST to make sure the cpp generator supports everything. List validateCpp(InternalCppOptions options, Root root) { - final List result = []; + final result = []; for (final Api api in root.apis) { for (final Method method in api.methods) { for (final NamedType arg in method.parameters) { diff --git a/packages/pigeon/lib/src/dart/dart_generator.dart b/packages/pigeon/lib/src/dart/dart_generator.dart index a429c9e4cc3..9a803fdeea9 100644 --- a/packages/pigeon/lib/src/dart/dart_generator.dart +++ b/packages/pigeon/lib/src/dart/dart_generator.dart @@ -63,7 +63,7 @@ class DartOptions { /// Creates a [DartOptions] from a Map representation where: /// `x = DartOptions.fromMap(x.toMap())`. static DartOptions fromMap(Map map) { - final Iterable? copyrightHeader = + final copyrightHeader = map['copyrightHeader'] as Iterable?; return DartOptions( copyrightHeader: copyrightHeader?.cast(), @@ -75,7 +75,7 @@ class DartOptions { /// Converts a [DartOptions] to a Map representation where: /// `x = DartOptions.fromMap(x.toMap())`. Map toMap() { - final Map result = { + final result = { if (copyrightHeader != null) 'copyrightHeader': copyrightHeader!, if (sourceOutPath != null) 'sourceOutPath': sourceOutPath!, if (testOutPath != null) 'testOutPath': testOutPath!, @@ -211,8 +211,8 @@ class DartGenerator extends StructuredGenerator { classDefinition.documentationComments, docCommentSpec, ); - final String sealed = classDefinition.isSealed ? 'sealed ' : ''; - final String implements = classDefinition.superClassName != null + final sealed = classDefinition.isSealed ? 'sealed ' : ''; + final implements = classDefinition.superClassName != null ? 'extends ${classDefinition.superClassName} ' : ''; @@ -270,11 +270,11 @@ class DartGenerator extends StructuredGenerator { for (final NamedType field in getFieldsInSerializationOrder( classDefinition, )) { - final String required = + final required = !field.type.isNullable && field.defaultValue == null ? 'required ' : ''; - final String defaultValueString = field.defaultValue == null + final defaultValueString = field.defaultValue == null ? '' : ' = ${field.defaultValue}'; indent.writeln('${required}this.${field.name}$defaultValueString,'); @@ -317,16 +317,16 @@ class DartGenerator extends StructuredGenerator { required String dartPackageName, }) { void writeValueDecode(NamedType field, int index) { - final String resultAt = 'result[$index]'; - final String castCallPrefix = field.type.isNullable ? '?' : '!'; + final resultAt = 'result[$index]'; + final castCallPrefix = field.type.isNullable ? '?' : '!'; final String genericType = _makeGenericTypeArguments(field.type); final String castCall = _makeGenericCastCall(field.type); - final String nullableTag = field.type.isNullable ? '?' : ''; + final nullableTag = field.type.isNullable ? '?' : ''; if (field.type.typeArguments.isNotEmpty) { indent.add('($resultAt as $genericType?)$castCallPrefix$castCall'); } else { - final String castCallForcePrefix = field.type.isNullable ? '' : '!'; - final String castString = field.type.baseName == 'Object' + final castCallForcePrefix = field.type.isNullable ? '' : '!'; + final castString = field.type.baseName == 'Object' ? '' : ' as $genericType$nullableTag'; @@ -403,7 +403,7 @@ class DartGenerator extends StructuredGenerator { indent.writeln('writeValue(buffer, value.index);'); } } else { - final String encodeString = customType.type == CustomTypes.customClass + final encodeString = customType.type == CustomTypes.customClass ? '.encode()' : '.index'; indent.writeln( @@ -442,7 +442,7 @@ class DartGenerator extends StructuredGenerator { }); } - final EnumeratedType overflowClass = EnumeratedType( + final overflowClass = EnumeratedType( _overflowClassName, maximumCodecFieldKey, CustomTypes.customClass, @@ -467,7 +467,7 @@ class DartGenerator extends StructuredGenerator { indent.writeln('buffer.putUint8(4);'); indent.writeln('buffer.putInt64(value);'); }, addTrailingNewline: false); - int nonSerializedClassCount = 0; + var nonSerializedClassCount = 0; enumerate(enumeratedTypes, ( int index, final EnumeratedType customType, @@ -488,8 +488,8 @@ class DartGenerator extends StructuredGenerator { indent.addScoped('{', '}', () { indent.write('switch (type) '); indent.addScoped('{', '}', () { - int nonSerializedClassCount = 0; - for (final EnumeratedType customType in enumeratedTypes) { + var nonSerializedClassCount = 0; + for (final customType in enumeratedTypes) { if (customType.associatedClass?.isSealed ?? false) { nonSerializedClassCount++; } else if (customType.offset(nonSerializedClassCount) < @@ -617,7 +617,7 @@ class DartGenerator extends StructuredGenerator { required String dartPackageName, }) { indent.newln(); - bool first = true; + var first = true; addDocumentationComments(indent, api.documentationComments, docCommentSpec); indent.write('class ${api.name} '); indent.addScoped('{', '}', () { @@ -707,21 +707,21 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; Indent indent, { required String dartPackageName, }) { - final cb.Parameter binaryMessengerParameter = cb.Parameter( + final binaryMessengerParameter = cb.Parameter( (cb.ParameterBuilder builder) => builder ..name = 'binaryMessenger' ..type = cb.refer('BinaryMessenger?') ..named = true, ); - final cb.Field binaryMessengerField = cb.Field( + final binaryMessengerField = cb.Field( (cb.FieldBuilder builder) => builder ..name = '${varNamePrefix}binaryMessenger' ..type = cb.refer('BinaryMessenger?') ..modifier = cb.FieldModifier.final$, ); - final cb.Class instanceManagerApi = cb.Class( + final instanceManagerApi = cb.Class( (cb.ClassBuilder builder) => builder ..name = dartInstanceManagerApiClassName ..docs.add( @@ -776,7 +776,7 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; ]) ..body = cb.Block.of( cb.Block((cb.BlockBuilder builder) { - final StringBuffer messageHandlerSink = StringBuffer(); + final messageHandlerSink = StringBuffer(); writeFlutterMethodMessageHandler( Indent(messageHandlerSink), name: 'removeStrongReferenceName', @@ -827,7 +827,7 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; ), ) ..body = cb.Block((cb.BlockBuilder builder) { - final StringBuffer messageCallSink = StringBuffer(); + final messageCallSink = StringBuffer(); writeHostMethodMessageCall( Indent(messageCallSink), addSuffixVariable: false, @@ -861,7 +861,7 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; '/// This is typically called after a hot restart.', ]) ..body = cb.Block((cb.BlockBuilder builder) { - final StringBuffer messageCallSink = StringBuffer(); + final messageCallSink = StringBuffer(); writeHostMethodMessageCall( Indent(messageCallSink), addSuffixVariable: false, @@ -877,7 +877,7 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; ]), ); - final cb.DartEmitter emitter = cb.DartEmitter(useNullSafetySyntax: true); + final emitter = cb.DartEmitter(useNullSafetySyntax: true); indent.format( DartFormatter( languageVersion: Version(3, 6, 0), @@ -902,14 +902,14 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; AstProxyApi api, { required String dartPackageName, }) { - const String codecName = '_${classNamePrefix}ProxyApiBaseCodec'; + const codecName = '_${classNamePrefix}ProxyApiBaseCodec'; // Each API has a private codec instance used by every host method, // constructor, or non-static field. - final String codecInstanceName = '_${varNamePrefix}codec${api.name}'; + final codecInstanceName = '_${varNamePrefix}codec${api.name}'; // AST class used by code_builder to generate the code. - final cb.Class proxyApi = cb.Class( + final proxyApi = cb.Class( (cb.ClassBuilder builder) => builder ..name = api.name ..extend = api.superClass != null @@ -1016,7 +1016,7 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; ), ); - final cb.DartEmitter emitter = cb.DartEmitter(useNullSafetySyntax: true); + final emitter = cb.DartEmitter(useNullSafetySyntax: true); indent.format(_formatter.format('${proxyApi.accept(emitter)}')); } @@ -1031,7 +1031,7 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; required String dartPackageName, required String dartOutputPackageName, }) { - final Indent indent = Indent(sink); + final indent = Indent(sink); final String sourceOutPath = generatorOptions.dartOut ?? ''; final String testOutPath = generatorOptions.testOut ?? ''; _writeTestPrologue(generatorOptions, root, indent); @@ -1064,7 +1064,7 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; ); for (final AstHostApi api in root.apis.whereType()) { if (api.dartHostTestHandler != null) { - final AstFlutterApi mockApi = AstFlutterApi( + final mockApi = AstFlutterApi( name: api.dartHostTestHandler!, methods: api.methods, documentationComments: api.documentationComments, @@ -1215,7 +1215,7 @@ if (wrapped == null) { } '''); indent.writeScoped('switch (type) {', '}', () { - int nonSerializedClassCount = 0; + var nonSerializedClassCount = 0; for (int i = totalCustomCodecKeysAllowed; i < types.length; i++) { if (types[i].associatedClass?.isSealed ?? false) { nonSerializedClassCount++; @@ -1275,7 +1275,7 @@ if (wrapped == null) { required bool addSuffixVariable, bool insideAsyncMethod = true, }) { - String sendArgument = 'null'; + var sendArgument = 'null'; if (parameters.isNotEmpty) { final Iterable argExpressions = indexMap(parameters, ( int index, @@ -1286,8 +1286,8 @@ if (wrapped == null) { }); sendArgument = '[${argExpressions.join(', ')}]'; } - final String channelSuffix = addSuffixVariable ? '\$$_suffixVarName' : ''; - final String constOrFinal = addSuffixVariable ? 'final' : 'const'; + final channelSuffix = addSuffixVariable ? '\$$_suffixVarName' : ''; + final constOrFinal = addSuffixVariable ? 'final' : 'const'; indent.writeln( "$constOrFinal String ${varNamePrefix}channelName = '$channelName$channelSuffix';", ); @@ -1302,22 +1302,22 @@ if (wrapped == null) { ); final String returnTypeName = _makeGenericTypeArguments(returnType); final String genericCastCall = _makeGenericCastCall(returnType); - const String accessor = '${varNamePrefix}replyList[0]'; + const accessor = '${varNamePrefix}replyList[0]'; // Avoid warnings from pointlessly casting to `Object?`. - final String nullablyTypedAccessor = returnTypeName == 'Object' + final nullablyTypedAccessor = returnTypeName == 'Object' ? accessor : '($accessor as $returnTypeName?)'; - final String nullHandler = returnType.isNullable + final nullHandler = returnType.isNullable ? (genericCastCall.isEmpty ? '' : '?') : '!'; - String returnStatement = 'return'; + var returnStatement = 'return'; if (!returnType.isVoid) { returnStatement = '$returnStatement $nullablyTypedAccessor$nullHandler$genericCastCall'; } returnStatement = '$returnStatement;'; - const String sendFutureVar = '${varNamePrefix}sendFuture'; + const sendFutureVar = '${varNamePrefix}sendFuture'; indent.writeln( 'final Future $sendFutureVar = ${varNamePrefix}channel.send($sendArgument);', ); @@ -1387,13 +1387,13 @@ if (${varNamePrefix}replyList == null) { 'final BasicMessageChannel ${varNamePrefix}channel = BasicMessageChannel(', ); indent.nest(2, () { - final String channelSuffix = addSuffixVariable + final channelSuffix = addSuffixVariable ? r'$messageChannelSuffix' : ''; indent.writeln("'$channelName$channelSuffix', $pigeonChannelCodec,"); indent.writeln('binaryMessenger: binaryMessenger);'); }); - final String messageHandlerSetterWithOpeningParentheses = isMockHandler + final messageHandlerSetterWithOpeningParentheses = isMockHandler ? '_testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(${varNamePrefix}channel, ' : '${varNamePrefix}channel.setMessageHandler('; indent.write('if ($nullHandlerExpression) '); @@ -1407,8 +1407,8 @@ if (${varNamePrefix}replyList == null) { ); indent.addScoped('{', '});', () { final String returnTypeString = addGenericTypesNullable(returnType); - final bool isAsync = isAsynchronous; - const String emptyReturnStatement = + final isAsync = isAsynchronous; + const emptyReturnStatement = 'return wrapResponse(empty: true);'; String call; if (parameters.isEmpty) { @@ -1416,7 +1416,7 @@ if (${varNamePrefix}replyList == null) { } else { indent.writeln('assert(message != null,'); indent.writeln("'Argument for $channelName was null.');"); - const String argsArray = 'args'; + const argsArray = 'args'; indent.writeln( 'final List $argsArray = (message as List?)!;', ); @@ -1428,7 +1428,7 @@ if (${varNamePrefix}replyList == null) { final String genericArgType = _makeGenericTypeArguments(arg.type); final String castCall = _makeGenericCastCall(arg.type); - final String leftHandSide = 'final $argType? $argName'; + final leftHandSide = 'final $argType? $argName'; indent.writeln( '$leftHandSide = ($argsArray[$count] as $genericArgType?)${castCall.isEmpty ? '' : '?$castCall'};', @@ -1465,8 +1465,8 @@ if (${varNamePrefix}replyList == null) { indent.writeln('final $returnTypeString output = $call;'); } - const String returnExpression = 'output'; - final String returnStatement = isMockHandler + const returnExpression = 'output'; + final returnStatement = isMockHandler ? 'return [$returnExpression];' : 'return wrapResponse(result: $returnExpression);'; indent.writeln(returnStatement); @@ -1537,7 +1537,7 @@ String _getMethodParameterSignature( Iterable parameters, { bool addTrailingComma = false, }) { - String signature = ''; + var signature = ''; if (parameters.isEmpty) { return signature; } @@ -1553,11 +1553,11 @@ String _getMethodParameterSignature( .toList(); String getParameterString(Parameter p) { - final String required = p.isRequired && !p.isPositional ? 'required ' : ''; + final required = p.isRequired && !p.isPositional ? 'required ' : ''; final String type = addGenericTypesNullable(p.type); - final String defaultValue = p.defaultValue == null + final defaultValue = p.defaultValue == null ? '' : ' = ${p.defaultValue}'; return '$required$type ${p.name}$defaultValue'; @@ -1577,20 +1577,20 @@ String _getMethodParameterSignature( if (requiredPositionalParams.isNotEmpty) { signature = baseParameterString; } - final String trailingComma = + final trailingComma = optionalPositionalParams.isNotEmpty || namedParams.isNotEmpty ? ',' : ''; - final String baseParams = signature.isNotEmpty + final baseParams = signature.isNotEmpty ? '$signature$trailingComma ' : ''; if (optionalPositionalParams.isNotEmpty) { - final String trailingComma = + final trailingComma = requiredPositionalParams.length + optionalPositionalParams.length > 2 ? ',' : ''; return '$baseParams[$optionalParameterString$trailingComma]'; } if (namedParams.isNotEmpty) { - final String trailingComma = + final trailingComma = addTrailingComma || requiredPositionalParams.length + namedParams.length > 2 ? ', ' @@ -1639,6 +1639,6 @@ String addGenericTypesNullable(TypeDeclaration type) { /// Converts [inputPath] to a posix absolute path. String _posixify(String inputPath) { - final path.Context context = path.Context(style: path.Style.posix); + final context = path.Context(style: path.Style.posix); return context.fromUri(path.toUri(path.absolute(inputPath))); } diff --git a/packages/pigeon/lib/src/dart/proxy_api_generator_helper.dart b/packages/pigeon/lib/src/dart/proxy_api_generator_helper.dart index 369a7913321..e11c614372e 100644 --- a/packages/pigeon/lib/src/dart/proxy_api_generator_helper.dart +++ b/packages/pigeon/lib/src/dart/proxy_api_generator_helper.dart @@ -43,7 +43,7 @@ Iterable asConstructorParameters({ ); } - for (final ApiField field in unattachedFields) { + for (final field in unattachedFields) { yield cb.Parameter( (cb.ParameterBuilder builder) => builder ..name = field.name @@ -83,7 +83,7 @@ Iterable asConstructorParameters({ ); } - for (final Method method in declaredFlutterMethods) { + for (final method in declaredFlutterMethods) { yield cb.Parameter( (cb.ParameterBuilder builder) => builder ..name = method.name @@ -113,7 +113,7 @@ Iterable asConstructorParameters({ Iterable overridesClassConstructors( Iterable proxyApis, ) sync* { - for (final AstProxyApi api in proxyApis) { + for (final api in proxyApis) { final String lowerCamelCaseApiName = toLowerCamelCase(api.name); for (final Constructor constructor in api.constructors) { @@ -166,7 +166,7 @@ Iterable overridesClassConstructors( Iterable overridesClassStaticFields( Iterable proxyApis, ) sync* { - for (final AstProxyApi api in proxyApis) { + for (final api in proxyApis) { final String lowerCamelCaseApiName = toLowerCamelCase(api.name); for (final ApiField field in api.fields.where( @@ -189,7 +189,7 @@ Iterable overridesClassStaticFields( Iterable overridesClassStaticMethods( Iterable proxyApis, ) sync* { - for (final AstProxyApi api in proxyApis) { + for (final api in proxyApis) { final String lowerCamelCaseApiName = toLowerCamelCase(api.name); for (final Method method in api.hostMethods.where( @@ -281,7 +281,7 @@ Iterable staticAttachedFieldsGetters( Iterable fields, { required String apiName, }) sync* { - for (final ApiField field in fields) { + for (final field in fields) { yield cb.Method( (cb.MethodBuilder builder) => builder ..name = field.name @@ -306,7 +306,7 @@ void writeProxyApiPigeonOverrides( required DartFormatter formatter, required Iterable proxyApis, }) { - final cb.Class proxyApiOverrides = cb.Class( + final proxyApiOverrides = cb.Class( (cb.ClassBuilder builder) => builder ..name = proxyApiOverridesClassName ..annotations.add(cb.refer('visibleForTesting')) @@ -325,7 +325,7 @@ void writeProxyApiPigeonOverrides( ..methods.add(overridesClassResetMethod(proxyApis)), ); - final cb.DartEmitter emitter = cb.DartEmitter(useNullSafetySyntax: true); + final emitter = cb.DartEmitter(useNullSafetySyntax: true); indent.format(formatter.format('${proxyApiOverrides.accept(emitter)}')); } @@ -345,20 +345,20 @@ Iterable constructors( required Iterable<(Method, AstProxyApi)> flutterMethodsFromInterfaces, required Iterable declaredFlutterMethods, }) sync* { - final cb.Parameter binaryMessengerParameter = cb.Parameter( + final binaryMessengerParameter = cb.Parameter( (cb.ParameterBuilder builder) => builder ..name = '${classMemberNamePrefix}binaryMessenger' ..named = true ..toSuper = true, ); - for (final Constructor constructor in constructors) { + for (final constructor in constructors) { final String? factoryConstructorName = constructor.name.isNotEmpty ? constructor.name : null; - final String constructorName = + final constructorName = '$classMemberNamePrefix${constructor.name.isNotEmpty ? constructor.name : 'new'}'; - final String overridesConstructorName = constructor.name.isNotEmpty + final overridesConstructorName = constructor.name.isNotEmpty ? '${toLowerCamelCase(apiName)}_${constructor.name}' : '${toLowerCamelCase(apiName)}_new'; @@ -394,13 +394,12 @@ Iterable constructors( ) ..optionalParameters.addAll(parameters) ..body = cb.Block((cb.BlockBuilder builder) { - final Map forwardedParams = + final forwardedParams = { for (final cb.Parameter parameter in parameters) parameter.name: cb.refer(parameter.name), }; - final Map - forwardedParamsWithoutMessengerAndManager = { + final forwardedParamsWithoutMessengerAndManager = { for (final cb.Parameter parameter in parametersWithoutMessengerAndManager) parameter.name: cb.refer(parameter.name), @@ -462,7 +461,7 @@ Iterable constructors( const cb.Code('super.${classMemberNamePrefix}detached()'), ]) ..body = cb.Block((cb.BlockBuilder builder) { - final StringBuffer messageCallSink = StringBuffer(); + final messageCallSink = StringBuffer(); DartGenerator.writeHostMethodMessageCall( Indent(messageCallSink), addSuffixVariable: false, @@ -561,7 +560,7 @@ cb.Field codecInstanceField({ /// Converts unattached fields from the pigeon AST to `code_builder` /// Fields. Iterable unattachedFields(Iterable fields) sync* { - for (final ApiField field in fields) { + for (final field in fields) { yield cb.Field( (cb.FieldBuilder builder) => builder ..name = field.name @@ -583,7 +582,7 @@ Iterable flutterMethodFields( Iterable methods, { required String apiName, }) sync* { - for (final Method method in methods) { + for (final method in methods) { yield cb.Field( (cb.FieldBuilder builder) => builder ..name = method.name @@ -632,7 +631,7 @@ Iterable flutterMethodFields( Iterable interfaceApiFields( Iterable apisOfInterfaces, ) sync* { - for (final AstProxyApi proxyApi in apisOfInterfaces) { + for (final proxyApi in apisOfInterfaces) { for (final Method method in proxyApi.methods) { yield cb.Field( (cb.FieldBuilder builder) => builder @@ -680,7 +679,7 @@ Iterable interfaceApiFields( /// final MyOtherProxyApiClass value = _pigeon_value(); /// ``` Iterable attachedFields(Iterable fields) sync* { - for (final ApiField field in fields) { + for (final field in fields) { yield cb.Field( (cb.FieldBuilder builder) => builder ..name = '${field.isStatic ? '_' : ''}${field.name}' @@ -793,8 +792,8 @@ cb.Method setUpMessageHandlerMethod({ ], if (hasCallbackConstructor) ...cb.Block((cb.BlockBuilder builder) { - final StringBuffer messageHandlerSink = StringBuffer(); - const String methodName = '${classMemberNamePrefix}newInstance'; + final messageHandlerSink = StringBuffer(); + const methodName = '${classMemberNamePrefix}newInstance'; DartGenerator.writeFlutterMethodMessageHandler( Indent(messageHandlerSink), name: methodName, @@ -849,7 +848,7 @@ cb.Method setUpMessageHandlerMethod({ }).statements, for (final Method method in flutterMethods) ...cb.Block((cb.BlockBuilder builder) { - final StringBuffer messageHandlerSink = StringBuffer(); + final messageHandlerSink = StringBuffer(); DartGenerator.writeFlutterMethodMessageHandler( Indent(messageHandlerSink), name: method.name, @@ -882,7 +881,7 @@ cb.Method setUpMessageHandlerMethod({ Iterable parameters, Iterable safeArgumentNames, ) { - final String nullability = method.isRequired ? '' : '?'; + final nullability = method.isRequired ? '' : '?'; return '($methodName ?? ${safeArgumentNames.first}.$methodName)$nullability.call(${safeArgumentNames.join(',')})'; }, ); @@ -904,18 +903,18 @@ Iterable attachedFieldMethods( required String codecInstanceName, required String codecName, }) sync* { - for (final ApiField field in fields) { + for (final field in fields) { yield cb.Method((cb.MethodBuilder builder) { final String type = addGenericTypesNullable(field.type); - const String instanceName = '${varNamePrefix}instance'; - const String identifierInstanceName = + const instanceName = '${varNamePrefix}instance'; + const identifierInstanceName = '${varNamePrefix}instanceIdentifier'; builder ..name = '$varNamePrefix${field.name}' ..static = field.isStatic ..returns = cb.refer(type) ..body = cb.Block((cb.BlockBuilder builder) { - final StringBuffer messageCallSink = StringBuffer(); + final messageCallSink = StringBuffer(); DartGenerator.writeHostMethodMessageCall( Indent(messageCallSink), addSuffixVariable: false, @@ -990,7 +989,7 @@ Iterable hostMethods( required String codecInstanceName, required String codecName, }) sync* { - for (final Method method in methods) { + for (final method in methods) { assert(method.location == ApiLocation.host); final Iterable parameters = method.parameters.mapIndexed( (int index, NamedType parameter) => cb.Parameter( @@ -1025,7 +1024,7 @@ Iterable hostMethods( ], ]) ..body = cb.Block((cb.BlockBuilder builder) { - final StringBuffer messageCallSink = StringBuffer(); + final messageCallSink = StringBuffer(); DartGenerator.writeHostMethodMessageCall( Indent(messageCallSink), addSuffixVariable: false, diff --git a/packages/pigeon/lib/src/functional.dart b/packages/pigeon/lib/src/functional.dart index c59e6e5391f..01a9cf8b30a 100644 --- a/packages/pigeon/lib/src/functional.dart +++ b/packages/pigeon/lib/src/functional.dart @@ -8,8 +8,8 @@ Iterable indexMap( Iterable iterable, U Function(int index, T value) func, ) sync* { - int index = 0; - for (final T value in iterable) { + var index = 0; + for (final value in iterable) { yield func(index, value); ++index; } @@ -17,8 +17,8 @@ Iterable indexMap( /// Performs like [forEach] but invokes [func] with an enumeration. void enumerate(Iterable iterable, void Function(int, T) func) { - int count = 0; - for (final T value in iterable) { + var count = 0; + for (final value in iterable) { func(count, value); ++count; } @@ -62,14 +62,14 @@ Iterable map3( /// Adds [value] to the end of [ts]. Iterable followedByOne(Iterable ts, T value) sync* { - for (final T item in ts) { + for (final item in ts) { yield item; } yield value; } Iterable _count() sync* { - int x = 0; + var x = 0; while (true) { yield x++; } @@ -80,7 +80,7 @@ final Iterable wholeNumbers = _count(); /// Repeats an [item] [n] times. Iterable repeat(T item, int n) sync* { - for (int i = 0; i < n; ++i) { + for (var i = 0; i < n; ++i) { yield item; } } diff --git a/packages/pigeon/lib/src/generator.dart b/packages/pigeon/lib/src/generator.dart index 34e53a7c441..5495359d3e3 100644 --- a/packages/pigeon/lib/src/generator.dart +++ b/packages/pigeon/lib/src/generator.dart @@ -40,7 +40,7 @@ abstract class StructuredGenerator StringSink sink, { required String dartPackageName, }) { - final Indent indent = Indent(sink); + final indent = Indent(sink); writeFilePrologue( generatorOptions, diff --git a/packages/pigeon/lib/src/generator_tools.dart b/packages/pigeon/lib/src/generator_tools.dart index 2b687eb632d..9d4322b88e1 100644 --- a/packages/pigeon/lib/src/generator_tools.dart +++ b/packages/pigeon/lib/src/generator_tools.dart @@ -19,7 +19,7 @@ const String pigeonVersion = '26.1.2'; /// Read all the content from [stdin] to a String. String readStdin() { - final List bytes = []; + final bytes = []; int byte = stdin.readByteSync(); while (byte >= 0) { bytes.add(byte); @@ -64,8 +64,8 @@ class Indent { /// Returns the String representing the current indentation. String str() { - String result = ''; - for (int i = 0; i < _count; i++) { + var result = ''; + for (var i = 0; i < _count; i++) { result += tab; } return result; @@ -90,7 +90,7 @@ class Indent { .map((String line) => line.length - line.trimLeft().length) .reduce(min); - for (int i = 0; i < lines.length; ++i) { + for (var i = 0; i < lines.length; ++i) { final String line = lines[i].length >= indentationToRemove ? lines[i].substring(indentationToRemove) : lines[i]; @@ -324,7 +324,7 @@ const String generatedCodeWarning = /// Warning printed at the top of all generated code. String getGeneratedCodeWarning() { - final String versionString = includeVersionInGeneratedWarning + final versionString = includeVersionInGeneratedWarning ? ' (v$pigeonVersion)' : ''; return 'Autogenerated from Pigeon$versionString, do not edit directly.'; @@ -396,7 +396,7 @@ bool isVoid(TypeMirror type) { /// Adds the [lines] to [indent]. void addLines(Indent indent, Iterable lines, {String? linePrefix}) { final String prefix = linePrefix ?? ''; - for (final String line in lines) { + for (final line in lines) { indent.writeln(line.isNotEmpty ? '$prefix$line' : prefix.trimRight()); } } @@ -409,7 +409,7 @@ Map mergeMaps( Map base, Map modification, ) { - final Map result = {}; + final result = {}; for (final MapEntry entry in modification.entries) { if (base.containsKey(entry.key)) { final Object entryValue = entry.value; @@ -529,7 +529,7 @@ class _Bag { } void addMany(Iterable keys, Value? value) { - for (final Key key in keys) { + for (final key in keys) { add(key, value); } } @@ -541,8 +541,8 @@ Map> getReferencedTypes( List apis, List classes, ) { - final _Bag references = _Bag(); - for (final Api api in apis) { + final references = _Bag(); + for (final api in apis) { for (final Method method in api.methods) { for (final NamedType field in method.parameters) { references.addMany(_getTypeArguments(field.type), field.offset); @@ -567,7 +567,7 @@ Map> getReferencedTypes( final Set referencedTypeNames = references.map.keys .map((TypeDeclaration e) => e.baseName) .toSet(); - final List classesToCheck = List.from(referencedTypeNames); + final classesToCheck = List.from(referencedTypeNames); while (classesToCheck.isNotEmpty) { final String next = classesToCheck.removeLast(); final Class aClass = classes.firstWhere( @@ -648,7 +648,7 @@ Iterable getEnumeratedTypes( Root root, { bool excludeSealedClasses = false, }) sync* { - int index = 0; + var index = 0; for (final Enum customEnum in root.enums) { yield EnumeratedType( @@ -726,7 +726,7 @@ Iterable asDocumentationComments( DocumentCommentSpecification commentSpec, { List generatorComments = const [], }) sync* { - final List allComments = [ + final allComments = [ ...comments, if (comments.isNotEmpty && generatorComments.isNotEmpty) '', ...generatorComments, @@ -737,7 +737,7 @@ Iterable asDocumentationComments( yield commentSpec.openCommentToken; currentLineOpenToken = commentSpec.blockContinuationToken; } - for (String line in allComments) { + for (var line in allComments) { if (line.isNotEmpty && line[0] != ' ') { line = ' $line'; } @@ -837,7 +837,7 @@ class OutputFileOptions extends InternalOptions { /// Converts strings to Upper Camel Case. String toUpperCamelCase(String text) { - final RegExp separatorPattern = RegExp(r'[ _-]'); + final separatorPattern = RegExp(r'[ _-]'); return text.split(separatorPattern).map((String word) { return word.isEmpty ? '' @@ -847,8 +847,8 @@ String toUpperCamelCase(String text) { /// Converts strings to Lower Camel Case. String toLowerCamelCase(String text) { - final RegExp separatorPattern = RegExp(r'[ _-]'); - bool firstWord = true; + final separatorPattern = RegExp(r'[ _-]'); + var firstWord = true; return text.split(separatorPattern).map((String word) { if (word.isEmpty) { return ''; diff --git a/packages/pigeon/lib/src/gobject/gobject_generator.dart b/packages/pigeon/lib/src/gobject/gobject_generator.dart index 103a2b0f905..a078d93d354 100644 --- a/packages/pigeon/lib/src/gobject/gobject_generator.dart +++ b/packages/pigeon/lib/src/gobject/gobject_generator.dart @@ -48,7 +48,7 @@ class GObjectOptions { /// Creates a [GObjectOptions] from a Map representation where: /// `x = GObjectOptions.fromMap(x.toMap())`. static GObjectOptions fromMap(Map map) { - final Iterable? copyrightHeader = + final copyrightHeader = map['copyrightHeader'] as Iterable?; return GObjectOptions( headerIncludePath: map['header'] as String?, @@ -61,7 +61,7 @@ class GObjectOptions { /// Converts a [GObjectOptions] to a Map representation where: /// `x = GObjectOptions.fromMap(x.toMap())`. Map toMap() { - final Map result = { + final result = { if (headerIncludePath != null) 'header': headerIncludePath!, if (module != null) 'module': module!, if (copyrightHeader != null) 'copyrightHeader': copyrightHeader!, @@ -215,8 +215,8 @@ class GObjectHeaderGenerator final String enumName = _getClassName(module, anEnum.name); indent.newln(); - final List enumValueCommentLines = []; - for (int i = 0; i < anEnum.members.length; i++) { + final enumValueCommentLines = []; + for (var i = 0; i < anEnum.members.length; i++) { final EnumMember member = anEnum.members[i]; final String itemName = _getEnumValue( dartPackageName, @@ -233,7 +233,7 @@ class GObjectHeaderGenerator ...anEnum.documentationComments, ], _docCommentSpec); indent.writeScoped('typedef enum {', '} $enumName;', () { - for (int i = 0; i < anEnum.members.length; i++) { + for (var i = 0; i < anEnum.members.length; i++) { final EnumMember member = anEnum.members[i]; final String itemName = _getEnumValue( dartPackageName, @@ -270,7 +270,7 @@ class GObjectHeaderGenerator _writeDeclareFinalType(indent, module, classDefinition.name); indent.newln(); - final List constructorArgs = []; + final constructorArgs = []; for (final NamedType field in classDefinition.fields) { final String fieldName = _getFieldName(field.name); final String type = _getType(module, field.type); @@ -279,7 +279,7 @@ class GObjectHeaderGenerator constructorArgs.add('size_t ${fieldName}_length'); } } - final List constructorFieldCommentLines = []; + final constructorFieldCommentLines = []; for (final NamedType field in classDefinition.fields) { final String fieldName = _getFieldName(field.name); constructorFieldCommentLines.add('$fieldName: field in this object.'); @@ -320,7 +320,7 @@ class GObjectHeaderGenerator '', 'Returns: the field value.', ], _docCommentSpec); - final List getterArgs = [ + final getterArgs = [ '$className* object', if (_isNumericListType(field.type)) 'size_t* length', ]; @@ -362,7 +362,7 @@ class GObjectHeaderGenerator ], _docCommentSpec); } - for (final EnumeratedType customType in customTypes) { + for (final customType in customTypes) { final String customTypeId = _getCustomTypeId(module, customType); indent.writeln('extern const int $customTypeId;'); } @@ -413,7 +413,7 @@ class GObjectHeaderGenerator final String responseName = _getResponseName(api.name, method.name); final String responseClassName = _getClassName(module, responseName); - final List asyncArgs = ['$className* api']; + final asyncArgs = ['$className* api']; for (final Parameter param in method.parameters) { final String paramName = _snakeCaseFromCamelCase(param.name); asyncArgs.add('${_getType(module, param.type)} $paramName'); @@ -427,7 +427,7 @@ class GObjectHeaderGenerator 'gpointer user_data', ]); indent.newln(); - final List methodParameterCommentLines = []; + final methodParameterCommentLines = []; for (final Parameter param in method.parameters) { final String paramName = _snakeCaseFromCamelCase(param.name); methodParameterCommentLines.add( @@ -453,7 +453,7 @@ class GObjectHeaderGenerator "void ${methodPrefix}_$methodName(${asyncArgs.join(', ')});", ); - final List finishArgs = [ + final finishArgs = [ '$className* api', 'GAsyncResult* result', 'GError** error', @@ -561,7 +561,7 @@ class GObjectHeaderGenerator else 'Returns: a return value.', ], _docCommentSpec); - final String returnType = _isNullablePrimitiveType(method.returnType) + final returnType = _isNullablePrimitiveType(method.returnType) ? '$primitiveType*' : primitiveType; indent.writeln( @@ -654,7 +654,7 @@ class GObjectHeaderGenerator final String returnType = _getType(module, method.returnType); indent.newln(); - final List constructorArgs = [ + final constructorArgs = [ if (returnType != 'void') '$returnType return_value', if (_isNumericListType(method.returnType)) 'size_t return_value_length', ]; @@ -701,7 +701,7 @@ class GObjectHeaderGenerator final String responseName = _getResponseName(api.name, method.name); final String responseClassName = _getClassName(module, responseName); - final List methodArgs = []; + final methodArgs = []; for (final Parameter param in method.parameters) { final String name = _snakeCaseFromCamelCase(param.name); methodArgs.add('${_getType(module, param.type)} $name'); @@ -714,7 +714,7 @@ class GObjectHeaderGenerator '${className}ResponseHandle* response_handle', 'gpointer user_data', ]); - final String returnType = method.isAsynchronous + final returnType = method.isAsynchronous ? 'void' : '$responseClassName*'; indent.writeln("$returnType (*$methodName)(${methodArgs.join(', ')});"); @@ -735,7 +735,7 @@ class GObjectHeaderGenerator final String returnType = _getType(module, method.returnType); indent.newln(); - final List respondArgs = [ + final respondArgs = [ '${className}ResponseHandle* response_handle', if (returnType != 'void') '$returnType return_value', if (_isNumericListType(method.returnType)) 'size_t return_value_length', @@ -755,7 +755,7 @@ class GObjectHeaderGenerator ); indent.newln(); - final List respondErrorArgs = [ + final respondErrorArgs = [ '${className}ResponseHandle* response_handle', 'const gchar* code', 'const gchar* message', @@ -855,7 +855,7 @@ class GObjectSourceGenerator indent.newln(); _writeDispose(indent, module, classDefinition.name, () { - bool haveSelf = false; + var haveSelf = false; for (final NamedType field in classDefinition.fields) { final String fieldName = _getFieldName(field.name); final String? clear = _getClearFunction(field.type, 'self->$fieldName'); @@ -875,7 +875,7 @@ class GObjectSourceGenerator indent.newln(); _writeClassInit(indent, module, classDefinition.name, () {}); - final List constructorArgs = []; + final constructorArgs = []; for (final NamedType field in classDefinition.fields) { final String fieldName = _getFieldName(field.name); constructorArgs.add('${_getType(module, field.type)} $fieldName'); @@ -946,7 +946,7 @@ class GObjectSourceGenerator final String returnType = _getType(module, field.type); indent.newln(); - final List getterArgs = [ + final getterArgs = [ '$className* self', if (_isNumericListType(field.type)) 'size_t* length', ]; @@ -986,8 +986,8 @@ class GObjectSourceGenerator 'static $className* ${methodPrefix}_new_from_list(FlValue* values) {', '}', () { - final List args = []; - for (int i = 0; i < classDefinition.fields.length; i++) { + final args = []; + for (var i = 0; i < classDefinition.fields.length; i++) { final NamedType field = classDefinition.fields[i]; final String fieldName = _getFieldName(field.name); final String fieldType = _getType(module, field.type); @@ -1076,12 +1076,12 @@ class GObjectSourceGenerator ); indent.newln(); - for (final EnumeratedType customType in customTypes) { + for (final customType in customTypes) { final String customTypeId = _getCustomTypeId(module, customType); indent.writeln('const int $customTypeId = ${customType.enumeration};'); } - for (final EnumeratedType customType in customTypes) { + for (final customType in customTypes) { final String customTypeName = _getClassName(module, customType.name); final String snakeCustomTypeName = _snakeCaseFromCamelCase( customTypeName, @@ -1089,7 +1089,7 @@ class GObjectSourceGenerator final String customTypeId = _getCustomTypeId(module, customType); indent.newln(); - final String valueType = customType.type == CustomTypes.customClass + final valueType = customType.type == CustomTypes.customClass ? '$customTypeName*' : 'FlValue*'; indent.writeScoped( @@ -1129,7 +1129,7 @@ class GObjectSourceGenerator 'switch (fl_value_get_custom_type(value)) {', '}', () { - for (final EnumeratedType customType in customTypes) { + for (final customType in customTypes) { final String customTypeId = _getCustomTypeId( module, customType, @@ -1170,7 +1170,7 @@ class GObjectSourceGenerator }, ); - for (final EnumeratedType customType in customTypes) { + for (final customType in customTypes) { final String customTypeName = _getClassName(module, customType.name); final String snakeCustomTypeName = _snakeCaseFromCamelCase( customTypeName, @@ -1217,7 +1217,7 @@ class GObjectSourceGenerator '}', () { indent.writeScoped('switch (type) {', '}', () { - for (final EnumeratedType customType in customTypes) { + for (final customType in customTypes) { final String customTypeName = _getClassName( module, customType.name, @@ -1456,7 +1456,7 @@ class GObjectSourceGenerator ); indent.newln(); - final String returnType = _isNullablePrimitiveType(method.returnType) + final returnType = _isNullablePrimitiveType(method.returnType) ? '$primitiveType*' : primitiveType; indent.writeScoped( @@ -1515,7 +1515,7 @@ class GObjectSourceGenerator }, ); - final List asyncArgs = ['$className* self']; + final asyncArgs = ['$className* self']; for (final Parameter param in method.parameters) { final String name = _snakeCaseFromCamelCase(param.name); asyncArgs.add('${_getType(module, param.type)} $name'); @@ -1571,7 +1571,7 @@ class GObjectSourceGenerator }, ); - final List finishArgs = [ + final finishArgs = [ '$className* self', 'GAsyncResult* result', 'GError** error', @@ -1695,7 +1695,7 @@ class GObjectSourceGenerator final String returnType = _getType(module, method.returnType); indent.newln(); - final List constructorArgs = [ + final constructorArgs = [ if (returnType != 'void') '$returnType return_value', if (_isNumericListType(method.returnType)) 'size_t return_value_length', ]; @@ -1793,8 +1793,8 @@ class GObjectSourceGenerator ); indent.newln(); - final List methodArgs = []; - for (int i = 0; i < method.parameters.length; i++) { + final methodArgs = []; + for (var i = 0; i < method.parameters.length; i++) { final Parameter param = method.parameters[i]; final String paramName = _snakeCaseFromCamelCase(param.name); final String paramType = _getType(module, param.type); @@ -1839,7 +1839,7 @@ class GObjectSourceGenerator } } if (method.isAsynchronous) { - final List vfuncArgs = []; + final vfuncArgs = []; vfuncArgs.addAll(methodArgs); vfuncArgs.addAll(['handle', 'self->user_data']); indent.writeln( @@ -1849,7 +1849,7 @@ class GObjectSourceGenerator "self->vtable->$methodName(${vfuncArgs.join(', ')});", ); } else { - final List vfuncArgs = []; + final vfuncArgs = []; vfuncArgs.addAll(methodArgs); vfuncArgs.add('self->user_data'); indent.writeln( @@ -1960,7 +1960,7 @@ class GObjectSourceGenerator ); indent.newln(); - final List respondArgs = [ + final respondArgs = [ '${className}ResponseHandle* response_handle', if (returnType != 'void') '$returnType return_value', if (_isNumericListType(method.returnType)) 'size_t return_value_length', @@ -1969,7 +1969,7 @@ class GObjectSourceGenerator "void ${methodPrefix}_respond_$methodName(${respondArgs.join(', ')}) {", '}', () { - final List returnArgs = [ + final returnArgs = [ if (returnType != 'void') 'return_value', if (_isNumericListType(method.returnType)) 'return_value_length', ]; @@ -1990,7 +1990,7 @@ class GObjectSourceGenerator ); indent.newln(); - final List respondErrorArgs = [ + final respondErrorArgs = [ '${className}ResponseHandle* response_handle', 'const gchar* code', 'const gchar* message', @@ -2029,7 +2029,7 @@ String _getModule( // Returns the header guard defintion for [headerFileName]. String _getGuardName(String? headerFileName) { - const String prefix = 'PIGEON_'; + const prefix = 'PIGEON_'; if (headerFileName != null) { return '$prefix${headerFileName.replaceAll('.', '_').toUpperCase()}_'; } else { @@ -2197,7 +2197,7 @@ String _getClassName(String module, String name) { // Returns the name to use for a class field with [name]. String _getFieldName(String name) { - final List reservedNames = ['type']; + final reservedNames = ['type']; if (reservedNames.contains(name)) { name += '_'; } @@ -2206,7 +2206,7 @@ String _getFieldName(String name) { // Returns the name to user for a class method with [name] String _getMethodName(String name) { - final List reservedNames = ['new', 'get_type']; + final reservedNames = ['new', 'get_type']; if (reservedNames.contains(name)) { name += '_'; } @@ -2238,7 +2238,7 @@ String _getCustomTypeId(String module, EnumeratedType customType) { final String snakeCustomTypeName = _snakeCaseFromCamelCase(customTypeName); - final String customTypeId = '${snakeCustomTypeName}_type_id'; + final customTypeId = '${snakeCustomTypeName}_type_id'; return customTypeId; } diff --git a/packages/pigeon/lib/src/java/java_generator.dart b/packages/pigeon/lib/src/java/java_generator.dart index de675d73458..e31d8c1101d 100644 --- a/packages/pigeon/lib/src/java/java_generator.dart +++ b/packages/pigeon/lib/src/java/java_generator.dart @@ -59,7 +59,7 @@ class JavaOptions { /// Creates a [JavaOptions] from a Map representation where: /// `x = JavaOptions.fromMap(x.toMap())`. static JavaOptions fromMap(Map map) { - final Iterable? copyrightHeader = + final copyrightHeader = map['copyrightHeader'] as Iterable?; return JavaOptions( className: map['className'] as String?, @@ -72,7 +72,7 @@ class JavaOptions { /// Converts a [JavaOptions] to a Map representation where: /// `x = JavaOptions.fromMap(x.toMap())`. Map toMap() { - final Map result = { + final result = { if (className != null) 'className': className!, if (package != null) 'package': package!, if (copyrightHeader != null) 'copyrightHeader': copyrightHeader!, @@ -218,7 +218,7 @@ class JavaGenerator extends StructuredGenerator { required String dartPackageName, }) { String camelToSnake(String camelCase) { - final RegExp regex = RegExp('([a-z])([A-Z]+)'); + final regex = RegExp('([a-z])([A-Z]+)'); return camelCase .replaceAllMapped(regex, (Match m) => '${m[1]}_${m[2]}') .toUpperCase(); @@ -263,7 +263,7 @@ class JavaGenerator extends StructuredGenerator { Class classDefinition, { required String dartPackageName, }) { - const List generatedMessages = [ + const generatedMessages = [ ' Generated class from Pigeon that represents data sent in messages.', ]; indent.newln(); @@ -313,7 +313,7 @@ class JavaGenerator extends StructuredGenerator { field, (TypeDeclaration x) => _javaTypeForBuiltinDartType(x), ); - final String nullability = field.type.isNullable + final nullability = field.type.isNullable ? '@Nullable ' : '@NonNull '; addDocumentationComments( @@ -406,7 +406,7 @@ class JavaGenerator extends StructuredGenerator { final Iterable nonArrayFieldNames = classDefinition.fields .where((NamedType field) => !_javaTypeIsArray(field.type)) .map((NamedType field) => field.name); - final String nonArrayHashValue = nonArrayFieldNames.isNotEmpty + final nonArrayHashValue = nonArrayFieldNames.isNotEmpty ? 'Objects.hash(${nonArrayFieldNames.join(', ')})' : '0'; @@ -415,10 +415,10 @@ class JavaGenerator extends StructuredGenerator { // variable lint warnings. indent.writeln('return $nonArrayHashValue;'); } else { - const String resultVar = '${varNamePrefix}result'; + const resultVar = '${varNamePrefix}result'; indent.writeln('int $resultVar = $nonArrayHashValue;'); // Manually mix in the Arrays.hashCode values. - for (final String name in arrayFieldNames) { + for (final name in arrayFieldNames) { indent.writeln( '$resultVar = 31 * $resultVar + Arrays.hashCode($name);', ); @@ -444,7 +444,7 @@ class JavaGenerator extends StructuredGenerator { field, (TypeDeclaration x) => _javaTypeForBuiltinDartType(x), ); - final String nullability = field.type.isNullable + final nullability = field.type.isNullable ? '@Nullable' : '@NonNull'; indent.newln(); @@ -465,7 +465,7 @@ class JavaGenerator extends StructuredGenerator { indent.newln(); indent.write('public @NonNull ${classDefinition.name} build() '); indent.addScoped('{', '}', () { - const String returnVal = 'pigeonReturn'; + const returnVal = 'pigeonReturn'; indent.writeln( '${classDefinition.name} $returnVal = new ${classDefinition.name}();', ); @@ -516,7 +516,7 @@ class JavaGenerator extends StructuredGenerator { 'static @NonNull ${classDefinition.name} fromList(@NonNull ArrayList ${varNamePrefix}list) ', ); indent.addScoped('{', '}', () { - const String result = 'pigeonResult'; + const result = 'pigeonResult'; indent.writeln( '${classDefinition.name} $result = new ${classDefinition.name}();', ); @@ -550,13 +550,13 @@ class JavaGenerator extends StructuredGenerator { ).toList(); void writeEncodeLogic(EnumeratedType customType) { - final String encodeString = customType.type == CustomTypes.customClass + final encodeString = customType.type == CustomTypes.customClass ? 'toList()' : 'index'; - final String nullCheck = customType.type == CustomTypes.customEnum + final nullCheck = customType.type == CustomTypes.customEnum ? 'value == null ? null : ' : ''; - final String valueString = customType.enumeration < maximumCodecFieldKey + final valueString = customType.enumeration < maximumCodecFieldKey ? '$nullCheck((${customType.name}) value).$encodeString' : 'wrap.toList()'; final int enumeration = customType.enumeration < maximumCodecFieldKey @@ -600,7 +600,7 @@ class JavaGenerator extends StructuredGenerator { } } - final EnumeratedType overflowClass = EnumeratedType( + final overflowClass = EnumeratedType( _overflowClassName, maximumCodecFieldKey, CustomTypes.customClass, @@ -632,7 +632,7 @@ class JavaGenerator extends StructuredGenerator { '}', () { indent.writeScoped('switch (type) {', '}', () { - for (final EnumeratedType customType in enumeratedTypes) { + for (final customType in enumeratedTypes) { if (customType.enumeration < maximumCodecFieldKey) { writeDecodeLogic(customType); } @@ -670,19 +670,19 @@ class JavaGenerator extends StructuredGenerator { List types, { required String dartPackageName, }) { - final NamedType overflowInteration = NamedType( + final overflowInteration = NamedType( name: 'type', type: const TypeDeclaration(baseName: 'int', isNullable: false), ); - final NamedType overflowObject = NamedType( + final overflowObject = NamedType( name: 'wrapped', type: const TypeDeclaration(baseName: 'Object', isNullable: true), ); - final List overflowFields = [ + final overflowFields = [ overflowInteration, overflowObject, ]; - final Class overflowClass = Class( + final overflowClass = Class( name: _overflowClassName, fields: overflowFields, ); @@ -754,7 +754,7 @@ if (wrapped == null) { return '${_getArgumentName(count, argument)}Arg'; } - const List generatedMessages = [ + const generatedMessages = [ ' Generated class from Pigeon that represents Flutter messages that can be called from Java.', ]; addDocumentationComments( @@ -844,7 +844,7 @@ if (wrapped == null) { ); } indent.addScoped('{', '}', () { - const String channel = 'channel'; + const channel = 'channel'; indent.writeln( 'final String channelName = "${makeChannelName(api, func, dartPackageName)}" + messageChannelSuffix;', ); @@ -888,7 +888,7 @@ if (wrapped == null) { if (func.returnType.isVoid) { indent.writeln('result.success();'); } else { - const String output = 'output'; + const output = 'output'; final String outputExpression; indent.writeln('@SuppressWarnings("ConstantConditions")'); outputExpression = @@ -950,7 +950,7 @@ if (wrapped == null) { AstHostApi api, { required String dartPackageName, }) { - const List generatedMessages = [ + const generatedMessages = [ ' Generated interface from Pigeon that represents a handler of messages from Flutter.', ]; addDocumentationComments( @@ -1033,7 +1033,7 @@ if (wrapped == null) { final String returnType = method.isAsynchronous ? 'void' : _javaTypeForDartType(method.returnType); - final List argSignature = []; + final argSignature = []; if (method.parameters.isNotEmpty) { final Iterable argTypes = method.parameters.map( (NamedType e) => _nullsafeJavaTypeForDartType(e.type), @@ -1102,7 +1102,7 @@ if (wrapped == null) { ? 'Void' : _javaTypeForDartType(method.returnType); indent.writeln('ArrayList wrapped = new ArrayList<>();'); - final List methodArgument = []; + final methodArgument = []; if (method.parameters.isNotEmpty) { indent.writeln( 'ArrayList args = (ArrayList) message;', @@ -1110,8 +1110,8 @@ if (wrapped == null) { enumerate(method.parameters, (int index, NamedType arg) { final String argType = _javaTypeForDartType(arg.type); final String argName = _getSafeArgumentName(index, arg); - final String argExpression = argName; - String accessor = 'args.get($index)'; + final argExpression = argName; + var accessor = 'args.get($index)'; if (argType != 'Object') { accessor = _cast(accessor, javaType: argType); } @@ -1120,17 +1120,17 @@ if (wrapped == null) { }); } if (method.isAsynchronous) { - final String resultValue = method.returnType.isVoid + final resultValue = method.returnType.isVoid ? 'null' : 'result'; final String resultType = _getResultType(method.returnType); - final String resultParam = method.returnType.isVoid + final resultParam = method.returnType.isVoid ? '' : '$returnType result'; - final String addResultArg = method.returnType.isVoid + final addResultArg = method.returnType.isVoid ? 'null' : resultValue; - const String resultName = 'resultCallback'; + const resultName = 'resultCallback'; indent.format(''' $resultType $resultName = \t\tnew $resultType() { @@ -1147,7 +1147,7 @@ $resultType $resultName = '''); methodArgument.add(resultName); } - final String call = + final call = 'api.${method.name}(${methodArgument.join(', ')})'; if (method.isAsynchronous) { indent.writeln('$call;'); @@ -1341,7 +1341,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { /// Converts an expression that evaluates to an nullable int to an expression /// that evaluates to a nullable enum. String _intToEnum(String expression, String enumName, bool nullable) { - final String toEnum = '$enumName.values()[((Long) $expression).intValue()]'; + final toEnum = '$enumName.values()[((Long) $expression).intValue()]'; return nullable ? '$expression == null ? null : $toEnum' : toEnum; } @@ -1386,7 +1386,7 @@ bool _javaTypeIsArray(TypeDeclaration type) { } String? _javaTypeForBuiltinDartType(TypeDeclaration type) { - const Map javaTypeForDartTypeMap = { + const javaTypeForDartTypeMap = { 'bool': 'Boolean', 'int': 'Long', 'String': 'String', diff --git a/packages/pigeon/lib/src/kotlin/kotlin_generator.dart b/packages/pigeon/lib/src/kotlin/kotlin_generator.dart index 7745dd9e7aa..c987098b5cd 100644 --- a/packages/pigeon/lib/src/kotlin/kotlin_generator.dart +++ b/packages/pigeon/lib/src/kotlin/kotlin_generator.dart @@ -80,7 +80,7 @@ class KotlinOptions { /// Converts a [KotlinOptions] to a Map representation where: /// `x = KotlinOptions.fromMap(x.toMap())`. Map toMap() { - final Map result = { + final result = { if (package != null) 'package': package!, if (copyrightHeader != null) 'copyrightHeader': copyrightHeader!, if (errorClassName != null) 'errorClassName': errorClassName!, @@ -267,7 +267,7 @@ class KotlinGenerator extends StructuredGenerator { Class classDefinition, { required String dartPackageName, }) { - final List generatedMessages = [ + final generatedMessages = [ ' Generated class from Pigeon that represents data sent in messages.', ]; if (classDefinition.isSealed) { @@ -340,9 +340,9 @@ class KotlinGenerator extends StructuredGenerator { Class classDefinition, { bool private = false, }) { - final String privateString = private ? 'private ' : ''; - final String classType = classDefinition.isSealed ? 'sealed' : 'data'; - final String inheritance = classDefinition.superClass != null + final privateString = private ? 'private ' : ''; + final classType = classDefinition.isSealed ? 'sealed' : 'data'; + final inheritance = classDefinition.superClass != null ? ' : ${classDefinition.superClassName}()' : ''; indent.write('$privateString$classType class ${classDefinition.name} '); @@ -406,7 +406,7 @@ class KotlinGenerator extends StructuredGenerator { int index, final NamedType field, ) { - final String listValue = '${varNamePrefix}list[$index]'; + final listValue = '${varNamePrefix}list[$index]'; indent.writeln( 'val ${field.name} = ${_cast(indent, listValue, type: field.type)}', ); @@ -416,7 +416,7 @@ class KotlinGenerator extends StructuredGenerator { for (final NamedType field in getFieldsInSerializationOrder( classDefinition, )) { - final String comma = + final comma = getFieldsInSerializationOrder(classDefinition).last == field ? '' : ', '; @@ -436,7 +436,7 @@ class KotlinGenerator extends StructuredGenerator { indent.write( 'val ${field.name}: ${_nullSafeKotlinTypeForDartType(field.type)}', ); - final String defaultNil = field.type.isNullable ? ' = null' : ''; + final defaultNil = field.type.isNullable ? ' = null' : ''; indent.add(defaultNil); } @@ -475,10 +475,10 @@ class KotlinGenerator extends StructuredGenerator { ).toList(); void writeEncodeLogic(EnumeratedType customType) { - final String encodeString = customType.type == CustomTypes.customClass + final encodeString = customType.type == CustomTypes.customClass ? 'toList()' : 'raw.toLong()'; - final String valueString = customType.enumeration < maximumCodecFieldKey + final valueString = customType.enumeration < maximumCodecFieldKey ? 'value.$encodeString' : 'wrap.toList()'; final int enumeration = customType.enumeration < maximumCodecFieldKey @@ -512,7 +512,7 @@ class KotlinGenerator extends StructuredGenerator { }); } - final EnumeratedType overflowClass = EnumeratedType( + final overflowClass = EnumeratedType( '${generatorOptions.fileSpecificClassNameComponent}$_overflowClassName', maximumCodecFieldKey, CustomTypes.customClass, @@ -540,7 +540,7 @@ class KotlinGenerator extends StructuredGenerator { if (root.classes.isNotEmpty || root.enums.isNotEmpty) { indent.add('when (type) '); indent.addScoped('{', '}', () { - for (final EnumeratedType customType in enumeratedTypes) { + for (final customType in enumeratedTypes) { if (customType.enumeration < maximumCodecFieldKey) { writeDecodeLogic(customType); } @@ -586,19 +586,19 @@ class KotlinGenerator extends StructuredGenerator { List types, { required String dartPackageName, }) { - final NamedType overflowInt = NamedType( + final overflowInt = NamedType( name: 'type', type: const TypeDeclaration(baseName: 'int', isNullable: false), ); - final NamedType overflowObject = NamedType( + final overflowObject = NamedType( name: 'wrapped', type: const TypeDeclaration(baseName: 'Object', isNullable: true), ); - final List overflowFields = [ + final overflowFields = [ overflowInt, overflowObject, ]; - final Class overflowClass = Class( + final overflowClass = Class( name: '${generatorOptions.fileSpecificClassNameComponent}$_overflowClassName', fields: overflowFields, @@ -665,7 +665,7 @@ if (wrapped == null) { AstFlutterApi api, { required String dartPackageName, }) { - const List generatedMessages = [ + const generatedMessages = [ ' Generated class from Pigeon that represents Flutter messages that can be called from Kotlin.', ]; addDocumentationComments( @@ -746,7 +746,7 @@ if (wrapped == null) { }) { final String apiName = api.name; - const List generatedMessages = [ + const generatedMessages = [ ' Generated interface from Pigeon that represents a handler of messages from Flutter.', ]; addDocumentationComments( @@ -840,7 +840,7 @@ if (wrapped == null) { Indent indent, { required String dartPackageName, }) { - final String instanceManagerApiName = + final instanceManagerApiName = '${kotlinInstanceManagerClassName(generatorOptions)}Api'; addDocumentationComments(indent, [ @@ -869,7 +869,7 @@ if (wrapped == null) { 'fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, instanceManager: ${kotlinInstanceManagerClassName(generatorOptions)}?) {', '}', () { - const String setHandlerCondition = 'instanceManager != null'; + const setHandlerCondition = 'instanceManager != null'; _writeHostMethodMessageHandler( indent, generatorOptions: generatorOptions, @@ -1000,7 +1000,7 @@ if (wrapped == null) { 'override fun writeValue(stream: ByteArrayOutputStream, value: Any?) {', '}', () { - final List nonProxyApiTypes = [ + final nonProxyApiTypes = [ 'Boolean', 'ByteArray', 'Double', @@ -1042,7 +1042,7 @@ if (wrapped == null) { api.kotlinOptions?.fullClassName ?? api.name; final int? minApi = api.kotlinOptions?.minAndroidApi; - final String versionCheck = minApi != null + final versionCheck = minApi != null ? 'android.os.Build.VERSION.SDK_INT >= $minApi && ' : ''; @@ -1079,7 +1079,7 @@ if (wrapped == null) { AstProxyApi api, { required String dartPackageName, }) { - final String kotlinApiName = '$hostProxyApiPrefix${api.name}'; + final kotlinApiName = '$hostProxyApiPrefix${api.name}'; addDocumentationComments( indent, @@ -1088,7 +1088,7 @@ if (wrapped == null) { ); indent.writeln('@Suppress("UNCHECKED_CAST")'); // The API only needs to be abstract if there are methods to override. - final String classModifier = api.hasMethodsRequiringImplementation() + final classModifier = api.hasMethodsRequiringImplementation() ? 'abstract' : 'open'; indent.writeScoped( @@ -1098,7 +1098,7 @@ if (wrapped == null) { final String fullKotlinClassName = api.kotlinOptions?.fullClassName ?? api.name; - final TypeDeclaration apiAsTypeDeclaration = TypeDeclaration( + final apiAsTypeDeclaration = TypeDeclaration( baseName: api.name, isNullable: false, associatedProxyApi: api, @@ -1389,7 +1389,7 @@ fun deepEquals(a: Any?, b: Any?): Boolean { String Function(int index, NamedType type) getArgumentName = _getArgumentName, }) { - final List argSignature = []; + final argSignature = []; if (parameters.isNotEmpty) { final Iterable argTypes = parameters.map( (NamedType e) => _nullSafeKotlinTypeForDartType(e.type), @@ -1406,7 +1406,7 @@ fun deepEquals(a: Any?, b: Any?): Boolean { ? '' : _nullSafeKotlinTypeForDartType(returnType); - final String resultType = returnType.isVoid ? 'Unit' : returnTypeString; + final resultType = returnType.isVoid ? 'Unit' : returnTypeString; addDocumentationComments(indent, documentationComments, _docCommentSpec); if (minApiRequirement != null) { @@ -1415,8 +1415,8 @@ fun deepEquals(a: Any?, b: Any?): Boolean { ); } - final String openKeyword = isOpen ? 'open ' : ''; - final String abstractKeyword = isAbstract ? 'abstract ' : ''; + final openKeyword = isOpen ? 'open ' : ''; + final abstractKeyword = isAbstract ? 'abstract ' : ''; if (isAsynchronous) { argSignature.add('callback: (Result<$resultType>) -> Unit'); @@ -1462,16 +1462,16 @@ fun deepEquals(a: Any?, b: Any?): Boolean { indent.write('if ($setHandlerCondition) '); indent.addScoped('{', '}', () { - final String messageVarName = parameters.isNotEmpty ? 'message' : '_'; + final messageVarName = parameters.isNotEmpty ? 'message' : '_'; indent.write('channel.setMessageHandler '); indent.addScoped('{ $messageVarName, reply ->', '}', () { - final List methodArguments = []; + final methodArguments = []; if (parameters.isNotEmpty) { indent.writeln('val args = message as List'); enumerate(parameters, (int index, NamedType arg) { final String argName = _getSafeArgumentName(index, arg); - final String argIndex = 'args[$index]'; + final argIndex = 'args[$index]'; indent.writeln( 'val $argName = ${_castForceUnwrap(argIndex, arg.type, indent)}', ); @@ -1598,7 +1598,7 @@ fun deepEquals(a: Any?, b: Any?): Boolean { sendArgument = 'listOf(${enumSafeArgNames.join(', ')})'; } - const String channel = 'channel'; + const channel = 'channel'; indent.writeln('val channelName = "$channelName"'); indent.writeln( 'val $channel = BasicMessageChannel(binaryMessenger, channelName, codec)', @@ -1646,7 +1646,7 @@ fun deepEquals(a: Any?, b: Any?): Boolean { final String instanceManagerName = kotlinInstanceManagerClassName( generatorOptions, ); - final String instanceManagerApiName = '${instanceManagerName}Api'; + final instanceManagerApiName = '${instanceManagerName}Api'; addDocumentationComments(indent, [ ' Provides implementations for each ProxyApi implementation and provides access to resources', @@ -1688,7 +1688,7 @@ fun deepEquals(a: Any?, b: Any?): Boolean { } ) }'''); - for (final AstProxyApi api in allProxyApis) { + for (final api in allProxyApis) { _writeMethodDeclaration( indent, name: 'get$hostProxyApiPrefix${api.name}', @@ -1721,7 +1721,7 @@ fun deepEquals(a: Any?, b: Any?): Boolean { indent.writeln( '$instanceManagerApiName.setUpMessageHandlers(binaryMessenger, instanceManager)', ); - for (final AstProxyApi api in allProxyApis) { + for (final api in allProxyApis) { final bool hasHostMessageCalls = api.constructors.isNotEmpty || api.attachedFields.isNotEmpty || @@ -1738,7 +1738,7 @@ fun deepEquals(a: Any?, b: Any?): Boolean { indent.writeln( '$instanceManagerApiName.setUpMessageHandlers(binaryMessenger, null)', ); - for (final AstProxyApi api in allProxyApis) { + for (final api in allProxyApis) { if (api.hasAnyHostMessageCalls()) { indent.writeln( '$hostProxyApiPrefix${api.name}.setUpMessageHandlers(binaryMessenger, null)', @@ -2267,13 +2267,13 @@ fun deepEquals(a: Any?, b: Any?): Boolean { // // These are used for inherited Flutter methods. void _writeProxyApiInheritedApiMethods(Indent indent, AstProxyApi api) { - final Set inheritedApiNames = { + final inheritedApiNames = { if (api.superClass != null) api.superClass!.baseName, ...api.interfaces.map((TypeDeclaration type) => type.baseName), }; - for (final String name in inheritedApiNames) { + for (final name in inheritedApiNames) { indent.writeln('@Suppress("FunctionName")'); - final String apiName = '$hostProxyApiPrefix$name'; + final apiName = '$hostProxyApiPrefix$name'; _writeMethodDeclaration( indent, name: '${classMemberNamePrefix}get$apiName', @@ -2361,7 +2361,7 @@ String _kotlinTypeForBuiltinGenericDartType(TypeDeclaration type) { } String? _kotlinTypeForBuiltinDartType(TypeDeclaration type) { - const Map kotlinTypeForDartTypeMap = { + const kotlinTypeForDartTypeMap = { 'void': 'Void', 'bool': 'Boolean', 'String': 'String', @@ -2399,7 +2399,7 @@ String _kotlinTypeForDartType(TypeDeclaration type) { } String _nullSafeKotlinTypeForDartType(TypeDeclaration type) { - final String nullSafe = type.isNullable ? '?' : ''; + final nullSafe = type.isNullable ? '?' : ''; return '${_kotlinTypeForDartType(type)}$nullSafe'; } diff --git a/packages/pigeon/lib/src/objc/objc_generator.dart b/packages/pigeon/lib/src/objc/objc_generator.dart index 57ca9840e3f..2169934d022 100644 --- a/packages/pigeon/lib/src/objc/objc_generator.dart +++ b/packages/pigeon/lib/src/objc/objc_generator.dart @@ -68,7 +68,7 @@ class ObjcOptions { /// Creates a [ObjcOptions] from a Map representation where: /// `x = ObjcOptions.fromMap(x.toMap())`. static ObjcOptions fromMap(Map map) { - final Iterable? copyrightHeader = + final copyrightHeader = map['copyrightHeader'] as Iterable?; return ObjcOptions( headerIncludePath: map['headerIncludePath'] as String?, @@ -82,7 +82,7 @@ class ObjcOptions { /// Converts a [ObjcOptions] to a Map representation where: /// `x = ObjcOptions.fromMap(x.toMap())`. Map toMap() { - final Map result = { + final result = { if (headerIncludePath != null) 'headerIncludePath': headerIncludePath!, if (prefix != null) 'prefix': prefix!, if (copyrightHeader != null) 'copyrightHeader': copyrightHeader!, @@ -449,7 +449,7 @@ class ObjcHeaderGenerator extends StructuredGenerator { lastArgType = 'FlutterError *_Nullable *_Nonnull'; lastArgName = 'error'; } - final List generatorComments = []; + final generatorComments = []; if (!func.returnType.isNullable && !func.returnType.isVoid && !func.isAsynchronous) { @@ -657,19 +657,19 @@ class ObjcSourceGenerator extends StructuredGenerator { ); indent.write('+ ($className *)fromList:(NSArray *)list '); indent.addScoped('{', '}', () { - const String resultName = 'pigeonResult'; + const resultName = 'pigeonResult'; indent.writeln('$className *$resultName = [[$className alloc] init];'); enumerate(getFieldsInSerializationOrder(classDefinition), ( int index, final NamedType field, ) { - final String valueGetter = 'GetNullableObjectAtIndex(list, $index)'; + final valueGetter = 'GetNullableObjectAtIndex(list, $index)'; final String? primitiveExtractionMethod = _nsnumberExtractionMethod( field.type, ); final String ivarValueExpression; if (field.type.isEnum && !field.type.isNullable) { - final String varName = + final varName = 'boxed${_enumName(field.type.baseName, prefix: generatorOptions.prefix)}'; _writeEnumBoxToEnum( indent, @@ -770,7 +770,7 @@ if (self.wrapped == nil) { String? prefix, { bool isOverflowClass = false, }) { - String readValue = '[self readValue]'; + var readValue = '[self readValue]'; if (isOverflowClass) { readValue = 'self.wrapped'; } @@ -785,7 +785,7 @@ if (self.wrapped == nil) { !isOverflowClass ? '{' : '', !isOverflowClass ? '}' : null, () { - String enumAsNumber = 'enumAsNumber'; + var enumAsNumber = 'enumAsNumber'; if (!isOverflowClass) { indent.writeln('NSNumber *$enumAsNumber = $readValue;'); indent.write('return $enumAsNumber == nil ? nil : '); @@ -809,16 +809,16 @@ if (self.wrapped == nil) { Indent indent, { required String dartPackageName, }) { - const String codecName = 'PigeonCodec'; + const codecName = 'PigeonCodec'; final List enumeratedTypes = getEnumeratedTypes( root, excludeSealedClasses: true, ).toList(); - final String readerWriterName = + final readerWriterName = '${generatorOptions.prefix}${toUpperCamelCase(generatorOptions.fileSpecificClassNameComponent ?? '')}${codecName}ReaderWriter'; - final String readerName = + final readerName = '${generatorOptions.prefix}${toUpperCamelCase(generatorOptions.fileSpecificClassNameComponent ?? '')}${codecName}Reader'; - final String writerName = + final writerName = '${generatorOptions.prefix}${toUpperCamelCase(generatorOptions.fileSpecificClassNameComponent ?? '')}${codecName}Writer'; if (root.requiresOverflowClass) { @@ -837,7 +837,7 @@ if (self.wrapped == nil) { indent.write('- (nullable id)readValueOfType:(UInt8)type '); indent.addScoped('{', '}', () { indent.writeScoped('switch (type) {', '}', () { - for (final EnumeratedType customType in enumeratedTypes) { + for (final customType in enumeratedTypes) { if (customType.enumeration < maximumCodecFieldKey) { indent.write('case ${customType.enumeration}: '); _writeCodecDecode( @@ -869,11 +869,11 @@ if (self.wrapped == nil) { indent.write('- (void)writeValue:(id)value '); indent.addScoped('{', '}', () { indent.write(''); - for (final EnumeratedType customType in enumeratedTypes) { - final String encodeString = customType.type == CustomTypes.customClass + for (final customType in enumeratedTypes) { + final encodeString = customType.type == CustomTypes.customClass ? '[value toList]' : '(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])'; - final String valueString = customType.enumeration < maximumCodecFieldKey + final valueString = customType.enumeration < maximumCodecFieldKey ? encodeString : '[wrap toList]'; final String className = customType.type == CustomTypes.customClass @@ -986,7 +986,7 @@ if (self.wrapped == nil) { }) { final String apiName = _className(generatorOptions.prefix, api.name); - const String channelName = 'channel'; + const channelName = 'channel'; indent.write( 'void SetUp$apiName(id binaryMessenger, NSObject<$apiName> *api) ', ); @@ -1121,10 +1121,10 @@ static FlutterError *createConnectionError(NSString *channelName) { ) { void unpackArgs(String variable) { indent.writeln('NSArray *args = $variable;'); - int count = 0; + var count = 0; for (final NamedType arg in func.parameters) { final String argName = _getSafeArgName(count, arg); - final String valueGetter = 'GetNullableObjectAtIndex(args, $count)'; + final valueGetter = 'GetNullableObjectAtIndex(args, $count)'; final String? primitiveExtractionMethod = _nsnumberExtractionMethod( arg.type, ); @@ -1135,7 +1135,7 @@ static FlutterError *createConnectionError(NSString *channelName) { final String ivarValueExpression; String beforeString = objcArgType.beforeString; if (arg.type.isEnum && !arg.type.isNullable) { - final String varName = + final varName = 'boxed${_enumName(arg.type.baseName, prefix: generatorOptions.prefix)}'; _writeEnumBoxToEnum( indent, @@ -1169,7 +1169,7 @@ static FlutterError *createConnectionError(NSString *channelName) { _ObjcType returnType, ) { if (func.returnType.isVoid) { - const String callback = 'callback(wrapResult(nil, error));'; + const callback = 'callback(wrapResult(nil, error));'; if (func.parameters.isEmpty) { indent.writeScoped( '[api ${selectorComponents.first}:^(FlutterError *_Nullable error) {', @@ -1188,8 +1188,8 @@ static FlutterError *createConnectionError(NSString *channelName) { ); } } else { - const String callback = 'callback(wrapResult(output, error));'; - String returnTypeString = '${returnType.beforeString}_Nullable output'; + const callback = 'callback(wrapResult(output, error));'; + var returnTypeString = '${returnType.beforeString}_Nullable output'; if (func.returnType.isEnum) { returnTypeString = @@ -1233,7 +1233,7 @@ static FlutterError *createConnectionError(NSString *channelName) { } // TODO(gaaclarke): Incorporate this into _getSelectorComponents. - final String lastSelectorComponent = func.isAsynchronous + final lastSelectorComponent = func.isAsynchronous ? 'completion' : 'error'; final String selector = _getSelector(func, lastSelectorComponent); @@ -1271,7 +1271,7 @@ static FlutterError *createConnectionError(NSString *channelName) { if (func.isAsynchronous) { writeAsyncBindings(selectorComponents, callSignature, returnType); } else { - final String syncCall = func.parameters.isEmpty + final syncCall = func.parameters.isEmpty ? '[api ${selectorComponents.first}:&error]' : '[api $callSignature error:&error]'; writeSyncBindings(syncCall, returnType); @@ -1360,7 +1360,7 @@ taskQueue:$taskQueue languageOptions.prefix, ); indent.writeScoped(' {', '}', () { - const String result = 'pigeonResult'; + const result = 'pigeonResult'; indent.writeln('$className* $result = [[$className alloc] init];'); for (final NamedType field in getFieldsInSerializationOrder( classDefinition, @@ -1397,7 +1397,7 @@ void _writeMethod( if (func.parameters.isEmpty) { sendArgument = 'nil'; } else { - int count = 0; + var count = 0; String makeVarOrNSNullExpression(NamedType arg) { final String argName = argNameFunc(count, arg); String varExpression = _collectionSafeExpression(argName, arg.type); @@ -1447,7 +1447,7 @@ void _writeMethod( indent.addln('];'); }); }); - final String valueOnErrorResponse = func.returnType.isVoid ? '' : 'nil, '; + final valueOnErrorResponse = func.returnType.isVoid ? '' : 'nil, '; indent.write( '[channel sendMessage:$sendArgument reply:^(NSArray *reply) ', ); @@ -1459,7 +1459,7 @@ void _writeMethod( ); }, addTrailingNewline: false); indent.addScoped('else {', '}', () { - const String nullCheck = 'reply[0] == [NSNull null] ? nil : reply[0]'; + const nullCheck = 'reply[0] == [NSNull null] ? nil : reply[0]'; if (func.returnType.isVoid) { indent.writeln('completion(nil);'); } else { @@ -1497,7 +1497,7 @@ void _writeObjcSourceClassInitializerDeclaration( String? prefix, ) { indent.write('+ (instancetype)makeWith'); - bool isFirst = true; + var isFirst = true; indent.nest(2, () { for (final NamedType field in getFieldsInSerializationOrder( classDefinition, @@ -1520,7 +1520,7 @@ void _writeObjcSourceClassInitializerDeclaration( : _enumName(x, prefix: prefix) : (String x) => '${_className(prefix, x)} *', ); - final String nullable = field.type.isNullable ? 'nullable ' : ''; + final nullable = field.type.isNullable ? 'nullable ' : ''; printer('$label:($nullable${hostDatatype.datatype})${field.name}'); } }); @@ -1767,7 +1767,7 @@ Iterable _getSelectorComponents( if (func.objcSelector.isEmpty) { final Iterator it = func.parameters.iterator; final bool hasArguments = it.moveNext(); - final String namePostfix = + final namePostfix = (lastSelectorComponent.isNotEmpty && func.parameters.isEmpty) ? 'With${_capitalize(lastSelectorComponent)}' : ''; @@ -1820,7 +1820,7 @@ String _makeObjcSignature({ if (arg.type.isEnum) { return '${arg.type.isNullable ? 'nullable ' : ''}${_enumName(arg.type.baseName, suffix: arg.type.isNullable ? ' *' : '', prefix: options.prefix, box: arg.type.isNullable)}'; } else { - final String nullable = arg.type.isNullable ? 'nullable ' : ''; + final nullable = arg.type.isNullable ? 'nullable ' : ''; final _ObjcType argType = _objcTypeForDartType( options.prefix, arg.type, @@ -1903,7 +1903,7 @@ void _writeInitializers(Indent indent) { /// Looks through the AST for features that aren't supported by the ObjC /// generator. List validateObjc(InternalObjcOptions options, Root root) { - final List errors = []; + final errors = []; for (final Api api in root.apis) { for (final Method method in api.methods) { for (final NamedType arg in method.parameters) { @@ -2000,7 +2000,7 @@ void _writeDataClassDeclaration( isNullable: field.type.isNullable, isEnum: field.type.isEnum, ); - final String nullability = field.type.isNullable ? ', nullable' : ''; + final nullability = field.type.isNullable ? ', nullable' : ''; final String fieldType = field.type.isEnum && field.type.isNullable ? _enumName( field.type.baseName, diff --git a/packages/pigeon/lib/src/pigeon_lib.dart b/packages/pigeon/lib/src/pigeon_lib.dart index 2bb976475b9..1f0aa744a70 100644 --- a/packages/pigeon/lib/src/pigeon_lib.dart +++ b/packages/pigeon/lib/src/pigeon_lib.dart @@ -389,7 +389,7 @@ class PigeonOptions { /// Converts a [PigeonOptions] to a Map representation where: /// `x = PigeonOptions.fromMap(x.toMap())`. Map toMap() { - final Map result = { + final result = { if (input != null) 'input': input!, if (dartOut != null) 'dartOut': dartOut!, if (dartTestOut != null) 'dartTestOut': dartTestOut!, @@ -450,22 +450,22 @@ class Pigeon { /// [sdkPath] for specifying the Dart SDK path for /// [AnalysisContextCollection]. ParseResults parseFile(String inputPath, {String? sdkPath}) { - final List includedPaths = [ + final includedPaths = [ path.absolute(path.normalize(inputPath)), ]; - final AnalysisContextCollection collection = AnalysisContextCollection( + final collection = AnalysisContextCollection( includedPaths: includedPaths, sdkPath: sdkPath, ); - final List compilationErrors = []; - final RootBuilder rootBuilder = RootBuilder( + final compilationErrors = []; + final rootBuilder = RootBuilder( File(inputPath).readAsStringSync(), ); for (final AnalysisContext context in collection.contexts) { for (final String path in context.contextRoot.analyzedFiles()) { final AnalysisSession session = context.currentSession; - final ParsedUnitResult result = + final result = session.getParsedUnit(path) as ParsedUnitResult; if (result.diagnostics.isEmpty) { final dart_ast.CompilationUnit unit = result.unit; @@ -626,7 +626,7 @@ ${_argParser.usage}'''; // `configurePigeon` function. final ArgResults results = _argParser.parse(args); - final PigeonOptions opts = PigeonOptions( + final opts = PigeonOptions( input: results['input'] as String?, dartOut: results['dart_out'] as String?, dartTestOut: results['dart_test_out'] as String?, @@ -731,7 +731,7 @@ ${_argParser.usage}'''; parseResults = parseResults ?? pigeon.parseFile(options.input!, sdkPath: sdkPath); - final List errors = []; + final errors = []; errors.addAll(parseResults.errors); // Helper to clean up non-Stdout sinks. @@ -750,7 +750,7 @@ ${_argParser.usage}'''; final InternalPigeonOptions internalOptions = InternalPigeonOptions.fromPigeonOptions(options); - for (final GeneratorAdapter adapter in safeGeneratorAdapters) { + for (final adapter in safeGeneratorAdapters) { final IOSink? sink = adapter.shouldGenerate( internalOptions, FileType.source, @@ -780,7 +780,7 @@ ${_argParser.usage}'''; return 1; } - for (final GeneratorAdapter adapter in safeGeneratorAdapters) { + for (final adapter in safeGeneratorAdapters) { for (final FileType fileType in adapter.fileTypeList) { final IOSink? sink = adapter.shouldGenerate(internalOptions, fileType); if (sink != null) { @@ -796,7 +796,7 @@ ${_argParser.usage}'''; /// Print a list of errors to stderr. static void printErrors(List errors) { - for (final Error err in errors) { + for (final err in errors) { if (err.filename != null) { if (err.lineNumber != null) { stderr.writeln( diff --git a/packages/pigeon/lib/src/pigeon_lib_internal.dart b/packages/pigeon/lib/src/pigeon_lib_internal.dart index 7690f5696f5..de89dd3dc60 100644 --- a/packages/pigeon/lib/src/pigeon_lib_internal.dart +++ b/packages/pigeon/lib/src/pigeon_lib_internal.dart @@ -182,9 +182,9 @@ class InternalPigeonOptions { Iterable _lineReader(String path) sync* { final String contents = File(path).readAsStringSync(); - const LineSplitter lineSplitter = LineSplitter(); + const lineSplitter = LineSplitter(); final List lines = lineSplitter.convert(contents); - for (final String line in lines) { + for (final line in lines) { yield line; } } @@ -302,7 +302,7 @@ class DartGeneratorAdapter implements GeneratorAdapter { return; } - const DartGenerator generator = DartGenerator(); + const generator = DartGenerator(); generator.generate( options.dartOptions!, root, @@ -337,7 +337,7 @@ class DartTestGeneratorAdapter implements GeneratorAdapter { if (options.dartOptions == null) { return; } - const DartGenerator testGenerator = DartGenerator(); + const testGenerator = DartGenerator(); // The test code needs the actual package name of the Dart output, even if // the package name has been overridden for other uses. final String outputPackageName = @@ -390,12 +390,12 @@ class ObjcGeneratorAdapter implements GeneratorAdapter { if (options.objcOptions == null) { return; } - final OutputFileOptions outputFileOptions = + final outputFileOptions = OutputFileOptions( fileType: fileType, languageOptions: options.objcOptions!, ); - const ObjcGenerator generator = ObjcGenerator(); + const generator = ObjcGenerator(); generator.generate( outputFileOptions, root, @@ -421,7 +421,7 @@ class ObjcGeneratorAdapter implements GeneratorAdapter { @override List validate(InternalPigeonOptions options, Root root) { - final List errors = []; + final errors = []; _errorOnEventChannelApi(errors, languageString, root); _errorOnSealedClass(errors, languageString, root); _errorOnInheritedClass(errors, languageString, root); @@ -450,7 +450,7 @@ class JavaGeneratorAdapter implements GeneratorAdapter { if (options.javaOptions == null) { return; } - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( options.javaOptions!, root, @@ -465,7 +465,7 @@ class JavaGeneratorAdapter implements GeneratorAdapter { @override List validate(InternalPigeonOptions options, Root root) { - final List errors = []; + final errors = []; _errorOnEventChannelApi(errors, languageString, root); _errorOnSealedClass(errors, languageString, root); _errorOnInheritedClass(errors, languageString, root); @@ -494,7 +494,7 @@ class SwiftGeneratorAdapter implements GeneratorAdapter { if (options.swiftOptions == null) { return; } - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( options.swiftOptions!, root, @@ -537,12 +537,12 @@ class CppGeneratorAdapter implements GeneratorAdapter { if (options.cppOptions == null) { return; } - final OutputFileOptions outputFileOptions = + final outputFileOptions = OutputFileOptions( fileType: fileType, languageOptions: options.cppOptions!, ); - const CppGenerator generator = CppGenerator(); + const generator = CppGenerator(); generator.generate( outputFileOptions, root, @@ -568,7 +568,7 @@ class CppGeneratorAdapter implements GeneratorAdapter { @override List validate(InternalPigeonOptions options, Root root) { - final List errors = []; + final errors = []; _errorOnEventChannelApi(errors, languageString, root); _errorOnSealedClass(errors, languageString, root); _errorOnInheritedClass(errors, languageString, root); @@ -599,12 +599,12 @@ class GObjectGeneratorAdapter implements GeneratorAdapter { if (options.gobjectOptions == null) { return; } - final OutputFileOptions outputFileOptions = + final outputFileOptions = OutputFileOptions( fileType: fileType, languageOptions: options.gobjectOptions!, ); - const GObjectGenerator generator = GObjectGenerator(); + const generator = GObjectGenerator(); generator.generate( outputFileOptions, root, @@ -630,7 +630,7 @@ class GObjectGeneratorAdapter implements GeneratorAdapter { @override List validate(InternalPigeonOptions options, Root root) { - final List errors = []; + final errors = []; // TODO(tarrinneal): Remove once overflow class is added to gobject generator. // https://github.com/flutter/flutter/issues/152916 if (root.classes.length + root.enums.length > totalCustomCodecKeysAllowed) { @@ -667,7 +667,7 @@ class KotlinGeneratorAdapter implements GeneratorAdapter { if (options.kotlinOptions == null) { return; } - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( options.kotlinOptions!, root, @@ -710,7 +710,7 @@ extension _ObjectAs on Object { } List _validateAst(Root root, String source) { - final List result = []; + final result = []; final List customClasses = root.classes .map((Class x) => x.name) .toList(); @@ -808,7 +808,7 @@ List _validateAst(Root root, String source) { } } - bool containsEventChannelApi = false; + var containsEventChannelApi = false; for (final Api api in root.apis) { final String? matchingPrefix = _findMatchingPrefixOrNull( @@ -924,7 +924,7 @@ List _validateAst(Root root, String source) { } } if (method.swiftFunction.isNotEmpty) { - final RegExp signatureRegex = RegExp( + final signatureRegex = RegExp( '\\w+ *\\((\\w+:){${method.parameters.length}}\\)', ); if (!signatureRegex.hasMatch(method.swiftFunction)) { @@ -958,7 +958,7 @@ List _validateProxyApi( required Set customClasses, required Set proxyApis, }) { - final List result = []; + final result = []; bool isDataClass(NamedType type) => customClasses.contains(type.type.baseName); @@ -1008,7 +1008,7 @@ List _validateProxyApi( final Iterable interfaceNames = api.interfaces.map( (TypeDeclaration type) => type.baseName, ); - for (final String interfaceName in interfaceNames) { + for (final interfaceName in interfaceNames) { if (!proxyApis.any((AstProxyApi api) => api.name == interfaceName)) { result.add( Error( @@ -1023,7 +1023,7 @@ List _validateProxyApi( final bool hasRequiredFlutterMethod = api.flutterMethods.any( (Method method) => method.isRequired, ); - for (final AstProxyApi proxyApi in proxyApis) { + for (final proxyApi in proxyApis) { // Validate this api is not used as an attached field while either: // 1. Having an unattached field. // 2. Having a required Flutter method. @@ -1062,7 +1062,7 @@ List _validateProxyApi( final Iterable interfaceNames = proxyApi.interfaces.map( (TypeDeclaration type) => type.baseName, ); - for (final String interfaceName in interfaceNames) { + for (final interfaceName in interfaceNames) { if (interfaceName == api.name) { result.add( Error( @@ -1123,7 +1123,7 @@ List _validateProxyApi( } } if (constructor.swiftFunction.isNotEmpty) { - final RegExp signatureRegex = RegExp( + final signatureRegex = RegExp( '\\w+ *\\((\\w+:){${constructor.parameters.length}}\\)', ); if (!signatureRegex.hasMatch(constructor.swiftFunction)) { @@ -1238,7 +1238,7 @@ String? _findMatchingPrefixOrNull( String value, { required List prefixes, }) { - for (final String prefix in prefixes) { + for (final prefix in prefixes) { if (value.startsWith(prefix)) { return prefix; } @@ -1304,19 +1304,19 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { final Set referencedTypeNames = referencedTypes.keys .map((TypeDeclaration e) => e.baseName) .toSet(); - final List nonReferencedTypes = List.from(_classes); + final nonReferencedTypes = List.from(_classes); nonReferencedTypes.removeWhere( (Class x) => referencedTypeNames.contains(x.name), ); - for (final Class x in nonReferencedTypes) { + for (final x in nonReferencedTypes) { x.isReferenced = false; } - final List referencedEnums = List.from(_enums); - bool containsHostApi = false; - bool containsFlutterApi = false; - bool containsProxyApi = false; - bool containsEventChannel = false; + final referencedEnums = List.from(_enums); + var containsHostApi = false; + var containsFlutterApi = false; + var containsProxyApi = false; + var containsEventChannel = false; for (final Api api in _apis) { switch (api) { @@ -1331,7 +1331,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { } } - final Root completeRoot = Root( + final completeRoot = Root( apis: _apis, classes: _classes, enums: referencedEnums, @@ -1341,7 +1341,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { containsEventChannel: containsEventChannel, ); - final List totalErrors = List.from(_errors); + final totalErrors = List.from(_errors); for (final MapEntry> element in referencedTypes.entries) { @@ -1394,7 +1394,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { api.superClass = _attachAssociatedDefinition(api.superClass!); } - final Set newInterfaceSet = {}; + final newInterfaceSet = {}; for (final TypeDeclaration interface in api.interfaces) { newInterfaceSet.add(_attachAssociatedDefinition(interface)); } @@ -1433,7 +1433,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { type = type.copyWithProxyApi(assocProxyApi); } if (type.typeArguments.isNotEmpty) { - final List newTypes = []; + final newTypes = []; for (final TypeDeclaration type in type.typeArguments) { newTypes.add(_attachAssociatedDefinition(type)); } @@ -1444,7 +1444,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { } List _attachAssociatedDefinitions(Iterable types) { - final List result = []; + final result = []; for (final NamedType type in types) { result.add( type.copyWithType(_attachAssociatedDefinition(type.type)) as T, @@ -1469,7 +1469,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { Object _expressionToMap(dart_ast.Expression expression) { if (expression is dart_ast.MethodInvocation) { - final Map result = {}; + final result = {}; for (final dart_ast.Expression argument in expression.argumentList.arguments) { if (argument is dart_ast.NamedExpression) { @@ -1495,7 +1495,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { } else if (expression is dart_ast.SimpleIdentifier) { return expression.name; } else if (expression is dart_ast.ListLiteral) { - final List list = []; + final list = []; for (final dart_ast.CollectionElement element in expression.elements) { if (element is dart_ast.Expression) { list.add(_expressionToMap(element)); @@ -1510,7 +1510,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { } return list; } else if (expression is dart_ast.SetOrMapLiteral) { - final Set set = {}; + final set = {}; for (final dart_ast.CollectionElement element in expression.elements) { if (element is dart_ast.Expression) { set.add(_expressionToMap(element)); @@ -1561,7 +1561,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { ), ); } - final Map pigeonOptionsMap = + final pigeonOptionsMap = _expressionToMap(node.arguments!.arguments.first) as Map; _pigeonOptions = pigeonOptionsMap; @@ -1629,7 +1629,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { (dart_ast.Annotation element) => element.name.name == 'ProxyApi', ); - final Map annotationMap = {}; + final annotationMap = {}; for (final dart_ast.Expression expression in proxyApiAnnotation.arguments!.arguments) { if (expression is dart_ast.NamedExpression) { @@ -1639,7 +1639,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { } } - final String? superClassName = annotationMap['superClass'] as String?; + final superClassName = annotationMap['superClass'] as String?; TypeDeclaration? superClass; if (superClassName != null && node.extendsClause != null) { _errors.add( @@ -1661,7 +1661,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { ); } - final Set interfaces = {}; + final interfaces = {}; if (node.implementsClause != null) { for (final dart_ast.NamedType type in node.implementsClause!.interfaces) { @@ -1672,7 +1672,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { } SwiftProxyApiOptions? swiftOptions; - final Map? swiftOptionsMap = + final swiftOptionsMap = annotationMap['swiftOptions'] as Map?; if (swiftOptionsMap != null) { swiftOptions = SwiftProxyApiOptions( @@ -1706,7 +1706,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { tryParseApiRequirement(swiftOptions?.minMacosApi); KotlinProxyApiOptions? kotlinOptions; - final Map? kotlinOptionsMap = + final kotlinOptionsMap = annotationMap['kotlinOptions'] as Map?; if (kotlinOptionsMap != null) { kotlinOptions = KotlinProxyApiOptions( @@ -1734,7 +1734,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { element.name.name == 'EventChannelApi', ); - final Map annotationMap = {}; + final annotationMap = {}; for (final dart_ast.Expression expression in annotation.arguments!.arguments) { if (expression is dart_ast.NamedExpression) { @@ -1746,7 +1746,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { SwiftEventChannelOptions? swiftOptions; KotlinEventChannelOptions? kotlinOptions; - final Map? swiftOptionsMap = + final swiftOptionsMap = annotationMap['swiftOptions'] as Map?; if (swiftOptionsMap != null) { swiftOptions = SwiftEventChannelOptions( @@ -1754,7 +1754,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { swiftOptionsMap['includeSharedClasses'] as bool? ?? true, ); } - final Map? kotlinOptionsMap = + final kotlinOptionsMap = annotationMap['kotlinOptions'] as Map?; if (kotlinOptionsMap != null) { kotlinOptions = KotlinEventChannelOptions( @@ -1793,7 +1793,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { /// Converts Token's to Strings and removes documentation comment symbol. List _documentationCommentsParser(List? comments) { - const String docCommentPrefix = '///'; + const docCommentPrefix = '///'; return comments ?.map( (Token line) => line.length > docCommentPrefix.length @@ -1818,7 +1818,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { _getFirstChildOfType(formalParameter); if (parameter != null) { final String argTypeBaseName = _getNamedTypeQualifiedName(parameter); - final bool isNullable = parameter.question != null; + final isNullable = parameter.question != null; final List argTypeArguments = _typeAnnotationsToTypeArguments(parameter.typeArguments); return Parameter( @@ -1872,7 +1872,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { if (str == null) { return null; } - for (final T value in values) { + for (final value in values) { if (value.toString() == str) { return value; } @@ -1986,7 +1986,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { List _typeAnnotationsToTypeArguments( dart_ast.TypeArgumentList? typeArguments, ) { - final List result = []; + final result = []; if (typeArguments != null) { for (final Object x in typeArguments.childEntities) { if (x is dart_ast.NamedType) { @@ -2016,7 +2016,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { ), ); } else if (type is dart_ast.NamedType) { - final _FindInitializer findInitializerVisitor = _FindInitializer(); + final findInitializerVisitor = _FindInitializer(); node.visitChildren(findInitializerVisitor); if (findInitializerVisitor.initializer != null) { _errors.add( @@ -2029,7 +2029,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { } else { final dart_ast.TypeArgumentList? typeArguments = type.typeArguments; final String name = node.fields.variables[0].name.lexeme; - final NamedType field = NamedType( + final field = NamedType( type: TypeDeclaration( baseName: _getNamedTypeQualifiedName(type), isNullable: type.question != null, @@ -2200,7 +2200,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { ), ); } else if (type is dart_ast.NamedType) { - final _FindInitializer findInitializerVisitor = _FindInitializer(); + final findInitializerVisitor = _FindInitializer(); node.visitChildren(findInitializerVisitor); if (findInitializerVisitor.initializer != null) { _errors.add( @@ -2239,8 +2239,8 @@ int? _calculateLineNumberNullable(String contents, int? offset) { /// Calculates the line number for debugging. int calculateLineNumber(String contents, int offset) { - int result = 1; - for (int i = 0; i < offset; ++i) { + var result = 1; + for (var i = 0; i < offset; ++i) { if (contents[i] == '\n') { result += 1; } diff --git a/packages/pigeon/lib/src/swift/swift_generator.dart b/packages/pigeon/lib/src/swift/swift_generator.dart index 2f30a35fd4e..fe4da4cbd84 100644 --- a/packages/pigeon/lib/src/swift/swift_generator.dart +++ b/packages/pigeon/lib/src/swift/swift_generator.dart @@ -61,7 +61,7 @@ class SwiftOptions { /// Converts a [SwiftOptions] to a Map representation where: /// `x = SwiftOptions.fromList(x.toMap())`. Map toMap() { - final Map result = { + final result = { if (copyrightHeader != null) 'copyrightHeader': copyrightHeader!, if (fileSpecificClassNameComponent != null) 'fileSpecificClassNameComponent': fileSpecificClassNameComponent!, @@ -259,9 +259,9 @@ class SwiftGenerator extends StructuredGenerator { required String dartPackageName, }) { final String codecName = _getMessageCodecName(generatorOptions); - final String readerWriterName = '${codecName}ReaderWriter'; - final String readerName = '${codecName}Reader'; - final String writerName = '${codecName}Writer'; + final readerWriterName = '${codecName}ReaderWriter'; + final readerName = '${codecName}Reader'; + final writerName = '${codecName}Writer'; final List enumeratedTypes = getEnumeratedTypes( root, @@ -293,7 +293,7 @@ class SwiftGenerator extends StructuredGenerator { }); } - final EnumeratedType overflowClass = EnumeratedType( + final overflowClass = EnumeratedType( _overflowClassName, maximumCodecFieldKey, CustomTypes.customClass, @@ -319,7 +319,7 @@ class SwiftGenerator extends StructuredGenerator { indent.addScoped('{', '}', () { indent.write('switch type '); indent.addScoped('{', '}', nestCount: 0, () { - for (final EnumeratedType customType in enumeratedTypes) { + for (final customType in enumeratedTypes) { if (customType.enumeration < maximumCodecFieldKey) { writeDecodeLogic(customType); } @@ -344,14 +344,14 @@ class SwiftGenerator extends StructuredGenerator { indent.write('override func writeValue(_ value: Any) '); indent.addScoped('{', '}', () { indent.write(''); - for (final EnumeratedType customType in enumeratedTypes) { + for (final customType in enumeratedTypes) { indent.add('if let value = value as? ${customType.name} '); indent.addScoped('{', '} else ', () { - final String encodeString = + final encodeString = customType.type == CustomTypes.customClass ? 'toList()' : 'rawValue'; - final String valueString = + final valueString = customType.enumeration < maximumCodecFieldKey ? 'value.$encodeString' : 'wrap.toList()'; @@ -421,8 +421,8 @@ class SwiftGenerator extends StructuredGenerator { bool private = false, bool hashable = true, }) { - final String privateString = private ? 'private ' : ''; - final String extendsString = classDefinition.superClass != null + final privateString = private ? 'private ' : ''; + final extendsString = classDefinition.superClass != null ? ': ${classDefinition.superClass!.name}' : hashable ? ': Hashable' @@ -448,7 +448,7 @@ class SwiftGenerator extends StructuredGenerator { _writeClassInit(indent, fields.toList()); } - for (final NamedType field in fields) { + for (final field in fields) { addDocumentationComments( indent, field.documentationComments, @@ -468,19 +468,19 @@ class SwiftGenerator extends StructuredGenerator { List types, { required String dartPackageName, }) { - final NamedType overflowInt = NamedType( + final overflowInt = NamedType( name: 'type', type: const TypeDeclaration(baseName: 'Int', isNullable: false), ); - final NamedType overflowObject = NamedType( + final overflowObject = NamedType( name: 'wrapped', type: const TypeDeclaration(baseName: 'Object', isNullable: true), ); - final List overflowFields = [ + final overflowFields = [ overflowInt, overflowObject, ]; - final Class overflowClass = Class( + final overflowClass = Class( name: _overflowClassName, fields: overflowFields, ); @@ -556,7 +556,7 @@ if (wrapped == nil) { Class classDefinition, { required String dartPackageName, }) { - final List generatedComments = [ + final generatedComments = [ ' Generated class from Pigeon that represents data sent in messages.', ]; if (classDefinition.isSealed) { @@ -603,7 +603,7 @@ if (wrapped == nil) { void _writeClassInit(Indent indent, List fields) { indent.writeScoped('init(', ')', () { - for (int i = 0; i < fields.length; i++) { + for (var i = 0; i < fields.length; i++) { indent.write(''); _writeClassField(indent, fields[i]); if (i == fields.length - 1) { @@ -614,7 +614,7 @@ if (wrapped == nil) { } }, addTrailingNewline: false); indent.addScoped(' {', '}', () { - for (final NamedType field in fields) { + for (final field in fields) { _writeClassFieldInit(indent, field); } }); @@ -622,7 +622,7 @@ if (wrapped == nil) { void _writeClassField(Indent indent, NamedType field, {bool addNil = true}) { indent.add('${field.name}: ${_nullSafeSwiftTypeForDartType(field.type)}'); - final String defaultNil = field.type.isNullable && addNil ? ' = nil' : ''; + final defaultNil = field.type.isNullable && addNil ? ' = nil' : ''; indent.add(defaultNil); } @@ -644,7 +644,7 @@ if (wrapped == nil) { indent.addScoped('[', ']', () { // Follow swift-format style, which is to use a trailing comma unless // there is only one element. - final String separator = classDefinition.fields.length > 1 ? ',' : ''; + final separator = classDefinition.fields.length > 1 ? ',' : ''; for (final NamedType field in getFieldsInSerializationOrder( classDefinition, )) { @@ -703,7 +703,7 @@ if (wrapped == nil) { int index, final NamedType field, ) { - final String listValue = '${varNamePrefix}list[$index]'; + final listValue = '${varNamePrefix}list[$index]'; _writeGenericCasting( indent: indent, @@ -720,13 +720,13 @@ if (wrapped == nil) { for (final NamedType field in getFieldsInSerializationOrder( classDefinition, )) { - final String comma = + final comma = getFieldsInSerializationOrder(classDefinition).last == field ? '' : ','; // Force-casting nullable enums in maps doesn't work the same as other types. // It needs soft-casting followed by force unwrapping. - final String forceUnwrapMapWithNullableEnums = + final forceUnwrapMapWithNullableEnums = (field.type.baseName == 'Map' && !field.type.isNullable && field.type.typeArguments.any( @@ -779,7 +779,7 @@ if (wrapped == nil) { AstFlutterApi api, { required String dartPackageName, }) { - const List generatedComments = [ + const generatedComments = [ ' Generated protocol from Pigeon that represents Flutter messages that can be called from Swift.', ]; addDocumentationComments( @@ -864,7 +864,7 @@ if (wrapped == nil) { }) { final String apiName = api.name; - const List generatedComments = [ + const generatedComments = [ ' Generated protocol from Pigeon that represents a handler of messages from Flutter.', ]; addDocumentationComments( @@ -970,7 +970,7 @@ if (wrapped == nil) { Indent indent, { required String dartPackageName, }) { - final String instanceManagerApiName = + final instanceManagerApiName = '${swiftInstanceManagerClassName(generatorOptions)}Api'; final String removeStrongReferenceName = @@ -1010,7 +1010,7 @@ if (wrapped == nil) { indent.writeln( 'let codec = ${_getMessageCodecName(generatorOptions)}.shared', ); - const String setHandlerCondition = + const setHandlerCondition = 'let instanceManager = instanceManager'; _writeHostMethodMessageHandler( indent, @@ -1154,7 +1154,7 @@ if (wrapped == nil) { indent.newln(); indent.writeScoped('override func writeValue(_ value: Any) {', '}', () { - final List nonProxyApiTypes = [ + final nonProxyApiTypes = [ '[Any]', 'Bool', 'Data', @@ -1206,7 +1206,7 @@ if (wrapped == nil) { ); enumerate(sortedApis, (int index, AstProxyApi api) { - final TypeDeclaration apiAsTypeDecl = TypeDeclaration( + final apiAsTypeDecl = TypeDeclaration( baseName: api.name, isNullable: false, associatedProxyApi: api, @@ -1278,15 +1278,15 @@ if (wrapped == nil) { AstProxyApi api, { required String dartPackageName, }) { - final TypeDeclaration apiAsTypeDeclaration = TypeDeclaration( + final apiAsTypeDeclaration = TypeDeclaration( baseName: api.name, isNullable: false, associatedProxyApi: api, ); - final String swiftApiDelegateName = + final swiftApiDelegateName = '${hostProxyApiPrefix}Delegate${api.name}'; - final String type = api.hasMethodsRequiringImplementation() + final type = api.hasMethodsRequiringImplementation() ? 'protocol' : 'open class'; indent.writeScoped('$type $swiftApiDelegateName {', '}', () { @@ -1315,7 +1315,7 @@ if (wrapped == nil) { }); indent.newln(); - final String swiftApiProtocolName = + final swiftApiProtocolName = '${hostProxyApiPrefix}Protocol${api.name}'; indent.writeScoped('protocol $swiftApiProtocolName {', '}', () { _writeProxyApiFlutterMethods( @@ -1329,7 +1329,7 @@ if (wrapped == nil) { }); indent.newln(); - final String swiftApiName = '$hostProxyApiPrefix${api.name}'; + final swiftApiName = '$hostProxyApiPrefix${api.name}'; indent.writeScoped( 'final class $swiftApiName: $swiftApiProtocolName {', '}', @@ -1714,10 +1714,10 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has (MapEntry e) => getEnumSafeArgumentExpression(e.key, e.value), ); - final String sendArgument = parameters.isEmpty + final sendArgument = parameters.isEmpty ? 'nil' : '[${enumSafeArgNames.join(', ')}] as [Any?]'; - const String channel = 'channel'; + const channel = 'channel'; indent.writeln('let channelName: String = "$channelName"'); indent.writeln( 'let $channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec)', @@ -1763,7 +1763,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has type: returnType, ); // There is a swift bug with unwrapping maps of nullable Enums; - final String enumMapForceUnwrap = + final enumMapForceUnwrap = returnType.baseName == 'Map' && returnType.typeArguments.any( (TypeDeclaration type) => type.isEnum, @@ -1790,16 +1790,16 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has String Function(List safeArgNames, {required String apiVarName})? onCreateCall, }) { - final _SwiftFunctionComponents components = _SwiftFunctionComponents( + final components = _SwiftFunctionComponents( name: name, parameters: parameters, returnType: returnType, swiftFunction: swiftFunction, ); - final String varChannelName = '${name}Channel'; + final varChannelName = '${name}Channel'; addDocumentationComments(indent, documentationComments, _docCommentSpec); - final String baseArgs = + final baseArgs = 'name: "$channelName", ' 'binaryMessenger: binaryMessenger, codec: codec'; // The version with taskQueue: is an optional protocol method that isn't @@ -1809,12 +1809,12 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has // queue variable not being nil because the earlier code to set it will // return nil on macOS where the optional parts of the protocol are not // implemented. - final String channelCreationWithoutTaskQueue = + final channelCreationWithoutTaskQueue = 'FlutterBasicMessageChannel($baseArgs)'; if (serialBackgroundQueue == null) { indent.writeln('let $varChannelName = $channelCreationWithoutTaskQueue'); } else { - final String channelCreationWithTaskQueue = + final channelCreationWithTaskQueue = 'FlutterBasicMessageChannel($baseArgs, taskQueue: $serialBackgroundQueue)'; indent.write('let $varChannelName = $serialBackgroundQueue == nil'); @@ -1827,9 +1827,9 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has indent.write('if $setHandlerCondition '); indent.addScoped('{', '}', () { indent.write('$varChannelName.setMessageHandler '); - final String messageVarName = parameters.isNotEmpty ? 'message' : '_'; + final messageVarName = parameters.isNotEmpty ? 'message' : '_'; indent.addScoped('{ $messageVarName, reply in', '}', () { - final List methodArgument = []; + final methodArgument = []; if (components.arguments.isNotEmpty) { indent.writeln('let args = message as! [Any?]'); enumerate(components.arguments, ( @@ -1837,10 +1837,10 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has _SwiftFunctionArgument arg, ) { final String argName = _getSafeArgumentName(index, arg.namedType); - final String argIndex = 'args[$index]'; + final argIndex = 'args[$index]'; final String fieldType = _swiftTypeForDartType(arg.type); // There is a swift bug with unwrapping maps of nullable Enums; - final String enumMapForceUnwrap = + final enumMapForceUnwrap = arg.type.baseName == 'Map' && arg.type.typeArguments.any( (TypeDeclaration type) => type.isEnum, @@ -1865,12 +1865,12 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has } }); } - final String tryStatement = isAsynchronous ? '' : 'try '; + final tryStatement = isAsynchronous ? '' : 'try '; late final String call; if (onCreateCall == null) { // Empty parens are not required when calling a method whose only // argument is a trailing closure. - final String argumentString = methodArgument.isEmpty && isAsynchronous + final argumentString = methodArgument.isEmpty && isAsynchronous ? '' : '(${methodArgument.join(', ')})'; call = '${tryStatement}api.${components.name}$argumentString'; @@ -1878,8 +1878,8 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has call = onCreateCall(methodArgument, apiVarName: 'api'); } if (isAsynchronous) { - final String resultName = returnType.isVoid ? 'nil' : 'res'; - final String successVariableInit = returnType.isVoid + final resultName = returnType.isVoid ? 'nil' : 'res'; + final successVariableInit = returnType.isVoid ? '' : '(let res)'; indent.write('$call '); @@ -1924,11 +1924,11 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has required InternalSwiftOptions generatorOptions, required Iterable allProxyApis, }) { - final String delegateName = + final delegateName = '${generatorOptions.fileSpecificClassNameComponent ?? ''}${proxyApiClassNamePrefix}ProxyApiDelegate'; indent.writeScoped('protocol $delegateName {', '}', () { - for (final AstProxyApi api in allProxyApis) { - final String hostApiName = '$hostProxyApiPrefix${api.name}'; + for (final api in allProxyApis) { + final hostApiName = '$hostProxyApiPrefix${api.name}'; addDocumentationComments(indent, [ ' An implementation of [$hostApiName] used to add a new Dart instance of', ' `${api.name}` to the Dart `InstanceManager` and make calls to Dart.', @@ -1947,9 +1947,9 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has .where((AstProxyApi api) => !api.hasMethodsRequiringImplementation()); if (apisThatCanHaveADefaultImpl.isNotEmpty) { indent.writeScoped('extension $delegateName {', '}', () { - for (final AstProxyApi api in apisThatCanHaveADefaultImpl) { - final String hostApiName = '$hostProxyApiPrefix${api.name}'; - final String swiftApiDelegateName = + for (final api in apisThatCanHaveADefaultImpl) { + final hostApiName = '$hostProxyApiPrefix${api.name}'; + final swiftApiDelegateName = '${hostProxyApiPrefix}Delegate${api.name}'; indent.format(''' func pigeonApi${api.name}(_ registrar: ${proxyApiRegistrarName(generatorOptions)}) -> $hostApiName { @@ -1960,7 +1960,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has indent.newln(); } - final String instanceManagerApiName = + final instanceManagerApiName = '${swiftInstanceManagerClassName(generatorOptions)}Api'; indent.writeScoped( @@ -2019,7 +2019,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has indent.writeln( '$instanceManagerApiName.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: instanceManager)', ); - for (final AstProxyApi api in allProxyApis) { + for (final api in allProxyApis) { if (api.hasAnyHostMessageCalls()) { indent.writeln( '$hostProxyApiPrefix${api.name}.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApi${api.name}(self))', @@ -2032,7 +2032,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has indent.writeln( '$instanceManagerApiName.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: nil)', ); - for (final AstProxyApi api in allProxyApis) { + for (final api in allProxyApis) { if (api.hasAnyHostMessageCalls()) { indent.writeln( '$hostProxyApiPrefix${api.name}.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil)', @@ -2052,7 +2052,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has required TypeDeclaration apiAsTypeDeclaration, }) { for (final Constructor constructor in api.constructors) { - final List allReferencedTypes = [ + final allReferencedTypes = [ apiAsTypeDeclaration, ...api.unattachedFields.map((ApiField field) => field.type), ...constructor.parameters.map((Parameter parameter) => parameter.type), @@ -2113,7 +2113,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has required TypeDeclaration apiAsTypeDeclaration, }) { for (final ApiField field in api.attachedFields) { - final List allReferencedTypes = [ + final allReferencedTypes = [ apiAsTypeDeclaration, field.type, ]; @@ -2169,7 +2169,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has required TypeDeclaration apiAsTypeDeclaration, }) { for (final ApiField field in api.unattachedFields) { - final List allReferencedTypes = [ + final allReferencedTypes = [ apiAsTypeDeclaration, field.type, ]; @@ -2225,7 +2225,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has required TypeDeclaration apiAsTypeDeclaration, }) { for (final Method method in api.hostMethods) { - final List allReferencedTypes = [ + final allReferencedTypes = [ if (!method.isStatic) apiAsTypeDeclaration, method.returnType, ...method.parameters.map((Parameter p) => p.type), @@ -2281,11 +2281,11 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has // // These are used for inherited Flutter methods. void _writeProxyApiInheritedApiMethods(Indent indent, AstProxyApi api) { - final Set inheritedApiNames = { + final inheritedApiNames = { if (api.superClass != null) api.superClass!.baseName, ...api.interfaces.map((TypeDeclaration type) => type.baseName), }; - for (final String name in inheritedApiNames) { + for (final name in inheritedApiNames) { addDocumentationComments(indent, [ 'An implementation of [$name] used to access callback methods', ], _docCommentSpec); @@ -2345,7 +2345,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has addTrailingNewline: false, ); indent.writeScoped(' else {', '}', () { - final String varChannelName = '${methodName}Channel'; + final varChannelName = '${methodName}Channel'; indent.format(''' let $varChannelName = FlutterBasicMessageChannel( name: "$channelName", @@ -2402,7 +2402,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has List methodParameters, { required String apiVarName, }) { - final List parameters = [ + final parameters = [ 'pigeonApi: $apiVarName', // Skip the identifier used by the InstanceManager. ...methodParameters.skip(1), @@ -2452,7 +2452,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has List methodParameters, { required String apiVarName, }) { - final String instanceArg = field.isStatic + final instanceArg = field.isStatic ? '' : ', pigeonInstance: pigeonInstanceArg'; return '$apiVarName.pigeonRegistrar.instanceManager.addDartCreatedInstance(' @@ -2505,10 +2505,10 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has List methodParameters, { required String apiVarName, }) { - final String tryStatement = method.isAsynchronous + final tryStatement = method.isAsynchronous ? '' : 'try '; - final List parameters = [ + final parameters = [ 'pigeonApi: $apiVarName', // Skip the identifier used by the InstanceManager. ...methodParameters, @@ -2541,7 +2541,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has required String newInstanceMethodName, required String dartPackageName, }) { - final List allReferencedTypes = [ + final allReferencedTypes = [ apiAsTypeDeclaration, ...api.unattachedFields.map((ApiField field) => field.type), ]; @@ -2655,7 +2655,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has bool writeBody = true, }) { for (final Method method in api.flutterMethods) { - final List allReferencedTypes = [ + final allReferencedTypes = [ apiAsTypeDeclaration, ...method.parameters.map((Parameter parameter) => parameter.type), method.returnType, @@ -2764,9 +2764,9 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has } void _writeProxyApiImports(Indent indent, Iterable apis) { - final Map> apisOfImports = + final apisOfImports = >{}; - for (final AstProxyApi proxyApi in apis) { + for (final proxyApi in apis) { final String? import = proxyApi.swiftOptions?.import; if (import != null) { if (apisOfImports.containsKey(import)) { @@ -2780,7 +2780,7 @@ func deepHash${generatorOptions.fileSpecificClassNameComponent}(value: Any?, has for (final String import in apisOfImports.keys) { // If every ProxyApi that shares an import excludes a platform for // support, surround the import with `#if !os(...) #endif`. - final List unsupportedPlatforms = [ + final unsupportedPlatforms = [ if (!apisOfImports[import]!.any( (AstProxyApi api) => api.swiftOptions?.supportsIos ?? true, )) @@ -2846,7 +2846,7 @@ String? _tryGetAvailabilityAnnotation(Iterable types) { final ({_VersionRequirement? ios, _VersionRequirement? macos}) versionRequirement = _findHighestVersionRequirement(types); - final List apis = [ + final apis = [ if (versionRequirement.ios != null) 'iOS ${versionRequirement.ios!.version}', if (versionRequirement.macos != null) @@ -2876,7 +2876,7 @@ String? _tryGetUnsupportedPlatformsCondition(Iterable types) { addAllRecursive, ); - final List unsupportedPlatforms = [ + final unsupportedPlatforms = [ if (!allReferencedTypes.every((TypeDeclaration type) { return type.associatedProxyApi?.swiftOptions?.supportsIos ?? true; })) @@ -2954,7 +2954,7 @@ String? _swiftTypeForBuiltinDartType( TypeDeclaration type, { bool mapKey = false, }) { - const Map swiftTypeForDartTypeMap = { + const swiftTypeForDartTypeMap = { 'void': 'Void', 'bool': 'Bool', 'String': 'String', @@ -2997,7 +2997,7 @@ String _nullSafeSwiftTypeForDartType( TypeDeclaration type, { bool mapKey = false, }) { - final String nullSafe = type.isNullable ? '?' : ''; + final nullSafe = type.isNullable ? '?' : ''; return '${_swiftTypeForDartType(type, mapKey: mapKey)}$nullSafe'; } @@ -3011,7 +3011,7 @@ String _getMethodSignature({ String Function(int index, NamedType argument) getParameterName = _getArgumentName, }) { - final _SwiftFunctionComponents components = _SwiftFunctionComponents( + final components = _SwiftFunctionComponents( name: name, parameters: parameters, returnType: returnType, @@ -3105,7 +3105,7 @@ class _SwiftFunctionComponents { } final String argsExtractor = repeat(r'(\w+):', parameters.length).join(); - final RegExp signatureRegex = RegExp(r'(\w+) *\(' + argsExtractor + r'\)'); + final signatureRegex = RegExp(r'(\w+) *\(' + argsExtractor + r'\)'); final RegExpMatch match = signatureRegex.firstMatch(swiftFunction)!; final Iterable labels = match diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart index 416a524673c..c61681e7546 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart @@ -47,7 +47,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { group('Host sync API tests', () { testWidgets('basic void->void call works', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect(api.noop(), completes); }); @@ -55,7 +55,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('all datatypes serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllTypes echoObject = await api.echoAllTypes(genericAllTypes); expect(echoObject, genericAllTypes); @@ -64,7 +64,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('all nullable datatypes serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllNullableTypes? echoObject = await api.echoAllNullableTypes( recursiveAllNullableTypes, @@ -76,9 +76,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('all null datatypes serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - final AllNullableTypes allTypesNull = AllNullableTypes(); + final allTypesNull = AllNullableTypes(); final AllNullableTypes? echoNullFilledClass = await api .echoAllNullableTypes(allTypesNull); @@ -88,9 +88,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Classes with list of null serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - final AllNullableTypes listTypes = AllNullableTypes( + final listTypes = AllNullableTypes( list: ['String', null], ); @@ -104,9 +104,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Classes with map of null serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - final AllNullableTypes listTypes = AllNullableTypes( + final listTypes = AllNullableTypes( map: {'String': 'string', 'null': null}, ); @@ -120,7 +120,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'all nullable datatypes without recursion serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllNullableTypesWithoutRecursion? echoObject = await api .echoAllNullableTypesWithoutRecursion( @@ -134,9 +134,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'all null datatypes without recursion serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - final AllNullableTypesWithoutRecursion allTypesNull = + final allTypesNull = AllNullableTypesWithoutRecursion(); final AllNullableTypesWithoutRecursion? echoNullFilledClass = await api @@ -148,9 +148,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Classes without recursion with list of null serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - final AllNullableTypesWithoutRecursion listTypes = + final listTypes = AllNullableTypesWithoutRecursion(list: ['String', null]); final AllNullableTypesWithoutRecursion? echoNullFilledClass = await api @@ -163,9 +163,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Classes without recursion with map of null serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - final AllNullableTypesWithoutRecursion listTypes = + final listTypes = AllNullableTypesWithoutRecursion( map: {'String': 'string', 'null': null}, ); @@ -178,7 +178,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { ); testWidgets('errors are returned correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect(() async { await api.throwError(); @@ -188,7 +188,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('errors are returned from void methods correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect(() async { await api.throwErrorFromVoid(); @@ -198,7 +198,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('flutter errors are returned correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect( () => api.throwFlutterError(), @@ -213,7 +213,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { }); testWidgets('nested objects can be sent correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllClassesWrapper classWrapper = classWrapperMaker(); final String? receivedString = await api.extractNestedNullableString( classWrapper, @@ -224,9 +224,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nested objects can be received correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const String sentString = 'Some string'; + const sentString = 'Some string'; final AllClassesWrapper receivedObject = await api .createNestedNullableString(sentString); expect(receivedObject.allNullableTypes.aNullableString, sentString); @@ -235,7 +235,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nested classes can serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllClassesWrapper classWrapper = classWrapperMaker(); final AllClassesWrapper receivedClassWrapper = await api.echoClassWrapper( @@ -247,7 +247,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nested null classes can serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllClassesWrapper classWrapper = classWrapperMaker(); classWrapper.allTypes = null; @@ -261,9 +261,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Arguments of multiple types serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - const String aNullableString = 'this is a String'; - const bool aNullableBool = false; + final api = HostIntegrationCoreApi(); + const aNullableString = 'this is a String'; + const aNullableBool = false; const int aNullableInt = regularInt; final AllNullableTypes echoObject = await api.sendMultipleNullableTypes( @@ -280,7 +280,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Arguments of multiple null types serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllNullableTypes echoNullFilledClass = await api .sendMultipleNullableTypes(null, null, null); @@ -293,9 +293,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Arguments of multiple types serialize and deserialize correctly (WithoutRecursion)', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - const String aNullableString = 'this is a String'; - const bool aNullableBool = false; + final api = HostIntegrationCoreApi(); + const aNullableString = 'this is a String'; + const aNullableBool = false; const int aNullableInt = regularInt; final AllNullableTypesWithoutRecursion echoObject = await api @@ -313,7 +313,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Arguments of multiple null types serialize and deserialize correctly (WithoutRecursion)', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllNullableTypesWithoutRecursion echoNullFilledClass = await api .sendMultipleNullableTypesWithoutRecursion(null, null, null); @@ -326,7 +326,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Int serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentInt = regularInt; final int receivedInt = await api.echoInt(sentInt); expect(receivedInt, sentInt); @@ -335,7 +335,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Int64 serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentInt = biggerThanBigInt; final int receivedInt = await api.echoInt(sentInt); @@ -345,9 +345,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Doubles serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const double sentDouble = 2.0694; + const sentDouble = 2.0694; final double receivedDouble = await api.echoDouble(sentDouble); expect(receivedDouble, sentDouble); }); @@ -355,9 +355,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('booleans serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - for (final bool sentBool in [true, false]) { + for (final sentBool in [true, false]) { final bool receivedBool = await api.echoBool(sentBool); expect(receivedBool, sentBool); } @@ -366,8 +366,8 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('strings serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - const String sentString = 'default'; + final api = HostIntegrationCoreApi(); + const sentString = 'default'; final String receivedString = await api.echoString(sentString); expect(receivedString, sentString); }); @@ -375,8 +375,8 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Uint8List serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - final List data = [ + final api = HostIntegrationCoreApi(); + final data = [ 102, 111, 114, @@ -388,7 +388,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { 111, 0, ]; - final Uint8List sentUint8List = Uint8List.fromList(data); + final sentUint8List = Uint8List.fromList(data); final Uint8List receivedUint8List = await api.echoUint8List( sentUint8List, ); @@ -398,7 +398,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('generic Objects serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const Object sentString = "I'm a computer"; final Object receivedString = await api.echoObject(sentString); expect(receivedString, sentString); @@ -412,7 +412,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api.echoList(list); expect(listEquals(echoObject, list), true); @@ -421,7 +421,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enum lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api.echoEnumList(enumList); expect(listEquals(echoObject, enumList), true); @@ -430,7 +430,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('class lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api.echoClassList( allNullableTypesList, @@ -443,7 +443,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull enum lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api.echoNonNullEnumList( nonNullEnumList, @@ -454,7 +454,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull class lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api.echoNonNullClassList( nonNullAllNullableTypesList, @@ -467,7 +467,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoMap(map); expect(mapEquals(echoObject, map), true); }); @@ -475,7 +475,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('string maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoStringMap( stringMap, ); @@ -485,7 +485,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('int maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoIntMap(intMap); expect(mapEquals(echoObject, intMap), true); }); @@ -493,7 +493,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enum maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoEnumMap(enumMap); expect(mapEquals(echoObject, enumMap), true); }); @@ -501,7 +501,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('class maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoClassMap( allNullableTypesMap, ); @@ -514,7 +514,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull string maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoNonNullStringMap( nonNullStringMap, ); @@ -524,7 +524,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull int maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoNonNullIntMap( nonNullIntMap, ); @@ -534,7 +534,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull enum maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoNonNullEnumMap( nonNullEnumMap, ); @@ -544,7 +544,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull class maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api .echoNonNullClassMap(nonNullAllNullableTypesMap); for (final MapEntry entry in echoObject.entries) { @@ -555,7 +555,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.two; final AnEnum receivedEnum = await api.echoEnum(sentEnum); @@ -565,7 +565,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enums serialize and deserialize correctly (again)', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnotherEnum sentEnum = AnotherEnum.justInCase; final AnotherEnum receivedEnum = await api.echoAnotherEnum(sentEnum); @@ -575,7 +575,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('multi word enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.fortyTwo; final AnEnum receivedEnum = await api.echoEnum(sentEnum); @@ -583,7 +583,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { }); testWidgets('required named parameter', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); // This number corresponds with the default value of this method. const int sentInt = regularInt; final int receivedInt = await api.echoRequiredInt(anInt: sentInt); @@ -591,18 +591,18 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { }); testWidgets('optional default parameter no arg', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); // This number corresponds with the default value of this method. - const double sentDouble = 3.14; + const sentDouble = 3.14; final double receivedDouble = await api.echoOptionalDefaultDouble(); expect(receivedDouble, sentDouble); }); testWidgets('optional default parameter with arg', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const double sentDouble = 3.15; + const sentDouble = 3.15; final double receivedDouble = await api.echoOptionalDefaultDouble( sentDouble, ); @@ -610,17 +610,17 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { }); testWidgets('named default parameter no arg', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); // This string corresponds with the default value of this method. - const String sentString = 'default'; + const sentString = 'default'; final String receivedString = await api.echoNamedDefaultString(); expect(receivedString, sentString); }); testWidgets('named default parameter with arg', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); // This string corresponds with the default value of this method. - const String sentString = 'notDefault'; + const sentString = 'notDefault'; final String receivedString = await api.echoNamedDefaultString( aString: sentString, ); @@ -630,7 +630,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Nullable Int serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentInt = regularInt; final int? receivedInt = await api.echoNullableInt(sentInt); @@ -640,7 +640,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Nullable Int64 serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentInt = biggerThanBigInt; final int? receivedInt = await api.echoNullableInt(sentInt); @@ -650,7 +650,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Null Ints serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final int? receivedNullInt = await api.echoNullableInt(null); expect(receivedNullInt, null); @@ -659,9 +659,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Nullable Doubles serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const double sentDouble = 2.0694; + const sentDouble = 2.0694; final double? receivedDouble = await api.echoNullableDouble(sentDouble); expect(receivedDouble, sentDouble); }); @@ -669,7 +669,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Null Doubles serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final double? receivedNullDouble = await api.echoNullableDouble(null); expect(receivedNullDouble, null); @@ -678,9 +678,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Nullable booleans serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - for (final bool? sentBool in [true, false]) { + for (final sentBool in [true, false]) { final bool? receivedBool = await api.echoNullableBool(sentBool); expect(receivedBool, sentBool); } @@ -689,7 +689,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Null booleans serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const bool? sentBool = null; final bool? receivedBool = await api.echoNullableBool(sentBool); @@ -699,8 +699,8 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Nullable strings serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - const String sentString = "I'm a computer"; + final api = HostIntegrationCoreApi(); + const sentString = "I'm a computer"; final String? receivedString = await api.echoNullableString(sentString); expect(receivedString, sentString); }); @@ -708,7 +708,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Null strings serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final String? receivedNullString = await api.echoNullableString(null); expect(receivedNullString, null); @@ -717,8 +717,8 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Nullable Uint8List serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - final List data = [ + final api = HostIntegrationCoreApi(); + final data = [ 102, 111, 114, @@ -730,7 +730,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { 111, 0, ]; - final Uint8List sentUint8List = Uint8List.fromList(data); + final sentUint8List = Uint8List.fromList(data); final Uint8List? receivedUint8List = await api.echoNullableUint8List( sentUint8List, ); @@ -740,7 +740,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Null Uint8List serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Uint8List? receivedNullUint8List = await api.echoNullableUint8List( null, @@ -751,7 +751,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'generic nullable Objects serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const Object sentString = "I'm a computer"; final Object? receivedString = await api.echoNullableObject(sentString); expect(receivedString, sentString); @@ -766,7 +766,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Null generic Objects serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Object? receivedNullObject = await api.echoNullableObject(null); expect(receivedNullObject, null); @@ -775,7 +775,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api.echoNullableList(list); expect(listEquals(echoObject, list), true); @@ -784,7 +784,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enum lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api.echoNullableEnumList( enumList, @@ -795,7 +795,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api .echoNullableClassList(allNullableTypesList); @@ -807,7 +807,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable NonNull enum lists serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api.echoNullableNonNullEnumList( nonNullEnumList, @@ -819,7 +819,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable NonNull lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api .echoNullableClassList(nonNullAllNullableTypesList); @@ -831,7 +831,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoNullableMap(map); expect(mapEquals(echoObject, map), true); }); @@ -839,7 +839,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable string maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoNullableStringMap( stringMap, ); @@ -849,7 +849,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable int maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoNullableIntMap(intMap); expect(mapEquals(echoObject, intMap), true); }); @@ -857,7 +857,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enum maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoNullableEnumMap( enumMap, ); @@ -867,7 +867,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable class maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .echoNullableClassMap(allNullableTypesMap); for (final MapEntry entry @@ -879,7 +879,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable NonNull string maps serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .echoNullableNonNullStringMap(nonNullStringMap); expect(mapEquals(echoObject, nonNullStringMap), true); @@ -889,7 +889,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable NonNull int maps serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoNullableNonNullIntMap( nonNullIntMap, ); @@ -900,7 +900,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable NonNull enum maps serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .echoNullableNonNullEnumMap(nonNullEnumMap); expect(mapEquals(echoObject, nonNullEnumMap), true); @@ -910,7 +910,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable NonNull class maps serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .echoNullableNonNullClassMap(nonNullAllNullableTypesMap); for (final MapEntry entry @@ -923,7 +923,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.three; final AnEnum? echoEnum = await api.echoNullableEnum(sentEnum); @@ -933,7 +933,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enums serialize and deserialize correctly (again)', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnotherEnum sentEnum = AnotherEnum.justInCase; final AnotherEnum? echoEnum = await api.echoAnotherNullableEnum(sentEnum); @@ -943,7 +943,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'multi word nullable enums serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.fourHundredTwentyTwo; final AnEnum? echoEnum = await api.echoNullableEnum(sentEnum); @@ -954,7 +954,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api.echoNullableList(null); expect(listEquals(echoObject, null), true); @@ -963,7 +963,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoNullableMap(null); expect(mapEquals(echoObject, null), true); @@ -972,7 +972,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null string maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoNullableStringMap( null, @@ -983,7 +983,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null int maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoNullableIntMap(null); expect(mapEquals(echoObject, null), true); @@ -992,7 +992,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum? sentEnum = null; final AnEnum? echoEnum = await api.echoNullableEnum(sentEnum); @@ -1002,7 +1002,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null enums serialize and deserialize correctly (again)', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnotherEnum? sentEnum = null; final AnotherEnum? echoEnum = await api.echoAnotherNullableEnum(sentEnum); @@ -1012,7 +1012,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null classes serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllNullableTypes? echoObject = await api.echoAllNullableTypes(null); @@ -1020,7 +1020,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { }); testWidgets('optional nullable parameter', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentInt = regularInt; final int? receivedInt = await api.echoOptionalNullableInt(sentInt); @@ -1028,15 +1028,15 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { }); testWidgets('Null optional nullable parameter', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final int? receivedNullInt = await api.echoOptionalNullableInt(); expect(receivedNullInt, null); }); testWidgets('named nullable parameter', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - const String sentString = "I'm a computer"; + final api = HostIntegrationCoreApi(); + const sentString = "I'm a computer"; final String? receivedString = await api.echoNamedNullableString( aNullableString: sentString, ); @@ -1044,7 +1044,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { }); testWidgets('Null named nullable parameter', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final String? receivedNullString = await api.echoNamedNullableString(); expect(receivedNullString, null); @@ -1053,7 +1053,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { group('Host async API tests', () { testWidgets('basic void->void call works', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect(api.noopAsync(), completes); }); @@ -1061,7 +1061,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('async errors are returned from non void methods correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect(() async { await api.throwAsyncError(); @@ -1071,7 +1071,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('async errors are returned from void methods correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect(() async { await api.throwAsyncErrorFromVoid(); @@ -1081,7 +1081,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'async flutter errors are returned from non void methods correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect( () => api.throwAsyncFlutterError(), @@ -1099,7 +1099,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('all datatypes async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllTypes echoObject = await api.echoAsyncAllTypes(genericAllTypes); @@ -1109,7 +1109,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'all nullable async datatypes serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllNullableTypes? echoObject = await api .echoAsyncNullableAllNullableTypes(recursiveAllNullableTypes); @@ -1121,9 +1121,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'all null datatypes async serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - final AllNullableTypes allTypesNull = AllNullableTypes(); + final allTypesNull = AllNullableTypes(); final AllNullableTypes? echoNullFilledClass = await api .echoAsyncNullableAllNullableTypes(allTypesNull); @@ -1134,7 +1134,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'all nullable async datatypes without recursion serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllNullableTypesWithoutRecursion? echoObject = await api .echoAsyncNullableAllNullableTypesWithoutRecursion( @@ -1148,9 +1148,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'all null datatypes without recursion async serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - final AllNullableTypesWithoutRecursion allTypesNull = + final allTypesNull = AllNullableTypesWithoutRecursion(); final AllNullableTypesWithoutRecursion? echoNullFilledClass = await api @@ -1162,7 +1162,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Int async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentInt = regularInt; final int receivedInt = await api.echoAsyncInt(sentInt); @@ -1172,7 +1172,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Int64 async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentInt = biggerThanBigInt; final int receivedInt = await api.echoAsyncInt(sentInt); @@ -1182,9 +1182,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Doubles async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const double sentDouble = 2.0694; + const sentDouble = 2.0694; final double receivedDouble = await api.echoAsyncDouble(sentDouble); expect(receivedDouble, sentDouble); }); @@ -1192,9 +1192,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('booleans async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - for (final bool sentBool in [true, false]) { + for (final sentBool in [true, false]) { final bool receivedBool = await api.echoAsyncBool(sentBool); expect(receivedBool, sentBool); } @@ -1203,9 +1203,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('strings async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const String sentObject = 'Hello, asynchronously!'; + const sentObject = 'Hello, asynchronously!'; final String echoObject = await api.echoAsyncString(sentObject); expect(echoObject, sentObject); @@ -1214,8 +1214,8 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Uint8List async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - final List data = [ + final api = HostIntegrationCoreApi(); + final data = [ 102, 111, 114, @@ -1227,7 +1227,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { 111, 0, ]; - final Uint8List sentUint8List = Uint8List.fromList(data); + final sentUint8List = Uint8List.fromList(data); final Uint8List receivedUint8List = await api.echoAsyncUint8List( sentUint8List, ); @@ -1237,7 +1237,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('generic Objects async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const Object sentString = "I'm a computer"; final Object receivedString = await api.echoAsyncObject(sentString); expect(receivedString, sentString); @@ -1251,7 +1251,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api.echoAsyncList(list); expect(listEquals(echoObject, list), true); @@ -1260,7 +1260,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enum lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api.echoAsyncEnumList(enumList); expect(listEquals(echoObject, enumList), true); @@ -1269,7 +1269,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('class lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api.echoAsyncClassList( allNullableTypesList, @@ -1282,7 +1282,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoAsyncMap(map); expect(mapEquals(echoObject, map), true); }); @@ -1290,7 +1290,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('string maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoAsyncStringMap( stringMap, ); @@ -1300,7 +1300,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('int maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoAsyncIntMap(intMap); expect(mapEquals(echoObject, intMap), true); }); @@ -1308,7 +1308,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enum maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.echoAsyncEnumMap( enumMap, ); @@ -1318,7 +1318,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('class maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api .echoAsyncClassMap(allNullableTypesMap); for (final MapEntry entry @@ -1330,7 +1330,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.three; final AnEnum echoEnum = await api.echoAsyncEnum(sentEnum); @@ -1340,7 +1340,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enums serialize and deserialize correctly (again)', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnotherEnum sentEnum = AnotherEnum.justInCase; final AnotherEnum echoEnum = await api.echoAnotherAsyncEnum(sentEnum); @@ -1350,7 +1350,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('multi word enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.fourHundredTwentyTwo; final AnEnum echoEnum = await api.echoAsyncEnum(sentEnum); @@ -1360,7 +1360,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable Int async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentInt = regularInt; final int? receivedInt = await api.echoAsyncNullableInt(sentInt); @@ -1370,7 +1370,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable Int64 async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentInt = biggerThanBigInt; final int? receivedInt = await api.echoAsyncNullableInt(sentInt); @@ -1380,9 +1380,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable Doubles async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const double sentDouble = 2.0694; + const sentDouble = 2.0694; final double? receivedDouble = await api.echoAsyncNullableDouble( sentDouble, ); @@ -1392,9 +1392,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable booleans async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - for (final bool sentBool in [true, false]) { + for (final sentBool in [true, false]) { final bool? receivedBool = await api.echoAsyncNullableBool(sentBool); expect(receivedBool, sentBool); } @@ -1403,9 +1403,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable strings async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const String sentObject = 'Hello, asynchronously!'; + const sentObject = 'Hello, asynchronously!'; final String? echoObject = await api.echoAsyncNullableString(sentObject); expect(echoObject, sentObject); @@ -1414,8 +1414,8 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable Uint8List async serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - final List data = [ + final api = HostIntegrationCoreApi(); + final data = [ 102, 111, 114, @@ -1427,7 +1427,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { 111, 0, ]; - final Uint8List sentUint8List = Uint8List.fromList(data); + final sentUint8List = Uint8List.fromList(data); final Uint8List? receivedUint8List = await api .echoAsyncNullableUint8List(sentUint8List); expect(receivedUint8List, sentUint8List); @@ -1437,7 +1437,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable generic Objects async serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const Object sentString = "I'm a computer"; final Object? receivedString = await api.echoAsyncNullableObject( sentString, @@ -1454,7 +1454,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api.echoAsyncNullableList(list); expect(listEquals(echoObject, list), true); @@ -1463,7 +1463,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enum lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api.echoAsyncNullableEnumList( enumList, @@ -1474,7 +1474,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable class lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api .echoAsyncNullableClassList(allNullableTypesList); @@ -1486,7 +1486,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoAsyncNullableMap( map, ); @@ -1496,7 +1496,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable string maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .echoAsyncNullableStringMap(stringMap); expect(mapEquals(echoObject, stringMap), true); @@ -1505,7 +1505,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable int maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoAsyncNullableIntMap( intMap, ); @@ -1515,7 +1515,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enum maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .echoAsyncNullableEnumMap(enumMap); expect(mapEquals(echoObject, enumMap), true); @@ -1524,7 +1524,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable class maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .echoAsyncNullableClassMap(allNullableTypesMap); for (final MapEntry entry @@ -1536,7 +1536,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.three; final AnEnum? echoEnum = await api.echoAsyncNullableEnum(sentEnum); @@ -1546,7 +1546,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enums serialize and deserialize correctly (again)', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnotherEnum sentEnum = AnotherEnum.justInCase; final AnotherEnum? echoEnum = await api.echoAnotherAsyncNullableEnum( @@ -1558,7 +1558,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.fortyTwo; final AnEnum? echoEnum = await api.echoAsyncNullableEnum(sentEnum); @@ -1568,7 +1568,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null Ints async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final int? receivedInt = await api.echoAsyncNullableInt(null); expect(receivedInt, null); @@ -1577,7 +1577,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null Doubles async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final double? receivedDouble = await api.echoAsyncNullableDouble(null); expect(receivedDouble, null); @@ -1586,7 +1586,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null booleans async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final bool? receivedBool = await api.echoAsyncNullableBool(null); expect(receivedBool, null); @@ -1595,7 +1595,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null strings async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final String? echoObject = await api.echoAsyncNullableString(null); expect(echoObject, null); @@ -1604,7 +1604,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null Uint8List async serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Uint8List? receivedUint8List = await api.echoAsyncNullableUint8List( null, @@ -1615,7 +1615,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'null generic Objects async serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Object? receivedString = await api.echoAsyncNullableObject(null); expect(receivedString, null); }, @@ -1624,7 +1624,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api.echoAsyncNullableList(null); expect(listEquals(echoObject, null), true); @@ -1633,7 +1633,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoAsyncNullableMap( null, @@ -1644,7 +1644,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null string maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .echoAsyncNullableStringMap(null); @@ -1654,7 +1654,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null int maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api.echoAsyncNullableIntMap( null, @@ -1665,7 +1665,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum? sentEnum = null; final AnEnum? echoEnum = await api.echoAsyncNullableEnum(null); @@ -1675,7 +1675,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnotherEnum? sentEnum = null; final AnotherEnum? echoEnum = await api.echoAnotherAsyncNullableEnum( @@ -1689,13 +1689,13 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('echo string succeeds with suffix with multiple instances', ( _, ) async { - final HostSmallApi apiWithSuffixOne = HostSmallApi( + final apiWithSuffixOne = HostSmallApi( messageChannelSuffix: 'suffixOne', ); - final HostSmallApi apiWithSuffixTwo = HostSmallApi( + final apiWithSuffixTwo = HostSmallApi( messageChannelSuffix: 'suffixTwo', ); - const String sentString = "I'm a computer"; + const sentString = "I'm a computer"; final String echoStringOne = await apiWithSuffixOne.echo(sentString); final String echoStringTwo = await apiWithSuffixTwo.echo(sentString); expect(sentString, echoStringOne); @@ -1707,13 +1707,13 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { ) async { // The only way to get the channel name back is to throw an exception. // These APIs have no corresponding APIs on the host platforms. - final HostSmallApi apiWithSuffixOne = HostSmallApi( + final apiWithSuffixOne = HostSmallApi( messageChannelSuffix: 'suffixWithNoHost', ); - final HostSmallApi apiWithSuffixTwo = HostSmallApi( + final apiWithSuffixTwo = HostSmallApi( messageChannelSuffix: 'suffixWithoutHost', ); - const String sentString = "I'm a computer"; + const sentString = "I'm a computer"; try { await apiWithSuffixOne.echo(sentString); } on PlatformException catch (e) { @@ -1737,7 +1737,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { }); testWidgets('basic void->void call works', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect(api.callFlutterNoop(), completes); }); @@ -1745,7 +1745,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('errors are returned from non void methods correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect(() async { await api.callFlutterThrowError(); @@ -1755,7 +1755,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('errors are returned from void methods correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect(() async { await api.callFlutterThrowErrorFromVoid(); @@ -1765,7 +1765,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('all datatypes serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllTypes echoObject = await api.callFlutterEchoAllTypes( genericAllTypes, @@ -1777,9 +1777,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Arguments of multiple types serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - const String aNullableString = 'this is a String'; - const bool aNullableBool = false; + final api = HostIntegrationCoreApi(); + const aNullableString = 'this is a String'; + const aNullableBool = false; const int aNullableInt = regularInt; final AllNullableTypes compositeObject = await api @@ -1797,7 +1797,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Arguments of multiple null types serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllNullableTypes compositeObject = await api .callFlutterSendMultipleNullableTypes(null, null, null); @@ -1810,9 +1810,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Arguments of multiple types serialize and deserialize correctly (WithoutRecursion)', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - const String aNullableString = 'this is a String'; - const bool aNullableBool = false; + final api = HostIntegrationCoreApi(); + const aNullableString = 'this is a String'; + const aNullableBool = false; const int aNullableInt = regularInt; final AllNullableTypesWithoutRecursion compositeObject = await api @@ -1830,7 +1830,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'Arguments of multiple null types serialize and deserialize correctly (WithoutRecursion)', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final AllNullableTypesWithoutRecursion compositeObject = await api .callFlutterSendMultipleNullableTypesWithoutRecursion( @@ -1847,9 +1847,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('booleans serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - for (final bool sentObject in [true, false]) { + for (final sentObject in [true, false]) { final bool echoObject = await api.callFlutterEchoBool(sentObject); expect(echoObject, sentObject); } @@ -1858,7 +1858,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('ints serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentObject = regularInt; final int echoObject = await api.callFlutterEchoInt(sentObject); @@ -1868,9 +1868,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('doubles serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const double sentObject = 2.0694; + const sentObject = 2.0694; final double echoObject = await api.callFlutterEchoDouble(sentObject); expect(echoObject, sentObject); }); @@ -1878,9 +1878,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('strings serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const String sentObject = 'Hello Dart!'; + const sentObject = 'Hello Dart!'; final String echoObject = await api.callFlutterEchoString(sentObject); expect(echoObject, sentObject); }); @@ -1888,9 +1888,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('Uint8Lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - final List data = [ + final data = [ 102, 111, 114, @@ -1902,7 +1902,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { 111, 0, ]; - final Uint8List sentObject = Uint8List.fromList(data); + final sentObject = Uint8List.fromList(data); final Uint8List echoObject = await api.callFlutterEchoUint8List( sentObject, ); @@ -1912,7 +1912,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api.callFlutterEchoList(list); expect(listEquals(echoObject, list), true); @@ -1921,7 +1921,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enum lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api.callFlutterEchoEnumList( enumList, @@ -1932,7 +1932,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('class lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api .callFlutterEchoClassList(allNullableTypesList); @@ -1944,7 +1944,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull enum lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api.callFlutterEchoNonNullEnumList( nonNullEnumList, @@ -1955,7 +1955,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull class lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List echoObject = await api .callFlutterEchoNonNullClassList(nonNullAllNullableTypesList); @@ -1967,7 +1967,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.callFlutterEchoMap( map, ); @@ -1977,7 +1977,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('string maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api .callFlutterEchoStringMap(stringMap); expect(mapEquals(echoObject, stringMap), true); @@ -1986,7 +1986,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('int maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.callFlutterEchoIntMap( intMap, ); @@ -1996,7 +1996,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enum maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.callFlutterEchoEnumMap( enumMap, ); @@ -2006,7 +2006,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('class maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api .callFlutterEchoClassMap(allNullableTypesMap); for (final MapEntry entry @@ -2018,7 +2018,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull string maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api .callFlutterEchoNonNullStringMap(nonNullStringMap); expect(mapEquals(echoObject, nonNullStringMap), true); @@ -2027,7 +2027,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull int maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api.callFlutterEchoNonNullIntMap( nonNullIntMap, ); @@ -2037,7 +2037,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull enum maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api .callFlutterEchoNonNullEnumMap(nonNullEnumMap); expect(mapEquals(echoObject, nonNullEnumMap), true); @@ -2046,7 +2046,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('NonNull class maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map echoObject = await api .callFlutterEchoNonNullClassMap(nonNullAllNullableTypesMap); for (final MapEntry entry in echoObject.entries) { @@ -2057,7 +2057,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.three; final AnEnum echoEnum = await api.callFlutterEchoEnum(sentEnum); @@ -2067,7 +2067,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('enums serialize and deserialize correctly (again)', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnotherEnum sentEnum = AnotherEnum.justInCase; final AnotherEnum echoEnum = await api.callFlutterEchoAnotherEnum( @@ -2079,7 +2079,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('multi word enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.fortyTwo; final AnEnum echoEnum = await api.callFlutterEchoEnum(sentEnum); @@ -2089,9 +2089,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable booleans serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - for (final bool? sentObject in [true, false]) { + for (final sentObject in [true, false]) { final bool? echoObject = await api.callFlutterEchoNullableBool( sentObject, ); @@ -2102,7 +2102,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null booleans serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const bool? sentObject = null; final bool? echoObject = await api.callFlutterEchoNullableBool( @@ -2114,7 +2114,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable ints serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentObject = regularInt; final int? echoObject = await api.callFlutterEchoNullableInt(sentObject); @@ -2124,7 +2124,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable big ints serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const int sentObject = biggerThanBigInt; final int? echoObject = await api.callFlutterEchoNullableInt(sentObject); @@ -2134,7 +2134,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null ints serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final int? echoObject = await api.callFlutterEchoNullableInt(null); expect(echoObject, null); @@ -2143,9 +2143,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable doubles serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const double sentObject = 2.0694; + const sentObject = 2.0694; final double? echoObject = await api.callFlutterEchoNullableDouble( sentObject, ); @@ -2155,7 +2155,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null doubles serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final double? echoObject = await api.callFlutterEchoNullableDouble(null); expect(echoObject, null); @@ -2164,9 +2164,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable strings serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); - const String sentObject = "I'm a computer"; + const sentObject = "I'm a computer"; final String? echoObject = await api.callFlutterEchoNullableString( sentObject, ); @@ -2176,7 +2176,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null strings serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final String? echoObject = await api.callFlutterEchoNullableString(null); expect(echoObject, null); @@ -2185,8 +2185,8 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable Uint8Lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - final List data = [ + final api = HostIntegrationCoreApi(); + final data = [ 102, 111, 114, @@ -2198,7 +2198,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { 111, 0, ]; - final Uint8List sentObject = Uint8List.fromList(data); + final sentObject = Uint8List.fromList(data); final Uint8List? echoObject = await api.callFlutterEchoNullableUint8List( sentObject, ); @@ -2208,7 +2208,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null Uint8Lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Uint8List? echoObject = await api.callFlutterEchoNullableUint8List( null, @@ -2219,7 +2219,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api.callFlutterEchoNullableList( list, @@ -2230,7 +2230,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enum lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api .callFlutterEchoNullableEnumList(enumList); @@ -2240,7 +2240,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable class lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api .callFlutterEchoNullableClassList(allNullableTypesList); @@ -2252,7 +2252,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable NonNull enum lists serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api .callFlutterEchoNullableNonNullEnumList(nonNullEnumList); @@ -2263,7 +2263,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable NonNull class lists serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api .callFlutterEchoNullableNonNullClassList( @@ -2279,7 +2279,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null lists serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final List? echoObject = await api.callFlutterEchoNullableList( null, @@ -2290,7 +2290,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .callFlutterEchoNullableMap(map); expect(mapEquals(echoObject, map), true); @@ -2299,7 +2299,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .callFlutterEchoNullableMap(null); @@ -2309,7 +2309,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable string maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .callFlutterEchoNullableStringMap(stringMap); expect(mapEquals(echoObject, stringMap), true); @@ -2318,7 +2318,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable int maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .callFlutterEchoNullableIntMap(intMap); expect(mapEquals(echoObject, intMap), true); @@ -2327,7 +2327,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enum maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .callFlutterEchoNullableEnumMap(enumMap); expect(mapEquals(echoObject, enumMap), true); @@ -2336,7 +2336,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable class maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .callFlutterEchoNullableClassMap(allNullableTypesMap); for (final MapEntry entry @@ -2348,7 +2348,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable NonNull string maps serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .callFlutterEchoNullableNonNullStringMap(nonNullStringMap); expect(mapEquals(echoObject, nonNullStringMap), true); @@ -2358,7 +2358,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable NonNull int maps serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .callFlutterEchoNullableNonNullIntMap(nonNullIntMap); expect(mapEquals(echoObject, nonNullIntMap), true); @@ -2368,7 +2368,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable NonNull enum maps serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .callFlutterEchoNullableNonNullEnumMap(nonNullEnumMap); expect(mapEquals(echoObject, nonNullEnumMap), true); @@ -2378,7 +2378,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'nullable NonNull class maps serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .callFlutterEchoNullableNonNullClassMap(nonNullAllNullableTypesMap); for (final MapEntry entry @@ -2391,7 +2391,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null maps serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); final Map? echoObject = await api .callFlutterEchoNullableIntMap(null); @@ -2401,7 +2401,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.three; final AnEnum? echoEnum = await api.callFlutterEchoNullableEnum(sentEnum); @@ -2411,7 +2411,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('nullable enums serialize and deserialize correctly (again)', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnotherEnum sentEnum = AnotherEnum.justInCase; final AnotherEnum? echoEnum = await api @@ -2422,7 +2422,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'multi word nullable enums serialize and deserialize correctly', (WidgetTester _) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum sentEnum = AnEnum.fourHundredTwentyTwo; final AnEnum? echoEnum = await api.callFlutterEchoNullableEnum( @@ -2435,7 +2435,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null enums serialize and deserialize correctly', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnEnum? sentEnum = null; final AnEnum? echoEnum = await api.callFlutterEchoNullableEnum(sentEnum); @@ -2445,7 +2445,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('null enums serialize and deserialize correctly (again)', ( WidgetTester _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); const AnotherEnum? sentEnum = null; final AnotherEnum? echoEnum = await api @@ -2460,7 +2460,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { } testWidgets('named constructor', (_) async { - final ProxyApiTestClass instance = ProxyApiTestClass.namedConstructor( + final instance = ProxyApiTestClass.namedConstructor( aBool: true, anInt: 0, aDouble: 0.0, @@ -2528,35 +2528,35 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('echoInt', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - const int value = 0; + const value = 0; expect(await api.echoInt(value), value); }); testWidgets('echoDouble', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - const double value = 0.0; + const value = 0.0; expect(await api.echoDouble(value), value); }); testWidgets('echoBool', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - const bool value = true; + const value = true; expect(await api.echoBool(value), value); }); testWidgets('echoString', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - const String value = 'string'; + const value = 'string'; expect(await api.echoString(value), value); }); testWidgets('echoUint8List', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - final Uint8List value = Uint8List(0); + final value = Uint8List(0); expect(await api.echoUint8List(value), value); }); @@ -2577,7 +2577,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('echoProxyApiList', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - final List value = [ + final value = [ _createGenericProxyApiTestClass(), _createGenericProxyApiTestClass(), ]; @@ -2587,14 +2587,14 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('echoMap', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - const Map value = {'apple': 'pie'}; + const value = {'apple': 'pie'}; expect(await api.echoMap(value), value); }); testWidgets('echoProxyApiMap', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - final Map value = { + final value = { '42': _createGenericProxyApiTestClass(), }; expect(await api.echoProxyApiMap(value), value); @@ -2610,7 +2610,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('echoProxyApi', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - final ProxyApiSuperClass value = ProxyApiSuperClass(); + final value = ProxyApiSuperClass(); expect(await api.echoProxyApi(value), value); }); @@ -2678,7 +2678,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); expect(await api.echoNullableProxyApi(null), null); - final ProxyApiSuperClass proxyApi = ProxyApiSuperClass(); + final proxyApi = ProxyApiSuperClass(); expect(await api.echoNullableProxyApi(proxyApi), proxyApi); }); @@ -2690,35 +2690,35 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('echoAsyncInt', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - const int value = 0; + const value = 0; expect(await api.echoAsyncInt(value), value); }); testWidgets('echoAsyncDouble', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - const double value = 0.0; + const value = 0.0; expect(await api.echoAsyncDouble(value), value); }); testWidgets('echoAsyncBool', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - const bool value = false; + const value = false; expect(await api.echoAsyncBool(value), value); }); testWidgets('echoAsyncString', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - const String value = 'ping'; + const value = 'ping'; expect(await api.echoAsyncString(value), value); }); testWidgets('echoAsyncUint8List', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - final Uint8List value = Uint8List(0); + final value = Uint8List(0); expect(await api.echoAsyncUint8List(value), value); }); @@ -2732,14 +2732,14 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('echoAsyncList', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - const List value = ['apple', 'pie']; + const value = ['apple', 'pie']; expect(await api.echoAsyncList(value), value); }); testWidgets('echoAsyncMap', (_) async { final ProxyApiTestClass api = _createGenericProxyApiTestClass(); - final Map value = { + final value = { 'something': ProxyApiSuperClass(), }; expect(await api.echoAsyncMap(value), value); @@ -2849,7 +2849,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { }); testWidgets('echoStaticString', (_) async { - const String value = 'static string'; + const value = 'static string'; expect(await ProxyApiTestClass.echoStaticString(value), value); }); @@ -2858,7 +2858,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { }); testWidgets('callFlutterNoop', (_) async { - bool called = false; + var called = false; final ProxyApiTestClass api = _createGenericProxyApiTestClass( flutterNoop: (ProxyApiTestClass instance) async { called = true; @@ -2912,7 +2912,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { flutterEchoBool: (_, bool aBool) => aBool, ); - const bool value = true; + const value = true; expect(await api.callFlutterEchoBool(value), value); }); @@ -2921,7 +2921,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { flutterEchoInt: (_, int anInt) => anInt, ); - const int value = 0; + const value = 0; expect(await api.callFlutterEchoInt(value), value); }); @@ -2930,7 +2930,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { flutterEchoDouble: (_, double aDouble) => aDouble, ); - const double value = 0.0; + const value = 0.0; expect(await api.callFlutterEchoDouble(value), value); }); @@ -2939,7 +2939,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { flutterEchoString: (_, String aString) => aString, ); - const String value = 'a string'; + const value = 'a string'; expect(await api.callFlutterEchoString(value), value); }); @@ -2948,7 +2948,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { flutterEchoUint8List: (_, Uint8List aUint8List) => aUint8List, ); - final Uint8List value = Uint8List(0); + final value = Uint8List(0); expect(await api.callFlutterEchoUint8List(value), value); }); @@ -2957,7 +2957,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { flutterEchoList: (_, List aList) => aList, ); - final List value = [0, 0.0, true, ProxyApiSuperClass()]; + final value = [0, 0.0, true, ProxyApiSuperClass()]; expect(await api.callFlutterEchoList(value), value); }); @@ -2977,7 +2977,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { flutterEchoMap: (_, Map aMap) => aMap, ); - final Map value = {'a String': 4}; + final value = {'a String': 4}; expect(await api.callFlutterEchoMap(value), value); }); @@ -2987,7 +2987,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { aMap, ); - final Map value = + final value = { 'a String': _createGenericProxyApiTestClass(), }; @@ -3008,7 +3008,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { flutterEchoProxyApi: (_, ProxyApiSuperClass aProxyApi) => aProxyApi, ); - final ProxyApiSuperClass value = ProxyApiSuperClass(); + final value = ProxyApiSuperClass(); expect(await api.callFlutterEchoProxyApi(value), value); }); @@ -3093,12 +3093,12 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { expect(await api.callFlutterEchoNullableProxyApi(null), null); - final ProxyApiSuperClass proxyApi = ProxyApiSuperClass(); + final proxyApi = ProxyApiSuperClass(); expect(await api.callFlutterEchoNullableProxyApi(proxyApi), proxyApi); }); testWidgets('callFlutterNoopAsync', (_) async { - bool called = false; + var called = false; final ProxyApiTestClass api = _createGenericProxyApiTestClass( flutterNoopAsync: (ProxyApiTestClass instance) async { called = true; @@ -3114,7 +3114,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { flutterEchoAsyncString: (_, String aString) async => aString, ); - const String value = 'a string'; + const value = 'a string'; expect(await api.callFlutterEchoAsyncString(value), value); }); }); @@ -3134,8 +3134,8 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets('echo string succeeds with suffix with multiple instances', ( _, ) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - const String sentObject = "I'm a computer"; + final api = HostIntegrationCoreApi(); + const sentObject = "I'm a computer"; final String echoObject = await api.callFlutterSmallApiEchoString( sentObject, ); @@ -3144,19 +3144,19 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { }); testWidgets('Unused data class still generate', (_) async { - final UnusedClass unused = UnusedClass(); + final unused = UnusedClass(); expect(unused, unused); }); /// Task queues testWidgets('non-task-queue handlers run on a the main thread', (_) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); expect(await api.defaultIsMainThread(), true); }); testWidgets('task queue handlers run on a background thread', (_) async { - final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + final api = HostIntegrationCoreApi(); // Currently only Android and iOS have task queue support. See // https://github.com/flutter/flutter/issues/93945 // Rather than skip the test, this changes the expectation, so that there @@ -3172,7 +3172,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { /// Event channels - const List eventChannelSupported = [ + const eventChannelSupported = [ TargetGenerator.kotlin, TargetGenerator.swift, ]; @@ -3182,7 +3182,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { (_) async { final Stream events = streamInts(); final List listEvents = await events.toList(); - for (final int value in listEvents) { + for (final value in listEvents) { expect(listEvents[value], value); } }, @@ -3192,8 +3192,8 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'event channel handles extended sealed classes', (_) async { - final Completer completer = Completer(); - int count = 0; + final completer = Completer(); + var count = 0; final Stream events = streamEvents(); events.listen((PlatformEvent event) { switch (event) { @@ -3236,8 +3236,8 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { testWidgets( 'event channels handle multiple instances', (_) async { - final Completer completer1 = Completer(); - final Completer completer2 = Completer(); + final completer1 = Completer(); + final completer2 = Completer(); final Stream events1 = streamConsistentNumbers(instanceName: '1'); final Stream events2 = streamConsistentNumbers(instanceName: '2'); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/background_platform_channels.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/background_platform_channels.gen.dart index 5f82202deb1..40dafae9618 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/background_platform_channels.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/background_platform_channels.gen.dart @@ -58,9 +58,9 @@ class BackgroundApi2Host { final String pigeonVar_messageChannelSuffix; Future add(int x, int y) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.BackgroundApi2Host.add$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -71,7 +71,7 @@ class BackgroundApi2Host { [x, y], ], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart index d7b4d841b24..7e806c209be 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart @@ -806,10 +806,10 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : AnEnum.values[value]; case 130: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : AnotherEnum.values[value]; case 131: return UnusedClass.decode(readValue(buffer)!); @@ -851,16 +851,16 @@ class HostIntegrationCoreApi { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. Future noop() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -877,9 +877,9 @@ class HostIntegrationCoreApi { /// Returns the passed object, to test serialization and deserialization. Future echoAllTypes(AllTypes everything) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -888,7 +888,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [everything], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -910,16 +910,16 @@ class HostIntegrationCoreApi { /// Returns an error, to test error handling. Future throwError() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -936,16 +936,16 @@ class HostIntegrationCoreApi { /// Returns an error from a void function, to test error handling. Future throwErrorFromVoid() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -962,16 +962,16 @@ class HostIntegrationCoreApi { /// Returns a Flutter error, to test error handling. Future throwFlutterError() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -988,9 +988,9 @@ class HostIntegrationCoreApi { /// Returns passed in int. Future echoInt(int anInt) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -999,7 +999,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1021,9 +1021,9 @@ class HostIntegrationCoreApi { /// Returns passed in double. Future echoDouble(double aDouble) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1032,7 +1032,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1054,9 +1054,9 @@ class HostIntegrationCoreApi { /// Returns the passed in boolean. Future echoBool(bool aBool) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1065,7 +1065,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1087,9 +1087,9 @@ class HostIntegrationCoreApi { /// Returns the passed in string. Future echoString(String aString) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1098,7 +1098,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1120,9 +1120,9 @@ class HostIntegrationCoreApi { /// Returns the passed in Uint8List. Future echoUint8List(Uint8List aUint8List) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1131,7 +1131,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aUint8List], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1153,9 +1153,9 @@ class HostIntegrationCoreApi { /// Returns the passed in generic Object. Future echoObject(Object anObject) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1164,7 +1164,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anObject], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1186,9 +1186,9 @@ class HostIntegrationCoreApi { /// Returns the passed list, to test serialization and deserialization. Future> echoList(List list) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1197,7 +1197,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [list], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1219,9 +1219,9 @@ class HostIntegrationCoreApi { /// Returns the passed list, to test serialization and deserialization. Future> echoEnumList(List enumList) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnumList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1230,7 +1230,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1254,9 +1254,9 @@ class HostIntegrationCoreApi { Future> echoClassList( List classList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1265,7 +1265,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1288,9 +1288,9 @@ class HostIntegrationCoreApi { /// Returns the passed list, to test serialization and deserialization. Future> echoNonNullEnumList(List enumList) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullEnumList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1299,7 +1299,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1323,9 +1323,9 @@ class HostIntegrationCoreApi { Future> echoNonNullClassList( List classList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullClassList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1334,7 +1334,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1357,9 +1357,9 @@ class HostIntegrationCoreApi { /// Returns the passed map, to test serialization and deserialization. Future> echoMap(Map map) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1368,7 +1368,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [map], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1393,9 +1393,9 @@ class HostIntegrationCoreApi { Future> echoStringMap( Map stringMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoStringMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1404,7 +1404,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [stringMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1427,9 +1427,9 @@ class HostIntegrationCoreApi { /// Returns the passed map, to test serialization and deserialization. Future> echoIntMap(Map intMap) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoIntMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1438,7 +1438,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [intMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1463,9 +1463,9 @@ class HostIntegrationCoreApi { Future> echoEnumMap( Map enumMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnumMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1474,7 +1474,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1499,9 +1499,9 @@ class HostIntegrationCoreApi { Future> echoClassMap( Map classMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1510,7 +1510,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1535,9 +1535,9 @@ class HostIntegrationCoreApi { Future> echoNonNullStringMap( Map stringMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullStringMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1546,7 +1546,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [stringMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1569,9 +1569,9 @@ class HostIntegrationCoreApi { /// Returns the passed map, to test serialization and deserialization. Future> echoNonNullIntMap(Map intMap) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullIntMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1580,7 +1580,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [intMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1605,9 +1605,9 @@ class HostIntegrationCoreApi { Future> echoNonNullEnumMap( Map enumMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullEnumMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1616,7 +1616,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1641,9 +1641,9 @@ class HostIntegrationCoreApi { Future> echoNonNullClassMap( Map classMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullClassMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1652,7 +1652,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1675,9 +1675,9 @@ class HostIntegrationCoreApi { /// Returns the passed class to test nested class serialization and deserialization. Future echoClassWrapper(AllClassesWrapper wrapper) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1686,7 +1686,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [wrapper], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1708,9 +1708,9 @@ class HostIntegrationCoreApi { /// Returns the passed enum to test serialization and deserialization. Future echoEnum(AnEnum anEnum) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1719,7 +1719,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1741,9 +1741,9 @@ class HostIntegrationCoreApi { /// Returns the passed enum to test serialization and deserialization. Future echoAnotherEnum(AnotherEnum anotherEnum) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1752,7 +1752,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anotherEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1774,9 +1774,9 @@ class HostIntegrationCoreApi { /// Returns the default string. Future echoNamedDefaultString({String aString = 'default'}) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1785,7 +1785,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1807,9 +1807,9 @@ class HostIntegrationCoreApi { /// Returns passed in double. Future echoOptionalDefaultDouble([double aDouble = 3.14]) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1818,7 +1818,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1840,9 +1840,9 @@ class HostIntegrationCoreApi { /// Returns passed in int. Future echoRequiredInt({required int anInt}) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1851,7 +1851,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1875,9 +1875,9 @@ class HostIntegrationCoreApi { Future echoAllNullableTypes( AllNullableTypes? everything, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1886,7 +1886,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [everything], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1906,9 +1906,9 @@ class HostIntegrationCoreApi { echoAllNullableTypesWithoutRecursion( AllNullableTypesWithoutRecursion? everything, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypesWithoutRecursion$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1917,7 +1917,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [everything], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1935,9 +1935,9 @@ class HostIntegrationCoreApi { /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. Future extractNestedNullableString(AllClassesWrapper wrapper) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1946,7 +1946,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [wrapper], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1966,9 +1966,9 @@ class HostIntegrationCoreApi { Future createNestedNullableString( String? nullableString, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1977,7 +1977,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [nullableString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2003,9 +2003,9 @@ class HostIntegrationCoreApi { int? aNullableInt, String? aNullableString, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2014,7 +2014,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableBool, aNullableInt, aNullableString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2041,9 +2041,9 @@ class HostIntegrationCoreApi { int? aNullableInt, String? aNullableString, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypesWithoutRecursion$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2052,7 +2052,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableBool, aNullableInt, aNullableString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2074,9 +2074,9 @@ class HostIntegrationCoreApi { /// Returns passed in int. Future echoNullableInt(int? aNullableInt) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2085,7 +2085,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2102,9 +2102,9 @@ class HostIntegrationCoreApi { /// Returns passed in double. Future echoNullableDouble(double? aNullableDouble) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2113,7 +2113,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2130,9 +2130,9 @@ class HostIntegrationCoreApi { /// Returns the passed in boolean. Future echoNullableBool(bool? aNullableBool) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2141,7 +2141,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2158,9 +2158,9 @@ class HostIntegrationCoreApi { /// Returns the passed in string. Future echoNullableString(String? aNullableString) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2169,7 +2169,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2188,9 +2188,9 @@ class HostIntegrationCoreApi { Future echoNullableUint8List( Uint8List? aNullableUint8List, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2199,7 +2199,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableUint8List], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2216,9 +2216,9 @@ class HostIntegrationCoreApi { /// Returns the passed in generic Object. Future echoNullableObject(Object? aNullableObject) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2227,7 +2227,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableObject], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2244,9 +2244,9 @@ class HostIntegrationCoreApi { /// Returns the passed list, to test serialization and deserialization. Future?> echoNullableList(List? aNullableList) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2255,7 +2255,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2272,9 +2272,9 @@ class HostIntegrationCoreApi { /// Returns the passed list, to test serialization and deserialization. Future?> echoNullableEnumList(List? enumList) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnumList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2283,7 +2283,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2302,9 +2302,9 @@ class HostIntegrationCoreApi { Future?> echoNullableClassList( List? classList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableClassList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2313,7 +2313,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2333,9 +2333,9 @@ class HostIntegrationCoreApi { Future?> echoNullableNonNullEnumList( List? enumList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullEnumList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2344,7 +2344,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2363,9 +2363,9 @@ class HostIntegrationCoreApi { Future?> echoNullableNonNullClassList( List? classList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullClassList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2374,7 +2374,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2394,9 +2394,9 @@ class HostIntegrationCoreApi { Future?> echoNullableMap( Map? map, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2405,7 +2405,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [map], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2425,9 +2425,9 @@ class HostIntegrationCoreApi { Future?> echoNullableStringMap( Map? stringMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableStringMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2436,7 +2436,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [stringMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2454,9 +2454,9 @@ class HostIntegrationCoreApi { /// Returns the passed map, to test serialization and deserialization. Future?> echoNullableIntMap(Map? intMap) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableIntMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2465,7 +2465,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [intMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2485,9 +2485,9 @@ class HostIntegrationCoreApi { Future?> echoNullableEnumMap( Map? enumMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnumMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2496,7 +2496,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2516,9 +2516,9 @@ class HostIntegrationCoreApi { Future?> echoNullableClassMap( Map? classMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableClassMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2527,7 +2527,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2547,9 +2547,9 @@ class HostIntegrationCoreApi { Future?> echoNullableNonNullStringMap( Map? stringMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullStringMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2558,7 +2558,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [stringMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2578,9 +2578,9 @@ class HostIntegrationCoreApi { Future?> echoNullableNonNullIntMap( Map? intMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullIntMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2589,7 +2589,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [intMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2609,9 +2609,9 @@ class HostIntegrationCoreApi { Future?> echoNullableNonNullEnumMap( Map? enumMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullEnumMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2620,7 +2620,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2640,9 +2640,9 @@ class HostIntegrationCoreApi { Future?> echoNullableNonNullClassMap( Map? classMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullClassMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2651,7 +2651,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2668,9 +2668,9 @@ class HostIntegrationCoreApi { } Future echoNullableEnum(AnEnum? anEnum) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2679,7 +2679,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2695,9 +2695,9 @@ class HostIntegrationCoreApi { } Future echoAnotherNullableEnum(AnotherEnum? anotherEnum) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherNullableEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2706,7 +2706,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anotherEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2723,9 +2723,9 @@ class HostIntegrationCoreApi { /// Returns passed in int. Future echoOptionalNullableInt([int? aNullableInt]) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2734,7 +2734,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2751,9 +2751,9 @@ class HostIntegrationCoreApi { /// Returns the passed in string. Future echoNamedNullableString({String? aNullableString}) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2762,7 +2762,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2780,16 +2780,16 @@ class HostIntegrationCoreApi { /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. Future noopAsync() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2806,9 +2806,9 @@ class HostIntegrationCoreApi { /// Returns passed in int asynchronously. Future echoAsyncInt(int anInt) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2817,7 +2817,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2839,9 +2839,9 @@ class HostIntegrationCoreApi { /// Returns passed in double asynchronously. Future echoAsyncDouble(double aDouble) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2850,7 +2850,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2872,9 +2872,9 @@ class HostIntegrationCoreApi { /// Returns the passed in boolean asynchronously. Future echoAsyncBool(bool aBool) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2883,7 +2883,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2905,9 +2905,9 @@ class HostIntegrationCoreApi { /// Returns the passed string asynchronously. Future echoAsyncString(String aString) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2916,7 +2916,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2938,9 +2938,9 @@ class HostIntegrationCoreApi { /// Returns the passed in Uint8List asynchronously. Future echoAsyncUint8List(Uint8List aUint8List) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2949,7 +2949,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aUint8List], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2971,9 +2971,9 @@ class HostIntegrationCoreApi { /// Returns the passed in generic Object asynchronously. Future echoAsyncObject(Object anObject) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -2982,7 +2982,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anObject], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3004,9 +3004,9 @@ class HostIntegrationCoreApi { /// Returns the passed list, to test asynchronous serialization and deserialization. Future> echoAsyncList(List list) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3015,7 +3015,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [list], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3037,9 +3037,9 @@ class HostIntegrationCoreApi { /// Returns the passed list, to test asynchronous serialization and deserialization. Future> echoAsyncEnumList(List enumList) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnumList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3048,7 +3048,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3072,9 +3072,9 @@ class HostIntegrationCoreApi { Future> echoAsyncClassList( List classList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncClassList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3083,7 +3083,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3106,9 +3106,9 @@ class HostIntegrationCoreApi { /// Returns the passed map, to test asynchronous serialization and deserialization. Future> echoAsyncMap(Map map) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3117,7 +3117,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [map], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3142,9 +3142,9 @@ class HostIntegrationCoreApi { Future> echoAsyncStringMap( Map stringMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncStringMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3153,7 +3153,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [stringMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3176,9 +3176,9 @@ class HostIntegrationCoreApi { /// Returns the passed map, to test asynchronous serialization and deserialization. Future> echoAsyncIntMap(Map intMap) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncIntMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3187,7 +3187,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [intMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3212,9 +3212,9 @@ class HostIntegrationCoreApi { Future> echoAsyncEnumMap( Map enumMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnumMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3223,7 +3223,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3248,9 +3248,9 @@ class HostIntegrationCoreApi { Future> echoAsyncClassMap( Map classMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncClassMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3259,7 +3259,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3282,9 +3282,9 @@ class HostIntegrationCoreApi { /// Returns the passed enum, to test asynchronous serialization and deserialization. Future echoAsyncEnum(AnEnum anEnum) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3293,7 +3293,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3315,9 +3315,9 @@ class HostIntegrationCoreApi { /// Returns the passed enum, to test asynchronous serialization and deserialization. Future echoAnotherAsyncEnum(AnotherEnum anotherEnum) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3326,7 +3326,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anotherEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3348,16 +3348,16 @@ class HostIntegrationCoreApi { /// Responds with an error from an async function returning a value. Future throwAsyncError() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3374,16 +3374,16 @@ class HostIntegrationCoreApi { /// Responds with an error from an async void function. Future throwAsyncErrorFromVoid() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3400,16 +3400,16 @@ class HostIntegrationCoreApi { /// Responds with a Flutter error from an async function returning a value. Future throwAsyncFlutterError() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3426,9 +3426,9 @@ class HostIntegrationCoreApi { /// Returns the passed object, to test async serialization and deserialization. Future echoAsyncAllTypes(AllTypes everything) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3437,7 +3437,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [everything], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3461,9 +3461,9 @@ class HostIntegrationCoreApi { Future echoAsyncNullableAllNullableTypes( AllNullableTypes? everything, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3472,7 +3472,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [everything], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3492,9 +3492,9 @@ class HostIntegrationCoreApi { echoAsyncNullableAllNullableTypesWithoutRecursion( AllNullableTypesWithoutRecursion? everything, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypesWithoutRecursion$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3503,7 +3503,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [everything], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3520,9 +3520,9 @@ class HostIntegrationCoreApi { /// Returns passed in int asynchronously. Future echoAsyncNullableInt(int? anInt) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3531,7 +3531,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3548,9 +3548,9 @@ class HostIntegrationCoreApi { /// Returns passed in double asynchronously. Future echoAsyncNullableDouble(double? aDouble) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3559,7 +3559,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3576,9 +3576,9 @@ class HostIntegrationCoreApi { /// Returns the passed in boolean asynchronously. Future echoAsyncNullableBool(bool? aBool) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3587,7 +3587,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3604,9 +3604,9 @@ class HostIntegrationCoreApi { /// Returns the passed string asynchronously. Future echoAsyncNullableString(String? aString) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3615,7 +3615,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3632,9 +3632,9 @@ class HostIntegrationCoreApi { /// Returns the passed in Uint8List asynchronously. Future echoAsyncNullableUint8List(Uint8List? aUint8List) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3643,7 +3643,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aUint8List], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3660,9 +3660,9 @@ class HostIntegrationCoreApi { /// Returns the passed in generic Object asynchronously. Future echoAsyncNullableObject(Object? anObject) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3671,7 +3671,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anObject], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3688,9 +3688,9 @@ class HostIntegrationCoreApi { /// Returns the passed list, to test asynchronous serialization and deserialization. Future?> echoAsyncNullableList(List? list) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3699,7 +3699,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [list], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3718,9 +3718,9 @@ class HostIntegrationCoreApi { Future?> echoAsyncNullableEnumList( List? enumList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnumList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3729,7 +3729,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3748,9 +3748,9 @@ class HostIntegrationCoreApi { Future?> echoAsyncNullableClassList( List? classList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableClassList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3759,7 +3759,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3779,9 +3779,9 @@ class HostIntegrationCoreApi { Future?> echoAsyncNullableMap( Map? map, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3790,7 +3790,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [map], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3810,9 +3810,9 @@ class HostIntegrationCoreApi { Future?> echoAsyncNullableStringMap( Map? stringMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableStringMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3821,7 +3821,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [stringMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3841,9 +3841,9 @@ class HostIntegrationCoreApi { Future?> echoAsyncNullableIntMap( Map? intMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableIntMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3852,7 +3852,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [intMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3872,9 +3872,9 @@ class HostIntegrationCoreApi { Future?> echoAsyncNullableEnumMap( Map? enumMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnumMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3883,7 +3883,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3903,9 +3903,9 @@ class HostIntegrationCoreApi { Future?> echoAsyncNullableClassMap( Map? classMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableClassMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3914,7 +3914,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3932,9 +3932,9 @@ class HostIntegrationCoreApi { /// Returns the passed enum, to test asynchronous serialization and deserialization. Future echoAsyncNullableEnum(AnEnum? anEnum) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3943,7 +3943,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3962,9 +3962,9 @@ class HostIntegrationCoreApi { Future echoAnotherAsyncNullableEnum( AnotherEnum? anotherEnum, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncNullableEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3973,7 +3973,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anotherEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3991,16 +3991,16 @@ class HostIntegrationCoreApi { /// Returns true if the handler is run on a main thread, which should be /// true since there is no TaskQueue annotation. Future defaultIsMainThread() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.defaultIsMainThread$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4023,16 +4023,16 @@ class HostIntegrationCoreApi { /// Returns true if the handler is run on a non-main thread, which should be /// true for any platform with TaskQueue support. Future taskQueueIsBackgroundThread() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.taskQueueIsBackgroundThread$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4053,16 +4053,16 @@ class HostIntegrationCoreApi { } Future callFlutterNoop() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4078,16 +4078,16 @@ class HostIntegrationCoreApi { } Future callFlutterThrowError() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4103,16 +4103,16 @@ class HostIntegrationCoreApi { } Future callFlutterThrowErrorFromVoid() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4128,9 +4128,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoAllTypes(AllTypes everything) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4139,7 +4139,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [everything], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4162,9 +4162,9 @@ class HostIntegrationCoreApi { Future callFlutterEchoAllNullableTypes( AllNullableTypes? everything, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4173,7 +4173,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [everything], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4193,9 +4193,9 @@ class HostIntegrationCoreApi { int? aNullableInt, String? aNullableString, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4204,7 +4204,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableBool, aNullableInt, aNullableString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4228,9 +4228,9 @@ class HostIntegrationCoreApi { callFlutterEchoAllNullableTypesWithoutRecursion( AllNullableTypesWithoutRecursion? everything, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypesWithoutRecursion$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4239,7 +4239,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [everything], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4260,9 +4260,9 @@ class HostIntegrationCoreApi { int? aNullableInt, String? aNullableString, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypesWithoutRecursion$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4271,7 +4271,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aNullableBool, aNullableInt, aNullableString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4292,9 +4292,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoBool(bool aBool) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4303,7 +4303,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4324,9 +4324,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoInt(int anInt) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4335,7 +4335,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4356,9 +4356,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoDouble(double aDouble) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4367,7 +4367,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4388,9 +4388,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoString(String aString) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4399,7 +4399,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4420,9 +4420,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoUint8List(Uint8List list) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4431,7 +4431,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [list], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4452,9 +4452,9 @@ class HostIntegrationCoreApi { } Future> callFlutterEchoList(List list) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4463,7 +4463,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [list], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4484,9 +4484,9 @@ class HostIntegrationCoreApi { } Future> callFlutterEchoEnumList(List enumList) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnumList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4495,7 +4495,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4518,9 +4518,9 @@ class HostIntegrationCoreApi { Future> callFlutterEchoClassList( List classList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoClassList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4529,7 +4529,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4553,9 +4553,9 @@ class HostIntegrationCoreApi { Future> callFlutterEchoNonNullEnumList( List enumList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullEnumList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4564,7 +4564,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4587,9 +4587,9 @@ class HostIntegrationCoreApi { Future> callFlutterEchoNonNullClassList( List classList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullClassList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4598,7 +4598,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4622,9 +4622,9 @@ class HostIntegrationCoreApi { Future> callFlutterEchoMap( Map map, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4633,7 +4633,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [map], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4657,9 +4657,9 @@ class HostIntegrationCoreApi { Future> callFlutterEchoStringMap( Map stringMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoStringMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4668,7 +4668,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [stringMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4690,9 +4690,9 @@ class HostIntegrationCoreApi { } Future> callFlutterEchoIntMap(Map intMap) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoIntMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4701,7 +4701,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [intMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4725,9 +4725,9 @@ class HostIntegrationCoreApi { Future> callFlutterEchoEnumMap( Map enumMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnumMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4736,7 +4736,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4760,9 +4760,9 @@ class HostIntegrationCoreApi { Future> callFlutterEchoClassMap( Map classMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoClassMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4771,7 +4771,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4795,9 +4795,9 @@ class HostIntegrationCoreApi { Future> callFlutterEchoNonNullStringMap( Map stringMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullStringMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4806,7 +4806,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [stringMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4830,9 +4830,9 @@ class HostIntegrationCoreApi { Future> callFlutterEchoNonNullIntMap( Map intMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullIntMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4841,7 +4841,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [intMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4865,9 +4865,9 @@ class HostIntegrationCoreApi { Future> callFlutterEchoNonNullEnumMap( Map enumMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullEnumMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4876,7 +4876,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4900,9 +4900,9 @@ class HostIntegrationCoreApi { Future> callFlutterEchoNonNullClassMap( Map classMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullClassMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4911,7 +4911,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4933,9 +4933,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoEnum(AnEnum anEnum) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4944,7 +4944,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4967,9 +4967,9 @@ class HostIntegrationCoreApi { Future callFlutterEchoAnotherEnum( AnotherEnum anotherEnum, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4978,7 +4978,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anotherEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4999,9 +4999,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoNullableBool(bool? aBool) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5010,7 +5010,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5026,9 +5026,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoNullableInt(int? anInt) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5037,7 +5037,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5053,9 +5053,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoNullableDouble(double? aDouble) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5064,7 +5064,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5080,9 +5080,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoNullableString(String? aString) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5091,7 +5091,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5107,9 +5107,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoNullableUint8List(Uint8List? list) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5118,7 +5118,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [list], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5136,9 +5136,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableList( List? list, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5147,7 +5147,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [list], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5165,9 +5165,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableEnumList( List? enumList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnumList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5176,7 +5176,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5194,9 +5194,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableClassList( List? classList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableClassList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5205,7 +5205,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5224,9 +5224,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableNonNullEnumList( List? enumList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullEnumList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5235,7 +5235,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5253,9 +5253,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableNonNullClassList( List? classList, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullClassList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5264,7 +5264,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5283,9 +5283,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableMap( Map? map, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5294,7 +5294,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [map], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5313,9 +5313,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableStringMap( Map? stringMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableStringMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5324,7 +5324,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [stringMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5343,9 +5343,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableIntMap( Map? intMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableIntMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5354,7 +5354,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [intMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5373,9 +5373,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableEnumMap( Map? enumMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnumMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5384,7 +5384,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5403,9 +5403,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableClassMap( Map? classMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableClassMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5414,7 +5414,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5433,9 +5433,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableNonNullStringMap( Map? stringMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullStringMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5444,7 +5444,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [stringMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5463,9 +5463,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableNonNullIntMap( Map? intMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullIntMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5474,7 +5474,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [intMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5493,9 +5493,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableNonNullEnumMap( Map? enumMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullEnumMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5504,7 +5504,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [enumMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5523,9 +5523,9 @@ class HostIntegrationCoreApi { Future?> callFlutterEchoNullableNonNullClassMap( Map? classMap, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullClassMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5534,7 +5534,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [classMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5551,9 +5551,9 @@ class HostIntegrationCoreApi { } Future callFlutterEchoNullableEnum(AnEnum? anEnum) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5562,7 +5562,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5580,9 +5580,9 @@ class HostIntegrationCoreApi { Future callFlutterEchoAnotherNullableEnum( AnotherEnum? anotherEnum, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5591,7 +5591,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [anotherEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5607,9 +5607,9 @@ class HostIntegrationCoreApi { } Future callFlutterSmallApiEchoString(String aString) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSmallApiEchoString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5618,7 +5618,7 @@ class HostIntegrationCoreApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5841,8 +5841,7 @@ abstract class FlutterIntegrationCoreApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -5865,8 +5864,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -5889,8 +5887,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -5913,8 +5910,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -5928,7 +5924,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes was null.', ); final List args = (message as List?)!; - final AllTypes? arg_everything = (args[0] as AllTypes?); + final arg_everything = (args[0] as AllTypes?); assert( arg_everything != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes was null, expected non-null AllTypes.', @@ -5947,8 +5943,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -5962,7 +5957,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes was null.', ); final List args = (message as List?)!; - final AllNullableTypes? arg_everything = + final arg_everything = (args[0] as AllNullableTypes?); try { final AllNullableTypes? output = api.echoAllNullableTypes( @@ -5980,8 +5975,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -5995,9 +5989,9 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes was null.', ); final List args = (message as List?)!; - final bool? arg_aNullableBool = (args[0] as bool?); - final int? arg_aNullableInt = (args[1] as int?); - final String? arg_aNullableString = (args[2] as String?); + final arg_aNullableBool = (args[0] as bool?); + final arg_aNullableInt = (args[1] as int?); + final arg_aNullableString = (args[2] as String?); try { final AllNullableTypes output = api.sendMultipleNullableTypes( arg_aNullableBool, @@ -6016,8 +6010,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypesWithoutRecursion$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6031,7 +6024,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypesWithoutRecursion was null.', ); final List args = (message as List?)!; - final AllNullableTypesWithoutRecursion? arg_everything = + final arg_everything = (args[0] as AllNullableTypesWithoutRecursion?); try { final AllNullableTypesWithoutRecursion? output = api @@ -6048,8 +6041,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypesWithoutRecursion$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6063,9 +6055,9 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypesWithoutRecursion was null.', ); final List args = (message as List?)!; - final bool? arg_aNullableBool = (args[0] as bool?); - final int? arg_aNullableInt = (args[1] as int?); - final String? arg_aNullableString = (args[2] as String?); + final arg_aNullableBool = (args[0] as bool?); + final arg_aNullableInt = (args[1] as int?); + final arg_aNullableString = (args[2] as String?); try { final AllNullableTypesWithoutRecursion output = api .sendMultipleNullableTypesWithoutRecursion( @@ -6085,8 +6077,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6100,7 +6091,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool was null.', ); final List args = (message as List?)!; - final bool? arg_aBool = (args[0] as bool?); + final arg_aBool = (args[0] as bool?); assert( arg_aBool != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool was null, expected non-null bool.', @@ -6119,8 +6110,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6134,7 +6124,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt was null.', ); final List args = (message as List?)!; - final int? arg_anInt = (args[0] as int?); + final arg_anInt = (args[0] as int?); assert( arg_anInt != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt was null, expected non-null int.', @@ -6153,8 +6143,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6168,7 +6157,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble was null.', ); final List args = (message as List?)!; - final double? arg_aDouble = (args[0] as double?); + final arg_aDouble = (args[0] as double?); assert( arg_aDouble != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble was null, expected non-null double.', @@ -6187,8 +6176,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6202,7 +6190,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString was null.', ); final List args = (message as List?)!; - final String? arg_aString = (args[0] as String?); + final arg_aString = (args[0] as String?); assert( arg_aString != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString was null, expected non-null String.', @@ -6221,8 +6209,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6236,7 +6223,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List was null.', ); final List args = (message as List?)!; - final Uint8List? arg_list = (args[0] as Uint8List?); + final arg_list = (args[0] as Uint8List?); assert( arg_list != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List was null, expected non-null Uint8List.', @@ -6255,8 +6242,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6290,8 +6276,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnumList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6325,8 +6310,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoClassList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6362,8 +6346,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullEnumList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6397,8 +6380,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullClassList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6434,8 +6416,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6469,8 +6450,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoStringMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6506,8 +6486,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoIntMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6541,8 +6520,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnumMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6576,8 +6554,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoClassMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6614,8 +6591,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullStringMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6651,8 +6627,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullIntMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6686,8 +6661,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullEnumMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6723,8 +6697,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullClassMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6761,8 +6734,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6776,7 +6748,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum was null.', ); final List args = (message as List?)!; - final AnEnum? arg_anEnum = (args[0] as AnEnum?); + final arg_anEnum = (args[0] as AnEnum?); assert( arg_anEnum != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum was null, expected non-null AnEnum.', @@ -6795,8 +6767,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6810,7 +6781,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum was null.', ); final List args = (message as List?)!; - final AnotherEnum? arg_anotherEnum = (args[0] as AnotherEnum?); + final arg_anotherEnum = (args[0] as AnotherEnum?); assert( arg_anotherEnum != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum was null, expected non-null AnotherEnum.', @@ -6829,8 +6800,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6844,7 +6814,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool was null.', ); final List args = (message as List?)!; - final bool? arg_aBool = (args[0] as bool?); + final arg_aBool = (args[0] as bool?); try { final bool? output = api.echoNullableBool(arg_aBool); return wrapResponse(result: output); @@ -6859,8 +6829,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6874,7 +6843,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt was null.', ); final List args = (message as List?)!; - final int? arg_anInt = (args[0] as int?); + final arg_anInt = (args[0] as int?); try { final int? output = api.echoNullableInt(arg_anInt); return wrapResponse(result: output); @@ -6889,8 +6858,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6904,7 +6872,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble was null.', ); final List args = (message as List?)!; - final double? arg_aDouble = (args[0] as double?); + final arg_aDouble = (args[0] as double?); try { final double? output = api.echoNullableDouble(arg_aDouble); return wrapResponse(result: output); @@ -6919,8 +6887,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6934,7 +6901,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString was null.', ); final List args = (message as List?)!; - final String? arg_aString = (args[0] as String?); + final arg_aString = (args[0] as String?); try { final String? output = api.echoNullableString(arg_aString); return wrapResponse(result: output); @@ -6949,8 +6916,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6964,7 +6930,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List was null.', ); final List args = (message as List?)!; - final Uint8List? arg_list = (args[0] as Uint8List?); + final arg_list = (args[0] as Uint8List?); try { final Uint8List? output = api.echoNullableUint8List(arg_list); return wrapResponse(result: output); @@ -6979,8 +6945,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7010,8 +6975,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnumList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7043,8 +7007,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableClassList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7076,8 +7039,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullEnumList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7109,8 +7071,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullClassList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7141,8 +7102,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7172,8 +7132,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableStringMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7205,8 +7164,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableIntMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7236,8 +7194,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnumMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7269,8 +7226,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableClassMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7302,8 +7258,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullStringMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7334,8 +7289,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullIntMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7367,8 +7321,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullEnumMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7400,8 +7353,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullClassMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7433,8 +7385,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7448,7 +7399,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum was null.', ); final List args = (message as List?)!; - final AnEnum? arg_anEnum = (args[0] as AnEnum?); + final arg_anEnum = (args[0] as AnEnum?); try { final AnEnum? output = api.echoNullableEnum(arg_anEnum); return wrapResponse(result: output); @@ -7463,8 +7414,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherNullableEnum$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7478,7 +7428,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherNullableEnum was null.', ); final List args = (message as List?)!; - final AnotherEnum? arg_anotherEnum = (args[0] as AnotherEnum?); + final arg_anotherEnum = (args[0] as AnotherEnum?); try { final AnotherEnum? output = api.echoAnotherNullableEnum( arg_anotherEnum, @@ -7495,8 +7445,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7519,8 +7468,7 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7534,7 +7482,7 @@ abstract class FlutterIntegrationCoreApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString was null.', ); final List args = (message as List?)!; - final String? arg_aString = (args[0] as String?); + final arg_aString = (args[0] as String?); assert( arg_aString != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString was null, expected non-null String.', @@ -7574,16 +7522,16 @@ class HostTrivialApi { final String pigeonVar_messageChannelSuffix; Future noop() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -7618,9 +7566,9 @@ class HostSmallApi { final String pigeonVar_messageChannelSuffix; Future echo(String aString) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -7629,7 +7577,7 @@ class HostSmallApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -7650,16 +7598,16 @@ class HostSmallApi { } Future voidVoid() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -7692,8 +7640,7 @@ abstract class FlutterSmallApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7707,7 +7654,7 @@ abstract class FlutterSmallApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList was null.', ); final List args = (message as List?)!; - final TestMessage? arg_msg = (args[0] as TestMessage?); + final arg_msg = (args[0] as TestMessage?); assert( arg_msg != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList was null, expected non-null TestMessage.', @@ -7726,8 +7673,7 @@ abstract class FlutterSmallApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -7741,7 +7687,7 @@ abstract class FlutterSmallApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString was null.', ); final List args = (message as List?)!; - final String? arg_aString = (args[0] as String?); + final arg_aString = (args[0] as String?); assert( arg_aString != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString was null, expected non-null String.', diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart index 7a652d525b2..3e5f4eb34aa 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart @@ -125,7 +125,7 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : EnumState.values[value]; case 130: return DataWithEnum.decode(readValue(buffer)!); @@ -155,9 +155,9 @@ class EnumApi2Host { /// This comment is to test method documentation comments. Future echo(DataWithEnum data) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Host.echo$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -166,7 +166,7 @@ class EnumApi2Host { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [data], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -203,8 +203,7 @@ abstract class EnumApi2Flutter { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Flutter.echo$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -218,7 +217,7 @@ abstract class EnumApi2Flutter { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Flutter.echo was null.', ); final List args = (message as List?)!; - final DataWithEnum? arg_data = (args[0] as DataWithEnum?); + final arg_data = (args[0] as DataWithEnum?); assert( arg_data != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Flutter.echo was null, expected non-null DataWithEnum.', diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_tests.gen.dart index 90b95c9d3d1..373a0b764de 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_tests.gen.dart @@ -526,10 +526,10 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : EventEnum.values[value]; case 130: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : AnotherEventEnum.values[value]; case 131: return EventAllNullableTypes.decode(readValue(buffer)!); @@ -561,7 +561,7 @@ Stream streamInts({String instanceName = ''}) { if (instanceName.isNotEmpty) { instanceName = '.$instanceName'; } - final EventChannel streamIntsChannel = EventChannel( + final streamIntsChannel = EventChannel( 'dev.flutter.pigeon.pigeon_integration_tests.EventChannelMethods.streamInts$instanceName', pigeonMethodCodec, ); @@ -574,7 +574,7 @@ Stream streamEvents({String instanceName = ''}) { if (instanceName.isNotEmpty) { instanceName = '.$instanceName'; } - final EventChannel streamEventsChannel = EventChannel( + final streamEventsChannel = EventChannel( 'dev.flutter.pigeon.pigeon_integration_tests.EventChannelMethods.streamEvents$instanceName', pigeonMethodCodec, ); @@ -587,7 +587,7 @@ Stream streamConsistentNumbers({String instanceName = ''}) { if (instanceName.isNotEmpty) { instanceName = '.$instanceName'; } - final EventChannel streamConsistentNumbersChannel = EventChannel( + final streamConsistentNumbersChannel = EventChannel( 'dev.flutter.pigeon.pigeon_integration_tests.EventChannelMethods.streamConsistentNumbers$instanceName', pigeonMethodCodec, ); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_without_classes_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_without_classes_tests.gen.dart index 052a18b0019..e999f8f1e8f 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_without_classes_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/event_channel_without_classes_tests.gen.dart @@ -41,7 +41,7 @@ Stream streamIntsAgain({String instanceName = ''}) { if (instanceName.isNotEmpty) { instanceName = '.$instanceName'; } - final EventChannel streamIntsAgainChannel = EventChannel( + final streamIntsAgainChannel = EventChannel( 'dev.flutter.pigeon.pigeon_integration_tests.EventChannelMethods.streamIntsAgain$instanceName', pigeonMethodCodec, ); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/flutter_unittests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/flutter_unittests.gen.dart index b72f676e84d..c74bb6eab2d 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/flutter_unittests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/flutter_unittests.gen.dart @@ -239,9 +239,9 @@ class Api { final String pigeonVar_messageChannelSuffix; Future search(FlutterSearchRequest request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.Api.search$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -250,7 +250,7 @@ class Api { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [request], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -271,9 +271,9 @@ class Api { } Future doSearches(FlutterSearchRequests request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.Api.doSearches$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -282,7 +282,7 @@ class Api { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [request], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -303,9 +303,9 @@ class Api { } Future echo(FlutterSearchRequests requests) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.Api.echo$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -314,7 +314,7 @@ class Api { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [requests], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -335,9 +335,9 @@ class Api { } Future anInt(int value) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.Api.anInt$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -346,7 +346,7 @@ class Api { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [value], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart index 1d708172886..1c22c8409b7 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart @@ -223,7 +223,7 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : MessageRequestState.values[value]; case 130: return MessageSearchRequest.decode(readValue(buffer)!); @@ -261,16 +261,16 @@ class MessageApi { /// /// This comment also tests multiple line comments. Future initialize() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.initialize$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -287,9 +287,9 @@ class MessageApi { /// This comment is to test method documentation comments. Future search(MessageSearchRequest request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.search$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -298,7 +298,7 @@ class MessageApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [request], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -341,9 +341,9 @@ class MessageNestedApi { /// /// This comment also tests multiple line comments. Future search(MessageNested nested) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.MessageNestedApi.search$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -352,7 +352,7 @@ class MessageNestedApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [nested], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -389,8 +389,7 @@ abstract class MessageFlutterSearchApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.MessageFlutterSearchApi.search$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -404,7 +403,7 @@ abstract class MessageFlutterSearchApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MessageFlutterSearchApi.search was null.', ); final List args = (message as List?)!; - final MessageSearchRequest? arg_request = + final arg_request = (args[0] as MessageSearchRequest?); assert( arg_request != null, diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/multiple_arity.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/multiple_arity.gen.dart index 0fceae13166..4c89e2396e9 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/multiple_arity.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/multiple_arity.gen.dart @@ -72,9 +72,9 @@ class MultipleArityHostApi { final String pigeonVar_messageChannelSuffix; Future subtract(int x, int y) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.MultipleArityHostApi.subtract$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -83,7 +83,7 @@ class MultipleArityHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [x, y], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -118,8 +118,7 @@ abstract class MultipleArityFlutterApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.MultipleArityFlutterApi.subtract$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -133,12 +132,12 @@ abstract class MultipleArityFlutterApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MultipleArityFlutterApi.subtract was null.', ); final List args = (message as List?)!; - final int? arg_x = (args[0] as int?); + final arg_x = (args[0] as int?); assert( arg_x != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MultipleArityFlutterApi.subtract was null, expected non-null int.', ); - final int? arg_y = (args[1] as int?); + final arg_y = (args[1] as int?); assert( arg_y != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MultipleArityFlutterApi.subtract was null, expected non-null int.', diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart index 7433ca9a50c..8d2ea7d41e5 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart @@ -212,7 +212,7 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : ReplyType.values[value]; case 130: return NonNullFieldSearchRequest.decode(readValue(buffer)!); @@ -246,9 +246,9 @@ class NonNullFieldHostApi { Future search( NonNullFieldSearchRequest nested, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.NonNullFieldHostApi.search$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -257,7 +257,7 @@ class NonNullFieldHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [nested], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -292,8 +292,7 @@ abstract class NonNullFieldFlutterApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.NonNullFieldFlutterApi.search$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -307,7 +306,7 @@ abstract class NonNullFieldFlutterApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NonNullFieldFlutterApi.search was null.', ); final List args = (message as List?)!; - final NonNullFieldSearchRequest? arg_request = + final arg_request = (args[0] as NonNullFieldSearchRequest?); assert( arg_request != null, diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart index 526d2717180..f818635df02 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart @@ -173,7 +173,7 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : NullFieldsSearchReplyType.values[value]; case 130: return NullFieldsSearchRequest.decode(readValue(buffer)!); @@ -203,9 +203,9 @@ class NullFieldsHostApi { final String pigeonVar_messageChannelSuffix; Future search(NullFieldsSearchRequest nested) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.NullFieldsHostApi.search$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -214,7 +214,7 @@ class NullFieldsHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [nested], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -249,8 +249,7 @@ abstract class NullFieldsFlutterApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.NullFieldsFlutterApi.search$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -264,7 +263,7 @@ abstract class NullFieldsFlutterApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NullFieldsFlutterApi.search was null.', ); final List args = (message as List?)!; - final NullFieldsSearchRequest? arg_request = + final arg_request = (args[0] as NullFieldsSearchRequest?); assert( arg_request != null, diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/nullable_returns.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/nullable_returns.gen.dart index 942aa7c039f..79109cb0546 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/nullable_returns.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/nullable_returns.gen.dart @@ -72,16 +72,16 @@ class NullableReturnHostApi { final String pigeonVar_messageChannelSuffix; Future doit() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.NullableReturnHostApi.doit$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -111,8 +111,7 @@ abstract class NullableReturnFlutterApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.NullableReturnFlutterApi.doit$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -155,9 +154,9 @@ class NullableArgHostApi { final String pigeonVar_messageChannelSuffix; Future doit(int? x) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.NullableArgHostApi.doit$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -166,7 +165,7 @@ class NullableArgHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [x], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -201,8 +200,7 @@ abstract class NullableArgFlutterApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.NullableArgFlutterApi.doit$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -216,7 +214,7 @@ abstract class NullableArgFlutterApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NullableArgFlutterApi.doit was null.', ); final List args = (message as List?)!; - final int? arg_x = (args[0] as int?); + final arg_x = (args[0] as int?); try { final int? output = api.doit(arg_x); return wrapResponse(result: output); @@ -251,16 +249,16 @@ class NullableCollectionReturnHostApi { final String pigeonVar_messageChannelSuffix; Future?> doit() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionReturnHostApi.doit$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -290,8 +288,7 @@ abstract class NullableCollectionReturnFlutterApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionReturnFlutterApi.doit$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -334,9 +331,9 @@ class NullableCollectionArgHostApi { final String pigeonVar_messageChannelSuffix; Future> doit(List? x) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgHostApi.doit$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -345,7 +342,7 @@ class NullableCollectionArgHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [x], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -380,8 +377,7 @@ abstract class NullableCollectionArgFlutterApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgFlutterApi.doit$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/primitive.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/primitive.gen.dart index 03becd18df6..6005ca5807d 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/primitive.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/primitive.gen.dart @@ -72,9 +72,9 @@ class PrimitiveHostApi { final String pigeonVar_messageChannelSuffix; Future anInt(int value) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.anInt$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -83,7 +83,7 @@ class PrimitiveHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [value], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -104,9 +104,9 @@ class PrimitiveHostApi { } Future aBool(bool value) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aBool$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -115,7 +115,7 @@ class PrimitiveHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [value], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -136,9 +136,9 @@ class PrimitiveHostApi { } Future aString(String value) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aString$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -147,7 +147,7 @@ class PrimitiveHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [value], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -168,9 +168,9 @@ class PrimitiveHostApi { } Future aDouble(double value) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aDouble$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -179,7 +179,7 @@ class PrimitiveHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [value], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -200,9 +200,9 @@ class PrimitiveHostApi { } Future> aMap(Map value) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -211,7 +211,7 @@ class PrimitiveHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [value], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -232,9 +232,9 @@ class PrimitiveHostApi { } Future> aList(List value) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -243,7 +243,7 @@ class PrimitiveHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [value], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -264,9 +264,9 @@ class PrimitiveHostApi { } Future anInt32List(Int32List value) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.anInt32List$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -275,7 +275,7 @@ class PrimitiveHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [value], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -296,9 +296,9 @@ class PrimitiveHostApi { } Future> aBoolList(List value) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aBoolList$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -307,7 +307,7 @@ class PrimitiveHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [value], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -328,9 +328,9 @@ class PrimitiveHostApi { } Future> aStringIntMap(Map value) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aStringIntMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -339,7 +339,7 @@ class PrimitiveHostApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [value], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -391,8 +391,7 @@ abstract class PrimitiveFlutterApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -406,7 +405,7 @@ abstract class PrimitiveFlutterApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt was null.', ); final List args = (message as List?)!; - final int? arg_value = (args[0] as int?); + final arg_value = (args[0] as int?); assert( arg_value != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt was null, expected non-null int.', @@ -425,8 +424,7 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBool$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -440,7 +438,7 @@ abstract class PrimitiveFlutterApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBool was null.', ); final List args = (message as List?)!; - final bool? arg_value = (args[0] as bool?); + final arg_value = (args[0] as bool?); assert( arg_value != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBool was null, expected non-null bool.', @@ -459,8 +457,7 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aString$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -474,7 +471,7 @@ abstract class PrimitiveFlutterApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aString was null.', ); final List args = (message as List?)!; - final String? arg_value = (args[0] as String?); + final arg_value = (args[0] as String?); assert( arg_value != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aString was null, expected non-null String.', @@ -493,8 +490,7 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aDouble$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -508,7 +504,7 @@ abstract class PrimitiveFlutterApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aDouble was null.', ); final List args = (message as List?)!; - final double? arg_value = (args[0] as double?); + final arg_value = (args[0] as double?); assert( arg_value != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aDouble was null, expected non-null double.', @@ -527,8 +523,7 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -542,7 +537,7 @@ abstract class PrimitiveFlutterApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aMap was null.', ); final List args = (message as List?)!; - final Map? arg_value = + final arg_value = (args[0] as Map?); assert( arg_value != null, @@ -562,8 +557,7 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -577,7 +571,7 @@ abstract class PrimitiveFlutterApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aList was null.', ); final List args = (message as List?)!; - final List? arg_value = (args[0] as List?); + final arg_value = (args[0] as List?); assert( arg_value != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aList was null, expected non-null List.', @@ -596,8 +590,7 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt32List$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -611,7 +604,7 @@ abstract class PrimitiveFlutterApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt32List was null.', ); final List args = (message as List?)!; - final Int32List? arg_value = (args[0] as Int32List?); + final arg_value = (args[0] as Int32List?); assert( arg_value != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt32List was null, expected non-null Int32List.', @@ -630,8 +623,7 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBoolList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -665,8 +657,7 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aStringIntMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart index 1e705c65071..bd496af8902 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart @@ -404,11 +404,11 @@ class PigeonInstanceManager { return PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); } WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInternalInstanceManagerApi api = + final api = _PigeonInternalInstanceManagerApi(); // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. api.clear(); - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (int identifier) { api.removeStrongReference(identifier); }, @@ -487,7 +487,7 @@ class PigeonInstanceManager { /// [identifier] is not removed first. This can be done with /// [removeWeakReference]. T? remove(int identifier) { - final T? instance = _weakInstances[identifier]?.target as T?; + final instance = _weakInstances[identifier]?.target as T?; assert( instance == null, 'A strong instance with identifier $identifier is being removed despite the weak reference still existing: $instance', @@ -587,8 +587,7 @@ class _PigeonInternalInstanceManagerApi { PigeonInstanceManager? instanceManager, }) { { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManager.removeStrongReference', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -602,7 +601,7 @@ class _PigeonInternalInstanceManagerApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManager.removeStrongReference was null.', ); final List args = (message as List?)!; - final int? arg_identifier = (args[0] as int?); + final arg_identifier = (args[0] as int?); assert( arg_identifier != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManager.removeStrongReference was null, expected non-null int.', @@ -625,9 +624,9 @@ class _PigeonInternalInstanceManagerApi { } Future removeStrongReference(int identifier) async { - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManager.removeStrongReference'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -636,7 +635,7 @@ class _PigeonInternalInstanceManagerApi { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [identifier], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -655,16 +654,16 @@ class _PigeonInternalInstanceManagerApi { /// /// This is typically called after a hot restart. Future clear() async { - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManager.clear'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -727,7 +726,7 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : ProxyApiTestEnum.values[value]; default: return super.readValueOfType(type, buffer); @@ -1068,9 +1067,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1117,7 +1116,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass nullableProxyApiParam, ]); () async { - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -1390,9 +1389,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.namedConstructor'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1421,7 +1420,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass aNullableProxyApi, ]); () async { - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -2212,14 +2211,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass Future Function(ProxyApiTestClass pigeon_instance, String aString)? flutterEchoAsyncString, }) { - final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + final pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance, ); - final BinaryMessenger? binaryMessenger = pigeon_binaryMessenger; + final binaryMessenger = pigeon_binaryMessenger; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterNoop', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2233,7 +2231,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterNoop was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, @@ -2256,8 +2254,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterThrowError', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2271,7 +2268,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterThrowError was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, @@ -2294,8 +2291,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterThrowErrorFromVoid', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2309,7 +2305,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterThrowErrorFromVoid was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, @@ -2332,8 +2328,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoBool', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2347,13 +2342,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoBool was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoBool was null, expected non-null ProxyApiTestClass.', ); - final bool? arg_aBool = (args[1] as bool?); + final arg_aBool = (args[1] as bool?); assert( arg_aBool != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoBool was null, expected non-null bool.', @@ -2377,8 +2372,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoInt', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2392,13 +2386,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoInt was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoInt was null, expected non-null ProxyApiTestClass.', ); - final int? arg_anInt = (args[1] as int?); + final arg_anInt = (args[1] as int?); assert( arg_anInt != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoInt was null, expected non-null int.', @@ -2422,8 +2416,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoDouble', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2437,13 +2430,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoDouble was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoDouble was null, expected non-null ProxyApiTestClass.', ); - final double? arg_aDouble = (args[1] as double?); + final arg_aDouble = (args[1] as double?); assert( arg_aDouble != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoDouble was null, expected non-null double.', @@ -2465,8 +2458,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoString', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2480,13 +2472,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoString was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoString was null, expected non-null ProxyApiTestClass.', ); - final String? arg_aString = (args[1] as String?); + final arg_aString = (args[1] as String?); assert( arg_aString != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoString was null, expected non-null String.', @@ -2508,8 +2500,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoUint8List', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2523,13 +2514,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoUint8List was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoUint8List was null, expected non-null ProxyApiTestClass.', ); - final Uint8List? arg_aList = (args[1] as Uint8List?); + final arg_aList = (args[1] as Uint8List?); assert( arg_aList != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoUint8List was null, expected non-null Uint8List.', @@ -2552,8 +2543,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoList', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2567,7 +2557,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoList was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, @@ -2598,8 +2588,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApiList', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2613,7 +2602,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApiList was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, @@ -2643,8 +2632,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoMap', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2658,7 +2646,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoMap was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, @@ -2689,8 +2677,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApiMap', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2704,7 +2691,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApiMap was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, @@ -2735,8 +2722,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoEnum', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2750,13 +2736,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoEnum was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoEnum was null, expected non-null ProxyApiTestClass.', ); - final ProxyApiTestEnum? arg_anEnum = (args[1] as ProxyApiTestEnum?); + final arg_anEnum = (args[1] as ProxyApiTestEnum?); assert( arg_anEnum != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoEnum was null, expected non-null ProxyApiTestEnum.', @@ -2780,8 +2766,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApi', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2795,13 +2780,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApi was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApi was null, expected non-null ProxyApiTestClass.', ); - final ProxyApiSuperClass? arg_aProxyApi = + final arg_aProxyApi = (args[1] as ProxyApiSuperClass?); assert( arg_aProxyApi != null, @@ -2825,8 +2810,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableBool', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2840,13 +2824,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableBool was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableBool was null, expected non-null ProxyApiTestClass.', ); - final bool? arg_aBool = (args[1] as bool?); + final arg_aBool = (args[1] as bool?); try { final bool? output = (flutterEchoNullableBool ?? @@ -2865,8 +2849,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableInt', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2880,13 +2863,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableInt was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableInt was null, expected non-null ProxyApiTestClass.', ); - final int? arg_anInt = (args[1] as int?); + final arg_anInt = (args[1] as int?); try { final int? output = (flutterEchoNullableInt ?? @@ -2905,8 +2888,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableDouble', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2920,13 +2902,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableDouble was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableDouble was null, expected non-null ProxyApiTestClass.', ); - final double? arg_aDouble = (args[1] as double?); + final arg_aDouble = (args[1] as double?); try { final double? output = (flutterEchoNullableDouble ?? @@ -2945,8 +2927,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableString', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -2960,13 +2941,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableString was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableString was null, expected non-null ProxyApiTestClass.', ); - final String? arg_aString = (args[1] as String?); + final arg_aString = (args[1] as String?); try { final String? output = (flutterEchoNullableString ?? @@ -2985,8 +2966,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableUint8List', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3000,13 +2980,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableUint8List was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableUint8List was null, expected non-null ProxyApiTestClass.', ); - final Uint8List? arg_aList = (args[1] as Uint8List?); + final arg_aList = (args[1] as Uint8List?); try { final Uint8List? output = (flutterEchoNullableUint8List ?? @@ -3025,8 +3005,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableList', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3040,7 +3019,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableList was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, @@ -3066,8 +3045,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableMap', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3081,7 +3059,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableMap was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, @@ -3107,8 +3085,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableEnum', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3122,13 +3099,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableEnum was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableEnum was null, expected non-null ProxyApiTestClass.', ); - final ProxyApiTestEnum? arg_anEnum = (args[1] as ProxyApiTestEnum?); + final arg_anEnum = (args[1] as ProxyApiTestEnum?); try { final ProxyApiTestEnum? output = (flutterEchoNullableEnum ?? @@ -3147,8 +3124,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableProxyApi', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3162,13 +3138,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableProxyApi was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableProxyApi was null, expected non-null ProxyApiTestClass.', ); - final ProxyApiSuperClass? arg_aProxyApi = + final arg_aProxyApi = (args[1] as ProxyApiSuperClass?); try { final ProxyApiSuperClass? output = @@ -3188,8 +3164,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterNoopAsync', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3203,7 +3178,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterNoopAsync was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, @@ -3225,8 +3200,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoAsyncString', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3240,13 +3214,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoAsyncString was null.', ); final List args = (message as List?)!; - final ProxyApiTestClass? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiTestClass?); assert( arg_pigeon_instance != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoAsyncString was null, expected non-null ProxyApiTestClass.', ); - final String? arg_aString = (args[1] as String?); + final arg_aString = (args[1] as String?); assert( arg_aString != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoAsyncString was null, expected non-null String.', @@ -3270,7 +3244,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass } ProxyApiSuperClass pigeonVar_attachedField() { - final ProxyApiSuperClass pigeonVar_instance = + final pigeonVar_instance = ProxyApiSuperClass.pigeon_detached( pigeon_binaryMessenger: pigeon_binaryMessenger, pigeon_instanceManager: pigeon_instanceManager, @@ -3281,9 +3255,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final int pigeonVar_instanceIdentifier = pigeon_instanceManager .addDartCreatedInstance(pigeonVar_instance); () async { - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.attachedField'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3292,7 +3266,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, pigeonVar_instanceIdentifier], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3310,18 +3284,18 @@ class ProxyApiTestClass extends ProxyApiSuperClass } static ProxyApiSuperClass pigeonVar_staticAttachedField() { - final ProxyApiSuperClass pigeonVar_instance = + final pigeonVar_instance = ProxyApiSuperClass.pigeon_detached(); - final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + final pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec(PigeonInstanceManager.instance); final BinaryMessenger pigeonVar_binaryMessenger = ServicesBinding.instance.defaultBinaryMessenger; final int pigeonVar_instanceIdentifier = PigeonInstanceManager.instance .addDartCreatedInstance(pigeonVar_instance); () async { - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.staticAttachedField'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3330,7 +3304,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [pigeonVar_instanceIdentifier], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3353,9 +3327,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.noop'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3364,7 +3338,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3384,9 +3358,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwError'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3395,7 +3369,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3415,9 +3389,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwErrorFromVoid'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3426,7 +3400,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3446,9 +3420,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwFlutterError'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3457,7 +3431,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3477,9 +3451,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoInt'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3488,7 +3462,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3513,9 +3487,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoDouble'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3524,7 +3498,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3549,9 +3523,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoBool'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3560,7 +3534,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3585,9 +3559,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoString'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3596,7 +3570,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3621,9 +3595,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoUint8List'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3632,7 +3606,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aUint8List], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3657,9 +3631,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoObject'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3668,7 +3642,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anObject], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3693,9 +3667,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoList'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3704,7 +3678,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3732,9 +3706,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoProxyApiList'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3743,7 +3717,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3769,9 +3743,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoMap'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3780,7 +3754,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3809,9 +3783,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoProxyApiMap'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3820,7 +3794,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3846,9 +3820,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoEnum'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3857,7 +3831,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3882,9 +3856,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoProxyApi'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3893,7 +3867,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aProxyApi], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3918,9 +3892,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableInt'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3929,7 +3903,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aNullableInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3949,9 +3923,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableDouble'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3960,7 +3934,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aNullableDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -3980,9 +3954,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableBool'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -3991,7 +3965,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aNullableBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4011,9 +3985,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableString'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4022,7 +3996,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aNullableString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4044,9 +4018,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableUint8List'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4055,7 +4029,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aNullableUint8List], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4075,9 +4049,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableObject'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4086,7 +4060,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aNullableObject], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4106,9 +4080,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableList'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4117,7 +4091,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aNullableList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4139,9 +4113,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableMap'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4150,7 +4124,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aNullableMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4172,9 +4146,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableEnum'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4183,7 +4157,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aNullableEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4205,9 +4179,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableProxyApi'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4216,7 +4190,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aNullableProxyApi], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4237,9 +4211,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.noopAsync'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4248,7 +4222,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4268,9 +4242,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncInt'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4279,7 +4253,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4304,9 +4278,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncDouble'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4315,7 +4289,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4340,9 +4314,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncBool'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4351,7 +4325,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4376,9 +4350,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncString'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4387,7 +4361,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4412,9 +4386,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncUint8List'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4423,7 +4397,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aUint8List], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4448,9 +4422,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncObject'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4459,7 +4433,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anObject], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4484,9 +4458,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncList'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4495,7 +4469,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4520,9 +4494,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncMap'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4531,7 +4505,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4557,9 +4531,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncEnum'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4568,7 +4542,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4593,9 +4567,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwAsyncError'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4604,7 +4578,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4624,9 +4598,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwAsyncErrorFromVoid'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4635,7 +4609,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4655,9 +4629,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwAsyncFlutterError'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4666,7 +4640,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4686,9 +4660,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableInt'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4697,7 +4671,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4717,9 +4691,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableDouble'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4728,7 +4702,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4748,9 +4722,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableBool'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4759,7 +4733,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4779,9 +4753,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableString'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4790,7 +4764,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4810,9 +4784,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableUint8List'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4821,7 +4795,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aUint8List], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4841,9 +4815,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableObject'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4852,7 +4826,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anObject], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4872,9 +4846,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableList'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4883,7 +4857,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4905,9 +4879,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableMap'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4916,7 +4890,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4939,9 +4913,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableEnum'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -4950,7 +4924,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -4972,21 +4946,21 @@ class ProxyApiTestClass extends ProxyApiSuperClass if (PigeonOverrides.proxyApiTestClass_staticNoop != null) { return PigeonOverrides.proxyApiTestClass_staticNoop!(); } - final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + final pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance, ); - final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + final pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.staticNoop'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5009,14 +4983,14 @@ class ProxyApiTestClass extends ProxyApiSuperClass if (PigeonOverrides.proxyApiTestClass_echoStaticString != null) { return PigeonOverrides.proxyApiTestClass_echoStaticString!(aString); } - final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + final pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance, ); - final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + final pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoStaticString'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5025,7 +4999,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5052,21 +5026,21 @@ class ProxyApiTestClass extends ProxyApiSuperClass if (PigeonOverrides.proxyApiTestClass_staticAsyncNoop != null) { return PigeonOverrides.proxyApiTestClass_staticAsyncNoop!(); } - final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + final pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance, ); - final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + final pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.staticAsyncNoop'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5085,9 +5059,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterNoop'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5096,7 +5070,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5115,9 +5089,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterThrowError'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5126,7 +5100,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5145,9 +5119,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterThrowErrorFromVoid'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5156,7 +5130,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5175,9 +5149,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoBool'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5186,7 +5160,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5210,9 +5184,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoInt'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5221,7 +5195,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5245,9 +5219,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoDouble'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5256,7 +5230,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5280,9 +5254,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoString'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5291,7 +5265,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5315,9 +5289,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoUint8List'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5326,7 +5300,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aUint8List], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5350,9 +5324,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoList'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5361,7 +5335,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5387,9 +5361,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoProxyApiList'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5398,7 +5372,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5425,9 +5399,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoMap'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5436,7 +5410,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5463,9 +5437,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoProxyApiMap'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5474,7 +5448,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5499,9 +5473,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoEnum'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5510,7 +5484,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5536,9 +5510,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoProxyApi'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5547,7 +5521,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aProxyApi], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5571,9 +5545,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableBool'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5582,7 +5556,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aBool], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5601,9 +5575,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableInt'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5612,7 +5586,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anInt], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5631,9 +5605,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableDouble'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5642,7 +5616,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aDouble], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5661,9 +5635,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableString'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5672,7 +5646,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5693,9 +5667,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableUint8List'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5704,7 +5678,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aUint8List], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5725,9 +5699,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableList'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5736,7 +5710,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aList], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5757,9 +5731,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableMap'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5768,7 +5742,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aMap], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5790,9 +5764,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableEnum'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5801,7 +5775,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, anEnum], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5822,9 +5796,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableProxyApi'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5833,7 +5807,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aProxyApi], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5852,9 +5826,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterNoopAsync'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5863,7 +5837,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5882,9 +5856,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiTestClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoAsyncString'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -5893,7 +5867,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this, aString], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -5991,9 +5965,9 @@ class ProxyApiSuperClass extends PigeonInternalProxyApiBaseClass { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiSuperClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -6003,7 +5977,7 @@ class ProxyApiSuperClass extends PigeonInternalProxyApiBaseClass { [pigeonVar_instanceIdentifier], ); () async { - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -6040,14 +6014,13 @@ class ProxyApiSuperClass extends PigeonInternalProxyApiBaseClass { PigeonInstanceManager? pigeon_instanceManager, ProxyApiSuperClass Function()? pigeon_newInstance, }) { - final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + final pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance, ); - final BinaryMessenger? binaryMessenger = pigeon_binaryMessenger; + final binaryMessenger = pigeon_binaryMessenger; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.pigeon_newInstance', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6061,7 +6034,7 @@ class ProxyApiSuperClass extends PigeonInternalProxyApiBaseClass { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.pigeon_newInstance was null.', ); final List args = (message as List?)!; - final int? arg_pigeon_instanceIdentifier = (args[0] as int?); + final arg_pigeon_instanceIdentifier = (args[0] as int?); assert( arg_pigeon_instanceIdentifier != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.pigeon_newInstance was null, expected non-null int.', @@ -6093,9 +6066,9 @@ class ProxyApiSuperClass extends PigeonInternalProxyApiBaseClass { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecProxyApiSuperClass; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.aSuperMethod'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -6104,7 +6077,7 @@ class ProxyApiSuperClass extends PigeonInternalProxyApiBaseClass { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -6169,14 +6142,13 @@ class ProxyApiInterface extends PigeonInternalProxyApiBaseClass { ProxyApiInterface Function()? pigeon_newInstance, void Function(ProxyApiInterface pigeon_instance)? anInterfaceMethod, }) { - final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + final pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance, ); - final BinaryMessenger? binaryMessenger = pigeon_binaryMessenger; + final binaryMessenger = pigeon_binaryMessenger; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.pigeon_newInstance', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6190,7 +6162,7 @@ class ProxyApiInterface extends PigeonInternalProxyApiBaseClass { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.pigeon_newInstance was null.', ); final List args = (message as List?)!; - final int? arg_pigeon_instanceIdentifier = (args[0] as int?); + final arg_pigeon_instanceIdentifier = (args[0] as int?); assert( arg_pigeon_instanceIdentifier != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.pigeon_newInstance was null, expected non-null int.', @@ -6218,8 +6190,7 @@ class ProxyApiInterface extends PigeonInternalProxyApiBaseClass { } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.anInterfaceMethod', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6233,7 +6204,7 @@ class ProxyApiInterface extends PigeonInternalProxyApiBaseClass { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.anInterfaceMethod was null.', ); final List args = (message as List?)!; - final ProxyApiInterface? arg_pigeon_instance = + final arg_pigeon_instance = (args[0] as ProxyApiInterface?); assert( arg_pigeon_instance != null, @@ -6290,9 +6261,9 @@ class ClassWithApiRequirement extends PigeonInternalProxyApiBaseClass { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecClassWithApiRequirement; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ClassWithApiRequirement.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -6302,7 +6273,7 @@ class ClassWithApiRequirement extends PigeonInternalProxyApiBaseClass { [pigeonVar_instanceIdentifier], ); () async { - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); @@ -6339,14 +6310,13 @@ class ClassWithApiRequirement extends PigeonInternalProxyApiBaseClass { PigeonInstanceManager? pigeon_instanceManager, ClassWithApiRequirement Function()? pigeon_newInstance, }) { - final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + final pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance, ); - final BinaryMessenger? binaryMessenger = pigeon_binaryMessenger; + final binaryMessenger = pigeon_binaryMessenger; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.ClassWithApiRequirement.pigeon_newInstance', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -6360,7 +6330,7 @@ class ClassWithApiRequirement extends PigeonInternalProxyApiBaseClass { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ClassWithApiRequirement.pigeon_newInstance was null.', ); final List args = (message as List?)!; - final int? arg_pigeon_instanceIdentifier = (args[0] as int?); + final arg_pigeon_instanceIdentifier = (args[0] as int?); assert( arg_pigeon_instanceIdentifier != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ClassWithApiRequirement.pigeon_newInstance was null, expected non-null int.', @@ -6392,9 +6362,9 @@ class ClassWithApiRequirement extends PigeonInternalProxyApiBaseClass { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecClassWithApiRequirement; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; - const String pigeonVar_channelName = + const pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ClassWithApiRequirement.aMethod'; - final BasicMessageChannel pigeonVar_channel = + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -6403,7 +6373,7 @@ class ClassWithApiRequirement extends PigeonInternalProxyApiBaseClass { final Future pigeonVar_sendFuture = pigeonVar_channel.send( [this], ); - final List? pigeonVar_replyList = + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/generated_dart_test_code_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/generated_dart_test_code_test.dart index 6c1b4e5510e..b50f49064aa 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/generated_dart_test_code_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/generated_dart_test_code_test.dart @@ -45,48 +45,48 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); group('equality method', () { - final List correctList = ['a', 2, 'three']; + final correctList = ['a', 2, 'three']; final List matchingList = correctList.toList(); - final List differentList = ['a', 2, 'three', 4.0]; - final Map correctMap = { + final differentList = ['a', 2, 'three', 4.0]; + final correctMap = { 'a': 1, 'b': 2, 'c': 'three', }; - final Map matchingMap = {...correctMap}; - final Map differentKeyMap = { + final matchingMap = {...correctMap}; + final differentKeyMap = { 'a': 1, 'b': 2, 'd': 'three', }; - final Map differentValueMap = { + final differentValueMap = { 'a': 1, 'b': 2, 'c': 'five', }; - final Map correctListInMap = { + final correctListInMap = { 'a': 1, 'b': 2, 'c': correctList, }; - final Map matchingListInMap = { + final matchingListInMap = { 'a': 1, 'b': 2, 'c': matchingList, }; - final Map differentListInMap = { + final differentListInMap = { 'a': 1, 'b': 2, 'c': differentList, }; - final List correctMapInList = ['a', 2, correctMap]; - final List matchingMapInList = ['a', 2, matchingMap]; - final List differentKeyMapInList = [ + final correctMapInList = ['a', 2, correctMap]; + final matchingMapInList = ['a', 2, matchingMap]; + final differentKeyMapInList = [ 'a', 2, differentKeyMap, ]; - final List differentValueMapInList = [ + final differentValueMapInList = [ 'a', 2, differentValueMap, @@ -102,15 +102,15 @@ void main() { test('equality method correctly identifies non-matching classes', () { final AllNullableTypes generic = genericAllNullableTypes; - final AllNullableTypes allNull = AllNullableTypes(); + final allNull = AllNullableTypes(); expect(allNull == generic, false); }); test( 'equality method correctly identifies non-matching lists in classes', () { - final AllNullableTypes withList = AllNullableTypes(list: correctList); - final AllNullableTypes withDifferentList = AllNullableTypes( + final withList = AllNullableTypes(list: correctList); + final withDifferentList = AllNullableTypes( list: differentList, ); expect(withList == withDifferentList, false); @@ -120,8 +120,8 @@ void main() { test( 'equality method correctly identifies matching -but unique- lists in classes', () { - final AllNullableTypes withList = AllNullableTypes(list: correctList); - final AllNullableTypes withDifferentList = AllNullableTypes( + final withList = AllNullableTypes(list: correctList); + final withDifferentList = AllNullableTypes( list: matchingList, ); expect(withList, withDifferentList); @@ -131,8 +131,8 @@ void main() { test( 'equality method correctly identifies non-matching keys in maps in classes', () { - final AllNullableTypes withMap = AllNullableTypes(map: correctMap); - final AllNullableTypes withDifferentMap = AllNullableTypes( + final withMap = AllNullableTypes(map: correctMap); + final withDifferentMap = AllNullableTypes( map: differentKeyMap, ); expect(withMap == withDifferentMap, false); @@ -142,8 +142,8 @@ void main() { test( 'equality method correctly identifies non-matching values in maps in classes', () { - final AllNullableTypes withMap = AllNullableTypes(map: correctMap); - final AllNullableTypes withDifferentMap = AllNullableTypes( + final withMap = AllNullableTypes(map: correctMap); + final withDifferentMap = AllNullableTypes( map: differentValueMap, ); expect(withMap == withDifferentMap, false); @@ -153,8 +153,8 @@ void main() { test( 'equality method correctly identifies matching -but unique- maps in classes', () { - final AllNullableTypes withMap = AllNullableTypes(map: correctMap); - final AllNullableTypes withDifferentMap = AllNullableTypes( + final withMap = AllNullableTypes(map: correctMap); + final withDifferentMap = AllNullableTypes( map: matchingMap, ); expect(withMap, withDifferentMap); @@ -164,10 +164,10 @@ void main() { test( 'equality method correctly identifies non-matching lists nested in maps in classes', () { - final AllNullableTypes withListInMap = AllNullableTypes( + final withListInMap = AllNullableTypes( map: correctListInMap, ); - final AllNullableTypes withDifferentListInMap = AllNullableTypes( + final withDifferentListInMap = AllNullableTypes( map: differentListInMap, ); expect(withListInMap == withDifferentListInMap, false); @@ -177,10 +177,10 @@ void main() { test( 'equality method correctly identifies matching -but unique- lists nested in maps in classes', () { - final AllNullableTypes withListInMap = AllNullableTypes( + final withListInMap = AllNullableTypes( map: correctListInMap, ); - final AllNullableTypes withDifferentListInMap = AllNullableTypes( + final withDifferentListInMap = AllNullableTypes( map: matchingListInMap, ); expect(withListInMap, withDifferentListInMap); @@ -190,10 +190,10 @@ void main() { test( 'equality method correctly identifies non-matching keys in maps nested in lists in classes', () { - final AllNullableTypes withMapInList = AllNullableTypes( + final withMapInList = AllNullableTypes( list: correctMapInList, ); - final AllNullableTypes withDifferentMapInList = AllNullableTypes( + final withDifferentMapInList = AllNullableTypes( list: differentKeyMapInList, ); expect(withMapInList == withDifferentMapInList, false); @@ -203,10 +203,10 @@ void main() { test( 'equality method correctly identifies non-matching values in maps nested in lists in classes', () { - final AllNullableTypes withMapInList = AllNullableTypes( + final withMapInList = AllNullableTypes( list: correctMapInList, ); - final AllNullableTypes withDifferentMapInList = AllNullableTypes( + final withDifferentMapInList = AllNullableTypes( list: differentValueMapInList, ); expect(withMapInList == withDifferentMapInList, false); @@ -216,10 +216,10 @@ void main() { test( 'equality method correctly identifies matching -but unique- maps nested in lists in classes', () { - final AllNullableTypes withMapInList = AllNullableTypes( + final withMapInList = AllNullableTypes( list: correctMapInList, ); - final AllNullableTypes withDifferentMapInList = AllNullableTypes( + final withDifferentMapInList = AllNullableTypes( list: matchingMapInList, ); expect(withMapInList, withDifferentMapInList); @@ -227,8 +227,8 @@ void main() { ); }); test('simple', () async { - final MessageNestedApi api = MessageNestedApi(); - final MockNested mock = MockNested(); + final api = MessageNestedApi(); + final mock = MockNested(); TestNestedApi.setUp(mock); final MessageSearchReply reply = await api.search( MessageNested()..request = null, @@ -238,8 +238,8 @@ void main() { }); test('nested', () async { - final MessageApi api = MessageApi(); - final Mock mock = Mock(); + final api = MessageApi(); + final mock = Mock(); TestHostApi.setUp(mock); final MessageSearchReply reply = await api.search( MessageSearchRequest()..query = 'foo', @@ -249,15 +249,15 @@ void main() { }); test('no-arg calls', () async { - final MessageApi api = MessageApi(); - final Mock mock = Mock(); + final api = MessageApi(); + final mock = Mock(); TestHostApi.setUp(mock); await api.initialize(); expect(mock.log, ['initialize']); }); test('calling methods with null', () async { - final Mock mock = Mock(); + final mock = Mock(); TestHostApi.setUp(mock); expect( await const BasicMessageChannel( diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/instance_manager_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/instance_manager_test.dart index c6c4506c972..9e79f9ff0be 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/instance_manager_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/instance_manager_test.dart @@ -11,11 +11,11 @@ import 'package:shared_test_plugin_code/src/generated/proxy_api_tests.gen.dart'; void main() { group('InstanceManager', () { test('addHostCreatedInstance', () { - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final CopyableObject object = CopyableObject( + final object = CopyableObject( pigeon_instanceManager: instanceManager, ); @@ -29,11 +29,11 @@ void main() { }); test('addHostCreatedInstance prevents already used objects and ids', () { - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final CopyableObject object = CopyableObject( + final object = CopyableObject( pigeon_instanceManager: instanceManager, ); @@ -54,11 +54,11 @@ void main() { }); test('addFlutterCreatedInstance', () { - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final CopyableObject object = CopyableObject( + final object = CopyableObject( pigeon_instanceManager: instanceManager, ); @@ -71,13 +71,13 @@ void main() { test('removeWeakReference', () { int? weakInstanceId; - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (int instanceId) { weakInstanceId = instanceId; }, ); - final CopyableObject object = CopyableObject( + final object = CopyableObject( pigeon_instanceManager: instanceManager, ); @@ -92,11 +92,11 @@ void main() { }); test('removeWeakReference removes only weak reference', () { - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final CopyableObject object = CopyableObject( + final object = CopyableObject( pigeon_instanceManager: instanceManager, ); @@ -110,11 +110,11 @@ void main() { }); test('remove', () { - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final CopyableObject object = CopyableObject( + final object = CopyableObject( pigeon_instanceManager: instanceManager, ); @@ -125,11 +125,11 @@ void main() { }); test('remove throws AssertionError if weak reference still exists', () { - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final CopyableObject object = CopyableObject( + final object = CopyableObject( pigeon_instanceManager: instanceManager, ); @@ -138,11 +138,11 @@ void main() { }); test('getInstance can add a new weak reference', () { - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) {}, ); - final CopyableObject object = CopyableObject( + final object = CopyableObject( pigeon_instanceManager: instanceManager, ); @@ -157,8 +157,8 @@ void main() { test( 'addDartCreatedInstance should add finalizer to original object', () async { - bool weakReferencedRemovedCalled = false; - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + var weakReferencedRemovedCalled = false; + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) { weakReferencedRemovedCalled = true; }, @@ -180,8 +180,8 @@ void main() { test( 'addHostCreatedInstance should not add finalizer to original object', () async { - bool weakReferencedRemovedCalled = false; - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + var weakReferencedRemovedCalled = false; + final instanceManager = PigeonInstanceManager( onWeakReferenceRemoved: (_) { weakReferencedRemovedCalled = true; }, @@ -203,7 +203,7 @@ void main() { testWidgets( 'instantiating default InstanceManager does not make a message call', (WidgetTester tester) async { - bool messageCallMade = false; + var messageCallMade = false; TestDefaultBinaryMessengerBinding .instance .defaultBinaryMessenger @@ -223,7 +223,7 @@ void main() { testWidgets( 'default InstanceManager does not make message call when weak reference is removed', (WidgetTester tester) async { - bool messageCallMade = false; + var messageCallMade = false; TestDefaultBinaryMessengerBinding .instance .defaultBinaryMessenger diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/multiple_arity_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/multiple_arity_test.dart index f7c8585bbdb..addb38f52d3 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/multiple_arity_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/multiple_arity_test.dart @@ -22,7 +22,7 @@ void main() { ).thenAnswer((Invocation realInvocation) async { final Object input = MultipleArityHostApi.pigeonChannelCodec .decodeMessage(realInvocation.positionalArguments[1] as ByteData?)!; - final List args = input as List; + final args = input as List; final int x = (args[0] as int?)!; final int y = (args[1] as int?)!; return MultipleArityHostApi.pigeonChannelCodec.encodeMessage([ @@ -30,7 +30,7 @@ void main() { ]); }); - final MultipleArityHostApi api = MultipleArityHostApi( + final api = MultipleArityHostApi( binaryMessenger: mockMessenger, ); final int result = await api.subtract(30, 10); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/non_null_fields_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/non_null_fields_test.dart index c05f31f0333..7c64f60c5db 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/non_null_fields_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/non_null_fields_test.dart @@ -7,7 +7,7 @@ import 'package:shared_test_plugin_code/src/generated/non_null_fields.gen.dart'; void main() { test('test constructor', () { - final NonNullFieldSearchRequest request = NonNullFieldSearchRequest( + final request = NonNullFieldSearchRequest( query: 'what?', ); expect(request.query, 'what?'); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_fields_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_fields_test.dart index 071cef316ec..6e6461e9528 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_fields_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_fields_test.dart @@ -7,12 +7,12 @@ import 'package:shared_test_plugin_code/src/generated/null_fields.gen.dart'; void main() { test('test constructor with values', () { - final NullFieldsSearchRequest request = NullFieldsSearchRequest( + final request = NullFieldsSearchRequest( query: 'query', identifier: 1, ); - final NullFieldsSearchReply reply = NullFieldsSearchReply( + final reply = NullFieldsSearchReply( result: 'result', error: 'error', indices: [1, 2, 3], @@ -28,7 +28,7 @@ void main() { }); test('test request constructor with nulls', () { - final NullFieldsSearchRequest request = NullFieldsSearchRequest( + final request = NullFieldsSearchRequest( identifier: 1, ); @@ -36,7 +36,7 @@ void main() { }); test('test reply constructor with nulls', () { - final NullFieldsSearchReply reply = NullFieldsSearchReply(); + final reply = NullFieldsSearchReply(); expect(reply.result, isNull); expect(reply.error, isNull); @@ -96,7 +96,7 @@ void main() { }); test('test request encode with values', () { - final NullFieldsSearchRequest request = NullFieldsSearchRequest( + final request = NullFieldsSearchRequest( query: 'query', identifier: 1, ); @@ -105,7 +105,7 @@ void main() { }); test('test request encode with null', () { - final NullFieldsSearchRequest request = NullFieldsSearchRequest( + final request = NullFieldsSearchRequest( identifier: 1, ); @@ -113,11 +113,11 @@ void main() { }); test('test reply encode with values', () { - final NullFieldsSearchRequest request = NullFieldsSearchRequest( + final request = NullFieldsSearchRequest( query: 'query', identifier: 1, ); - final NullFieldsSearchReply reply = NullFieldsSearchReply( + final reply = NullFieldsSearchReply( result: 'result', error: 'error', indices: [1, 2, 3], @@ -135,7 +135,7 @@ void main() { }); test('test reply encode with nulls', () { - final NullFieldsSearchReply reply = NullFieldsSearchReply(); + final reply = NullFieldsSearchReply(); expect(reply.encode(), [null, null, null, null, null]); }); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_safe_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_safe_test.dart index 405f48343b6..641c9b4af80 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_safe_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_safe_test.dart @@ -26,30 +26,30 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); test('with values filled', () { - final FlutterSearchReply reply = FlutterSearchReply() + final reply = FlutterSearchReply() ..result = 'foo' ..error = 'bar'; - final List encoded = reply.encode() as List; + final encoded = reply.encode() as List; final FlutterSearchReply decoded = FlutterSearchReply.decode(encoded); expect(reply.result, decoded.result); expect(reply.error, decoded.error); }); test('with null value', () { - final FlutterSearchReply reply = FlutterSearchReply() + final reply = FlutterSearchReply() ..result = 'foo' ..error = null; - final List encoded = reply.encode() as List; + final encoded = reply.encode() as List; final FlutterSearchReply decoded = FlutterSearchReply.decode(encoded); expect(reply.result, decoded.result); expect(reply.error, decoded.error); }); test('send/receive', () async { - final FlutterSearchRequest request = FlutterSearchRequest()..query = 'hey'; - final FlutterSearchReply reply = FlutterSearchReply()..result = 'ho'; + final request = FlutterSearchRequest()..query = 'hey'; + final reply = FlutterSearchReply()..result = 'ho'; final BinaryMessenger mockMessenger = MockBinaryMessenger(); - final Completer completer = Completer(); + final completer = Completer(); completer.complete(Api.pigeonChannelCodec.encodeMessage([reply])); final Future sendResult = completer.future; when( @@ -58,15 +58,15 @@ void main() { any, ), ).thenAnswer((Invocation realInvocation) => sendResult); - final Api api = Api(binaryMessenger: mockMessenger); + final api = Api(binaryMessenger: mockMessenger); final FlutterSearchReply readReply = await api.search(request); expect(readReply, isNotNull); expect(reply.result, readReply.result); }); test('send/receive list classes', () async { - final FlutterSearchRequest request = FlutterSearchRequest()..query = 'hey'; - final FlutterSearchRequests requests = FlutterSearchRequests() + final request = FlutterSearchRequest()..query = 'hey'; + final requests = FlutterSearchRequests() ..requests = [request]; final BinaryMessenger mockMessenger = MockBinaryMessenger(); echoOneArgument( @@ -74,7 +74,7 @@ void main() { 'dev.flutter.pigeon.pigeon_integration_tests.Api.echo', Api.pigeonChannelCodec, ); - final Api api = Api(binaryMessenger: mockMessenger); + final api = Api(binaryMessenger: mockMessenger); final FlutterSearchRequests echo = await api.echo(requests); expect(echo.requests!.length, 1); expect((echo.requests![0] as FlutterSearchRequest?)!.query, 'hey'); @@ -87,21 +87,21 @@ void main() { 'dev.flutter.pigeon.pigeon_integration_tests.Api.anInt', Api.pigeonChannelCodec, ); - final Api api = Api(binaryMessenger: mockMessenger); + final api = Api(binaryMessenger: mockMessenger); final int result = await api.anInt(1); expect(result, 1); }); test('return null to nonnull', () async { final BinaryMessenger mockMessenger = MockBinaryMessenger(); - const String channel = + const channel = 'dev.flutter.pigeon.pigeon_integration_tests.Api.anInt'; when(mockMessenger.send(channel, any)).thenAnswer(( Invocation realInvocation, ) async { return Api.pigeonChannelCodec.encodeMessage([null]); }); - final Api api = Api(binaryMessenger: mockMessenger); + final api = Api(binaryMessenger: mockMessenger); expect( () async => api.anInt(1), throwsA(const TypeMatcher()), @@ -110,14 +110,14 @@ void main() { test('send null parameter', () async { final BinaryMessenger mockMessenger = MockBinaryMessenger(); - const String channel = + const channel = 'dev.flutter.pigeon.pigeon_integration_tests.NullableArgHostApi.doit'; when(mockMessenger.send(channel, any)).thenAnswer(( Invocation realInvocation, ) async { return Api.pigeonChannelCodec.encodeMessage([123]); }); - final NullableArgHostApi api = NullableArgHostApi( + final api = NullableArgHostApi( binaryMessenger: mockMessenger, ); expect(await api.doit(null), 123); @@ -125,7 +125,7 @@ void main() { test('send null collection parameter', () async { final BinaryMessenger mockMessenger = MockBinaryMessenger(); - const String channel = + const channel = 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgHostApi.doit'; when(mockMessenger.send(channel, any)).thenAnswer(( Invocation realInvocation, @@ -134,20 +134,20 @@ void main() { ['123'], ]); }); - final NullableCollectionArgHostApi api = NullableCollectionArgHostApi( + final api = NullableCollectionArgHostApi( binaryMessenger: mockMessenger, ); expect(await api.doit(null), ['123']); }); test('receive null parameters', () { - final MockNullableArgFlutterApi mockFlutterApi = + final mockFlutterApi = MockNullableArgFlutterApi(); when(mockFlutterApi.doit(null)).thenReturn(14); NullableArgFlutterApi.setUp(mockFlutterApi); - final Completer resultCompleter = Completer(); + final resultCompleter = Completer(); binding.defaultBinaryMessenger.handlePlatformMessage( 'dev.flutter.pigeon.pigeon_integration_tests.NullableArgFlutterApi.doit', NullableArgFlutterApi.pigeonChannelCodec.encodeMessage([null]), @@ -168,13 +168,13 @@ void main() { }); test('receive null collection parameters', () { - final MockNullableCollectionArgFlutterApi mockFlutterApi = + final mockFlutterApi = MockNullableCollectionArgFlutterApi(); when(mockFlutterApi.doit(null)).thenReturn(['14']); NullableCollectionArgFlutterApi.setUp(mockFlutterApi); - final Completer> resultCompleter = Completer>(); + final resultCompleter = Completer>(); binding.defaultBinaryMessenger.handlePlatformMessage( 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgFlutterApi.doit', NullableCollectionArgFlutterApi.pigeonChannelCodec.encodeMessage( @@ -201,7 +201,7 @@ void main() { test('receive null return', () async { final BinaryMessenger mockMessenger = MockBinaryMessenger(); - const String channel = + const channel = 'dev.flutter.pigeon.pigeon_integration_tests.NullableReturnHostApi.doit'; when(mockMessenger.send(channel, any)).thenAnswer(( Invocation realInvocation, @@ -210,7 +210,7 @@ void main() { null, ]); }); - final NullableReturnHostApi api = NullableReturnHostApi( + final api = NullableReturnHostApi( binaryMessenger: mockMessenger, ); expect(await api.doit(), null); @@ -218,7 +218,7 @@ void main() { test('receive null collection return', () async { final BinaryMessenger mockMessenger = MockBinaryMessenger(); - const String channel = + const channel = 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionReturnHostApi.doit'; when(mockMessenger.send(channel, any)).thenAnswer(( Invocation realInvocation, @@ -227,20 +227,20 @@ void main() { [null], ); }); - final NullableCollectionReturnHostApi api = NullableCollectionReturnHostApi( + final api = NullableCollectionReturnHostApi( binaryMessenger: mockMessenger, ); expect(await api.doit(), null); }); test('send null return', () async { - final MockNullableReturnFlutterApi mockFlutterApi = + final mockFlutterApi = MockNullableReturnFlutterApi(); when(mockFlutterApi.doit()).thenReturn(null); NullableReturnFlutterApi.setUp(mockFlutterApi); - final Completer resultCompleter = Completer(); + final resultCompleter = Completer(); unawaited( binding.defaultBinaryMessenger.handlePlatformMessage( 'dev.flutter.pigeon.pigeon_integration_tests.NullableReturnFlutterApi.doit', @@ -258,13 +258,13 @@ void main() { }); test('send null collection return', () async { - final MockNullableCollectionReturnFlutterApi mockFlutterApi = + final mockFlutterApi = MockNullableCollectionReturnFlutterApi(); when(mockFlutterApi.doit()).thenReturn(null); NullableCollectionReturnFlutterApi.setUp(mockFlutterApi); - final Completer?> resultCompleter = + final resultCompleter = Completer?>(); unawaited( binding.defaultBinaryMessenger.handlePlatformMessage( diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/primitive_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/primitive_test.dart index d81640b5e5a..61a2305ae85 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/primitive_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/primitive_test.dart @@ -20,7 +20,7 @@ void main() { 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.anInt', PrimitiveHostApi.pigeonChannelCodec, ); - final PrimitiveHostApi api = PrimitiveHostApi( + final api = PrimitiveHostApi( binaryMessenger: mockMessenger, ); final int result = await api.anInt(1); @@ -34,7 +34,7 @@ void main() { 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aBoolList', PrimitiveHostApi.pigeonChannelCodec, ); - final PrimitiveHostApi api = PrimitiveHostApi( + final api = PrimitiveHostApi( binaryMessenger: mockMessenger, ); final List result = await api.aBoolList([true]); @@ -51,7 +51,7 @@ void main() { any, ), ).thenAnswer((Invocation realInvocation) { - final MessageHandler? handler = + final handler = realInvocation.positionalArguments[1] as MessageHandler?; handler!( PrimitiveFlutterApi.pigeonChannelCodec.encodeMessage([ @@ -70,7 +70,7 @@ void main() { 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aStringIntMap', PrimitiveHostApi.pigeonChannelCodec, ); - final PrimitiveHostApi api = PrimitiveHostApi( + final api = PrimitiveHostApi( binaryMessenger: mockMessenger, ); final Map result = await api.aStringIntMap({ diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/proxy_api_overrides_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/proxy_api_overrides_test.dart index 3c0e4b8e334..f7d5ac0a20e 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/proxy_api_overrides_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/proxy_api_overrides_test.dart @@ -9,7 +9,7 @@ void main() { test('can override ProxyApi constructors', () { PigeonOverrides.pigeon_reset(); - final ProxyApiSuperClass instance = ProxyApiSuperClass.pigeon_detached(); + final instance = ProxyApiSuperClass.pigeon_detached(); PigeonOverrides.proxyApiSuperClass_new = () => instance; expect(ProxyApiSuperClass(), instance); @@ -18,7 +18,7 @@ void main() { test('can override ProxyApi static attached fields', () { PigeonOverrides.pigeon_reset(); - final ProxyApiSuperClass instance = ProxyApiSuperClass.pigeon_detached(); + final instance = ProxyApiSuperClass.pigeon_detached(); PigeonOverrides.proxyApiTestClass_staticAttachedField = instance; expect(ProxyApiTestClass.staticAttachedField, instance); @@ -31,7 +31,7 @@ void main() { return value; }; - const String value = 'testString'; + const value = 'testString'; expect(await ProxyApiTestClass.echoStaticString(value), value); }); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_message.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_message.gen.dart index 59d3481b3af..36fd178517a 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_message.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_message.gen.dart @@ -42,7 +42,7 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : MessageRequestState.values[value]; case 130: return MessageSearchRequest.decode(readValue(buffer)!); @@ -81,8 +81,7 @@ abstract class TestHostApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.initialize$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -112,8 +111,7 @@ abstract class TestHostApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.search$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -131,7 +129,7 @@ abstract class TestHostApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MessageApi.search was null.', ); final List args = (message as List?)!; - final MessageSearchRequest? arg_request = + final arg_request = (args[0] as MessageSearchRequest?); assert( arg_request != null, @@ -176,8 +174,7 @@ abstract class TestNestedApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.pigeon_integration_tests.MessageNestedApi.search$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -195,7 +192,7 @@ abstract class TestNestedApi { 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MessageNestedApi.search was null.', ); final List args = (message as List?)!; - final MessageNested? arg_nested = (args[0] as MessageNested?); + final arg_nested = (args[0] as MessageNested?); assert( arg_nested != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MessageNestedApi.search was null, expected non-null MessageNested.', diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_util.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_util.dart index abea719758a..accc779e392 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_util.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_util.dart @@ -16,7 +16,7 @@ void echoOneArgument( final Object input = codec.decodeMessage( realInvocation.positionalArguments[1] as ByteData?, )!; - final List args = input as List; + final args = input as List; return codec.encodeMessage([args[0]!]); }); } diff --git a/packages/pigeon/test/ast_generator_test.dart b/packages/pigeon/test/ast_generator_test.dart index b6aad753352..98a74f8a25d 100644 --- a/packages/pigeon/test/ast_generator_test.dart +++ b/packages/pigeon/test/ast_generator_test.dart @@ -8,7 +8,7 @@ import 'package:test/test.dart'; void main() { test('gen one class', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -17,14 +17,14 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); + final sink = StringBuffer(); generateAst(root, sink); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('Foobar')); expect(code, contains('dataType1')); expect(code, contains('field1')); diff --git a/packages/pigeon/test/cpp_generator_test.dart b/packages/pigeon/test/cpp_generator_test.dart index 0662261b9ee..36349f390b0 100644 --- a/packages/pigeon/test/cpp_generator_test.dart +++ b/packages/pigeon/test/cpp_generator_test.dart @@ -27,7 +27,7 @@ final Enum emptyEnum = Enum( void main() { test('gen one api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -77,9 +77,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -94,16 +94,16 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Input')); expect(code, contains('class Output')); expect(code, contains('class Api')); expect(code, contains('virtual ~Api() {}\n')); } { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -118,7 +118,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('Input::Input()')); expect(code, contains('Output::Output')); expect( @@ -135,14 +135,14 @@ void main() { }); test('naming follows style', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [ EnumMember(name: 'one'), EnumMember(name: 'fortyTwo'), ], ); - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -200,9 +200,9 @@ void main() { enums: [anEnum], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -217,7 +217,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // Method name and argument names should be adjusted. expect(code, contains(' DoSomething(const Input& some_input)')); // Getters and setters should use optional getter/setter style. @@ -233,9 +233,9 @@ void main() { expect(code, contains('kFortyTwo')); } { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -250,7 +250,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('encodable_some_input')); expect(code, contains('Output::output_field()')); expect(code, contains('Output::set_output_field(bool value_arg)')); @@ -258,7 +258,7 @@ void main() { }); test('FlutterError fields are private with public accessors', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -287,9 +287,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -304,7 +304,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code.split('\n'), @@ -326,7 +326,7 @@ void main() { }); test('Error field is private with public accessors', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -356,9 +356,9 @@ void main() { containsHostApi: true, ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -373,7 +373,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code.split('\n'), @@ -391,7 +391,7 @@ void main() { }); test('Spaces before {', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -441,9 +441,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -458,14 +458,14 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(contains('){'))); expect(code, isNot(contains('const{'))); } { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -480,14 +480,14 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(contains('){'))); expect(code, isNot(contains('const{'))); } }); test('include blocks follow style', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -516,9 +516,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -533,7 +533,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains(''' @@ -549,9 +549,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -566,7 +566,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains(''' @@ -586,7 +586,7 @@ void main() { }); test('namespaces follows style', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -615,9 +615,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -633,14 +633,14 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('namespace foo {')); expect(code, contains('} // namespace foo')); } { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -656,14 +656,14 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('namespace foo {')); expect(code, contains('} // namespace foo')); } }); test('data classes handle nullable fields', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -725,9 +725,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -742,7 +742,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // There should be a default constructor. expect(code, contains('Nested();')); @@ -788,9 +788,9 @@ void main() { expect(code, contains('std::unique_ptr nullable_nested_')); } { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -805,7 +805,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // There should be a default constructor. expect(code, contains('Nested::Nested() {}')); @@ -893,7 +893,7 @@ void main() { }); test('data classes handle non-nullable fields', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -958,9 +958,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -975,7 +975,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // There should not be a default constructor. expect(code, isNot(contains('Nested();'))); @@ -1012,9 +1012,9 @@ void main() { expect(code, contains('std::unique_ptr non_nullable_nested_;')); } { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -1029,7 +1029,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // There should not be a default constructor. expect(code, isNot(contains('Nested::Nested() {}'))); @@ -1074,7 +1074,7 @@ void main() { }); test('host nullable return types map correctly', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1158,9 +1158,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -1175,7 +1175,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('ErrorOr> ReturnNullableBool()'), @@ -1210,7 +1210,7 @@ void main() { }); test('host non-nullable return types map correctly', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1294,9 +1294,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -1311,7 +1311,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('ErrorOr ReturnBool()')); expect(code, contains('ErrorOr ReturnInt()')); expect(code, contains('ErrorOr ReturnString()')); @@ -1322,7 +1322,7 @@ void main() { }); test('host nullable arguments map correctly', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1408,9 +1408,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -1425,7 +1425,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1443,9 +1443,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -1460,7 +1460,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // Most types should just use get_if, since the parameter is a pointer, // and get_if will automatically handle null values (since a null // EncodableValue will not match the queried type, so get_if will return @@ -1520,7 +1520,7 @@ void main() { }); test('host non-nullable arguments map correctly', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1606,9 +1606,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -1623,7 +1623,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1641,9 +1641,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -1658,7 +1658,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // Most types should extract references. Since the type is non-nullable, // there's only one possible type. expect( @@ -1712,7 +1712,7 @@ void main() { }); test('flutter nullable arguments map correctly', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1801,9 +1801,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -1818,7 +1818,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // Nullable arguments should all be pointers. This will make them somewhat // awkward for some uses (literals, values that could be inlined) but // unlike setters there's no way to provide reference-based alternatives @@ -1855,9 +1855,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -1872,7 +1872,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // All types pass nulls values when the pointer is null. // Standard types are wrapped an EncodableValues. expect( @@ -1908,7 +1908,7 @@ void main() { }); test('flutter non-nullable arguments map correctly', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1997,9 +1997,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -2014,7 +2014,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2045,9 +2045,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -2062,7 +2062,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // Standard types are wrapped in EncodableValues. expect(code, contains('EncodableValue(a_bool_arg)')); expect(code, contains('EncodableValue(an_int_arg)')); @@ -2075,7 +2075,7 @@ void main() { }); test('host API argument extraction uses references', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2101,9 +2101,9 @@ void main() { enums: [], ); - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -2118,7 +2118,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // A bare 'auto' here would create a copy, not a reference, which is // inefficient. expect( @@ -2129,7 +2129,7 @@ void main() { }); test('enum argument', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Bar', @@ -2175,7 +2175,7 @@ void main() { }); test('transfers documentation comments', () { - final List comments = [ + final comments = [ ' api comment', ' api method comment', ' class comment', @@ -2183,12 +2183,12 @@ void main() { ' enum comment', ' enum member comment', ]; - int count = 0; + var count = 0; - final List unspacedComments = ['////////']; - int unspacedCount = 0; + final unspacedComments = ['////////']; + var unspacedCount = 0; - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -2249,9 +2249,9 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -2266,15 +2266,15 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); - for (final String comment in comments) { + final code = sink.toString(); + for (final comment in comments) { expect(code, contains('//$comment')); } expect(code, contains('// ///')); }); test('creates custom codecs', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -2324,9 +2324,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalCppOptions( @@ -2341,12 +2341,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains(' : public flutter::StandardCodecSerializer')); }); test('Does not send unwrapped EncodableLists', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2424,9 +2424,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -2441,13 +2441,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(contains('reply(wrap'))); expect(code, contains('reply(EncodableValue(')); }); test('does not keep unowned references in async handlers', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'HostApi', @@ -2513,9 +2513,9 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -2530,7 +2530,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // Nothing should be captured by reference for async handlers, since their // lifetime is unknown (and expected to be longer than the stack's). expect(code, isNot(contains('&reply'))); @@ -2542,7 +2542,7 @@ void main() { }); test('connection error contains channel name', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -2568,9 +2568,9 @@ void main() { enums: [], containsFlutterApi: true, ); - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -2585,7 +2585,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2596,7 +2596,7 @@ void main() { }); test('stack allocates the message channel.', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -2621,9 +2621,9 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const CppGenerator generator = CppGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = CppGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalCppOptions( @@ -2638,7 +2638,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( diff --git a/packages/pigeon/test/dart/proxy_api_test.dart b/packages/pigeon/test/dart/proxy_api_test.dart index cfa6bafb6f8..96cc794593e 100644 --- a/packages/pigeon/test/dart/proxy_api_test.dart +++ b/packages/pigeon/test/dart/proxy_api_test.dart @@ -11,7 +11,7 @@ const String DEFAULT_PACKAGE_NAME = 'test_package'; void main() { group('ProxyApi', () { test('one api', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -77,15 +77,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); // Instance Manager @@ -137,7 +137,7 @@ void main() { }); test('InstanceManagerApi', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -149,15 +149,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect(code, contains(r'class _PigeonInternalInstanceManagerApi')); @@ -190,7 +190,7 @@ void main() { group('ProxyApi base class', () { test('class name', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -202,15 +202,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, @@ -219,7 +219,7 @@ void main() { }); test('InstanceManager field', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -231,15 +231,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( @@ -254,13 +254,13 @@ void main() { group('inheritance', () { test('extends', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -278,15 +278,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect(code, contains(r'class Api extends Api2')); expect( @@ -298,13 +298,13 @@ void main() { }); test('implements', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -324,15 +324,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -342,19 +342,19 @@ void main() { }); test('implements 2 ProxyApis', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final AstProxyApi api3 = AstProxyApi( + final api3 = AstProxyApi( name: 'Api3', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -380,15 +380,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -398,7 +398,7 @@ void main() { }); test('implements inherits flutter methods', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], @@ -418,7 +418,7 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -438,15 +438,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( code, @@ -468,7 +468,7 @@ void main() { group('Constructors', () { test('empty name and no params constructor', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -482,15 +482,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect(code, contains('class Api')); expect( @@ -528,11 +528,11 @@ void main() { }); test('multiple params constructor', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -600,15 +600,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect(code, contains('class Api')); expect( @@ -651,11 +651,11 @@ void main() { group('Fields', () { test('constructor with fields', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -720,15 +720,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect(code, contains('class Api')); expect( @@ -775,13 +775,13 @@ void main() { }); test('attached field', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -804,28 +804,28 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Api')); expect(code, contains(r'late final Api2 aField = pigeonVar_aField();')); expect(code, contains(r'Api2 pigeonVar_aField()')); }); test('static attached field', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -849,15 +849,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Api')); expect( code, @@ -875,11 +875,11 @@ void main() { group('Host methods', () { test('multiple params method', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -949,15 +949,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect(code, contains('class Api')); expect( @@ -980,7 +980,7 @@ void main() { }); test('static method', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -1000,15 +1000,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect(code, contains('class Api')); expect( @@ -1025,11 +1025,11 @@ void main() { group('Flutter methods', () { test('multiple params flutter method', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -1094,15 +1094,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect(code, contains('class Api')); expect( @@ -1180,7 +1180,7 @@ void main() { /// void method( int param1, int param2, ) /// ``` String _collapseNewlineAndIndentation(String string) { - final StringBuffer result = StringBuffer(); + final result = StringBuffer(); for (final String line in string.split('\n')) { result.write('${line.trimLeft()} '); } diff --git a/packages/pigeon/test/dart_generator_test.dart b/packages/pigeon/test/dart_generator_test.dart index f159cdaf48d..c084ab70344 100644 --- a/packages/pigeon/test/dart_generator_test.dart +++ b/packages/pigeon/test/dart_generator_test.dart @@ -29,7 +29,7 @@ final Enum emptyEnum = Enum( void main() { test('gen one class', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -42,53 +42,53 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Foobar')); expect(code, contains(' dataType1? field1;')); }); test('gen one enum', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'Foobar', members: [ EnumMember(name: 'one'), EnumMember(name: 'two'), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('enum Foobar')); expect(code, contains(' one,')); expect(code, contains(' two,')); }); test('gen one host api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -137,21 +137,21 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Api')); expect(code, contains('Future doSomething(Input input)')); }); test('host multiple args', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -186,15 +186,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Api')); expect(code, contains('Future add(int x, int y)')); expect( @@ -207,7 +207,7 @@ void main() { }); test('flutter multiple args', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -242,15 +242,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Api')); expect(code, contains('int add(int x, int y)')); expect( @@ -263,7 +263,7 @@ void main() { }); test('nested class', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -291,21 +291,21 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('nested,')); expect(code, contains('nested: result[0] as Input?')); }); test('nested non-nullable class', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -336,21 +336,21 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('nested,')); expect(code, contains('nested: result[0]! as Input')); }); test('flutterApi', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -399,22 +399,22 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('abstract class Api')); expect(code, contains('static void setUp(Api')); expect(code, contains('Output doSomething(Input input)')); }); test('host void', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -450,21 +450,21 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('Future doSomething')); expect(code, contains('return;')); }); test('flutter void return', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -500,15 +500,15 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // The next line verifies that we're not setting a variable to the value of "doSomething", but // ignores the line where we assert the value of the argument isn't null, since on that line // we mention "doSomething" in the assertion message. @@ -517,7 +517,7 @@ void main() { }); test('flutter void argument', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -548,21 +548,21 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, matches('output.*=.*doSomething[(][)]')); expect(code, contains('Output doSomething();')); }); test('flutter enum argument with enum class', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -614,15 +614,15 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('return value == null ? null : Enum.values[value];')); expect(code, contains('writeValue(buffer, value.index);')); expect( @@ -633,7 +633,7 @@ void main() { }); test('primitive enum host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Bar', @@ -667,15 +667,15 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('enum Foo {')); expect(code, contains('Future bar(Foo? foo) async')); expect( @@ -686,7 +686,7 @@ void main() { }); test('flutter non-nullable enum argument with enum class', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -738,22 +738,22 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('writeValue(buffer, value.index)')); expect(code, contains('return value == null ? null : Enum.values[value];')); expect(code, contains('enum1: result[0]! as Enum,')); }); test('host void argument', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -784,15 +784,15 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, matches('pigeonVar_sendFuture = pigeonVar_channel.send[(]null[)]'), @@ -800,7 +800,7 @@ void main() { }); test('mock Dart handler', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -865,16 +865,16 @@ void main() { ], enums: [], ); - final StringBuffer mainCodeSink = StringBuffer(); - final StringBuffer testCodeSink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final mainCodeSink = StringBuffer(); + final testCodeSink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, mainCodeSink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String mainCode = mainCodeSink.toString(); + final mainCode = mainCodeSink.toString(); expect(mainCode, isNot(contains(r"import 'fo\'o.dart';"))); expect(mainCode, contains('class Api {')); expect(mainCode, isNot(contains('abstract class ApiMock'))); @@ -882,7 +882,7 @@ void main() { expect(mainCode, isNot(contains("'${Keys.result}': output"))); expect(mainCode, isNot(contains('return [];'))); - const DartGenerator testGenerator = DartGenerator(); + const testGenerator = DartGenerator(); testGenerator.generateTest( const InternalDartOptions(dartOut: "fo'o.dart", testOut: 'test.dart'), root, @@ -890,7 +890,7 @@ void main() { dartPackageName: DEFAULT_PACKAGE_NAME, dartOutputPackageName: DEFAULT_PACKAGE_NAME, ); - final String testCode = testCodeSink.toString(); + final testCode = testCodeSink.toString(); expect(testCode, contains(r"import 'fo\'o.dart';")); expect(testCode, isNot(contains('class Api {'))); expect(testCode, contains('abstract class ApiMock')); @@ -900,7 +900,7 @@ void main() { }); test('gen one async Flutter Api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -950,15 +950,15 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('abstract class Api')); expect(code, contains('Future doSomething(Input input);')); expect( @@ -968,7 +968,7 @@ void main() { }); test('gen one async Flutter Api with void return', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1014,22 +1014,22 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(matches('=.s*doSomething'))); expect(code, contains('await api.doSomething(')); expect(code, isNot(contains('._toMap()'))); }); test('gen one async Host Api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1079,21 +1079,21 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Api')); expect(code, matches('Output.*doSomething.*Input')); }); test('async host void argument', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1125,15 +1125,15 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, matches('pigeonVar_channel.send[(]null[)]')); }); @@ -1142,22 +1142,22 @@ void main() { } test('header', () { - final Root root = Root(apis: [], classes: [], enums: []); - final StringBuffer sink = StringBuffer(); + final root = Root(apis: [], classes: [], enums: []); + final sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + const generator = DartGenerator(); generator.generate( InternalDartOptions(copyrightHeader: makeIterable('hello world')), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, startsWith('// hello world')); }); test('generics', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -1172,26 +1172,26 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Foobar')); expect(code, contains(' List? field1;')); }); test('map generics', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -1207,26 +1207,26 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Foobar')); expect(code, contains(' Map? field1;')); }); test('host generics argument', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1254,20 +1254,20 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('doit(List arg')); }); test('flutter generics argument with void return', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1295,20 +1295,20 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('doit(List arg')); }); test('host generics return', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1331,15 +1331,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('Future> doit(')); expect( code, @@ -1350,7 +1350,7 @@ void main() { }); test('flutter generics argument non void return', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1384,15 +1384,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('List doit(')); expect( code, @@ -1404,7 +1404,7 @@ void main() { }); test('return nullable host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1424,21 +1424,21 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('Future doit()')); expect(code, contains('return (pigeonVar_replyList[0] as int?);')); }); test('return nullable collection host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1461,15 +1461,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('Future?> doit()')); expect( code, @@ -1480,7 +1480,7 @@ void main() { }); test('return nullable async host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1501,21 +1501,21 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('Future doit()')); expect(code, contains('return (pigeonVar_replyList[0] as int?);')); }); test('return nullable flutter', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1535,21 +1535,21 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('int? doit();')); expect(code, contains('final int? output = api.doit();')); }); test('return nullable async flutter', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1570,21 +1570,21 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('Future doit();')); expect(code, contains('final int? output = await api.doit();')); }); test('platform error for return nil on nonnull', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1604,15 +1604,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('Host platform returned null value for non-null return value.'), @@ -1620,7 +1620,7 @@ void main() { }); test('nullable argument host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1645,20 +1645,20 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('Future doit(int? foo) async {')); }); test('nullable argument flutter', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1683,20 +1683,20 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('void doit(int? foo);')); }); test('named argument flutter', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1723,38 +1723,38 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('void doit({required int foo});')); expect(code, contains('api.doit(foo: arg_foo!)')); }); test('uses output package name for imports', () { - const String overriddenPackageName = 'custom_name'; - const String outputPackageName = 'some_output_package'; + const overriddenPackageName = 'custom_name'; + const outputPackageName = 'some_output_package'; assert(outputPackageName != DEFAULT_PACKAGE_NAME); final Directory tempDir = Directory.systemTemp.createTempSync('pigeon'); try { - final Directory foo = Directory(path.join(tempDir.path, 'lib', 'foo')); + final foo = Directory(path.join(tempDir.path, 'lib', 'foo')); foo.createSync(recursive: true); - final File pubspecFile = File(path.join(tempDir.path, 'pubspec.yaml')); + final pubspecFile = File(path.join(tempDir.path, 'pubspec.yaml')); pubspecFile.writeAsStringSync(''' name: foobar '''); - final Root root = Root( + final root = Root( classes: [], apis: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator testGenerator = DartGenerator(); + final sink = StringBuffer(); + const testGenerator = DartGenerator(); testGenerator.generateTest( InternalDartOptions( dartOut: path.join(foo.path, 'bar.dart'), @@ -1765,7 +1765,7 @@ name: foobar dartPackageName: overriddenPackageName, dartOutputPackageName: outputPackageName, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains("import 'package:$outputPackageName/foo/bar.dart';"), @@ -1776,7 +1776,7 @@ name: foobar }); test('transfers documentation comments', () { - final List comments = [ + final comments = [ ' api comment', ' api method comment', ' class comment', @@ -1784,12 +1784,12 @@ name: foobar ' enum comment', ' enum member comment', ]; - int count = 0; + var count = 0; - final List unspacedComments = ['////////']; - int unspacedCount = 0; + final unspacedComments = ['////////']; + var unspacedCount = 0; - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1850,23 +1850,23 @@ name: foobar ), ], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); - for (final String comment in comments) { + final code = sink.toString(); + for (final comment in comments) { expect(code, contains('///$comment')); } expect(code, contains('/// ///')); }); test('creates custom codecs', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1916,20 +1916,20 @@ name: foobar ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('extends StandardMessageCodec')); }); test('host test code handles enums', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1964,9 +1964,9 @@ name: foobar ), ], ); - final StringBuffer sink = StringBuffer(); + final sink = StringBuffer(); - const DartGenerator testGenerator = DartGenerator(); + const testGenerator = DartGenerator(); testGenerator.generateTest( const InternalDartOptions(dartOut: 'code.dart', testOut: 'test.dart'), root, @@ -1975,7 +1975,7 @@ name: foobar dartOutputPackageName: DEFAULT_PACKAGE_NAME, ); - final String testCode = sink.toString(); + final testCode = sink.toString(); expect(testCode, contains('final Enum? arg_anEnum = (args[0] as Enum?);')); expect( testCode, @@ -1985,7 +1985,7 @@ name: foobar }); test('connection error contains channel name', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2006,15 +2006,15 @@ name: foobar enums: [], containsHostApi: true, ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('throw _createConnectionError(pigeonVar_channelName);'), @@ -2028,7 +2028,7 @@ name: foobar }); test('generate wrapResponse if is generating tests', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2047,20 +2047,20 @@ name: foobar enums: [], ); - final StringBuffer mainCodeSink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final mainCodeSink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(testOut: 'test.dart'), root, mainCodeSink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String mainCode = mainCodeSink.toString(); + final mainCode = mainCodeSink.toString(); expect(mainCode, contains('List wrapResponse(')); }); test('writes custom int codec without custom types', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2080,15 +2080,15 @@ name: foobar classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const DartGenerator generator = DartGenerator(); + final sink = StringBuffer(); + const generator = DartGenerator(); generator.generate( const InternalDartOptions(), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('if (value is int) {')); expect(code, contains('buffer.putUint8(4);')); expect(code, contains('buffer.putInt64(value);')); diff --git a/packages/pigeon/test/functional_test.dart b/packages/pigeon/test/functional_test.dart index 4e83c21031e..48110f1487f 100644 --- a/packages/pigeon/test/functional_test.dart +++ b/packages/pigeon/test/functional_test.dart @@ -7,7 +7,7 @@ import 'package:test/test.dart'; void main() { test('indexMap', () { - final List items = ['a', 'b', 'c']; + final items = ['a', 'b', 'c']; final List result = indexMap( items, (int index, String value) => value + index.toString(), @@ -18,8 +18,8 @@ void main() { }); test('enumerate', () { - final List items = ['a', 'b', 'c']; - int saw = 0; + final items = ['a', 'b', 'c']; + var saw = 0; enumerate(items, (int index, String value) { if (index == 0) { expect(value, 'a'); diff --git a/packages/pigeon/test/generator_tools_test.dart b/packages/pigeon/test/generator_tools_test.dart index 6483c12ef97..67e5f68fb1d 100644 --- a/packages/pigeon/test/generator_tools_test.dart +++ b/packages/pigeon/test/generator_tools_test.dart @@ -10,7 +10,7 @@ bool _equalSet(Set x, Set y) { if (x.length != y.length) { return false; } - for (final T object in x) { + for (final object in x) { if (!y.contains(object)) { return false; } @@ -49,18 +49,18 @@ final Class emptyClass = Class( void main() { test('test merge maps', () { - final Map source = { + final source = { '1': '1', '2': {'1': '1', '3': '3'}, '3': '3', // not modified }; - final Map modification = { + final modification = { '1': '2', // modify '2': { '2': '2', // added }, }; - final Map expected = { + final expected = { '1': '2', '2': {'1': '1', '2': '2', '3': '3'}, '3': '3', @@ -69,7 +69,7 @@ void main() { }); test('get codec types from all classes and enums', () { - final Root root = Root( + final root = Root( classes: [ Class( name: 'name', @@ -94,7 +94,7 @@ void main() { }); test('getEnumeratedTypes:ed type arguments', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -162,7 +162,7 @@ void main() { }); test('getEnumeratedTypes: Object', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api1', @@ -209,7 +209,7 @@ void main() { }); test('getEnumeratedTypes:ue entries', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api1', @@ -282,13 +282,13 @@ void main() { }); test('recursiveGetSuperClassApisChain', () { - final AstProxyApi superClassOfSuperClassApi = AstProxyApi( + final superClassOfSuperClassApi = AstProxyApi( name: 'Api3', methods: [], constructors: [], fields: [], ); - final AstProxyApi superClassApi = AstProxyApi( + final superClassApi = AstProxyApi( name: 'Api2', methods: [], constructors: [], @@ -299,7 +299,7 @@ void main() { associatedProxyApi: superClassOfSuperClassApi, ), ); - final AstProxyApi api = AstProxyApi( + final api = AstProxyApi( name: 'Api', methods: [], constructors: [], @@ -321,19 +321,19 @@ void main() { }); test('recursiveFindAllInterfacesApis', () { - final AstProxyApi interfaceOfInterfaceApi2 = AstProxyApi( + final interfaceOfInterfaceApi2 = AstProxyApi( name: 'Api5', methods: [], constructors: [], fields: [], ); - final AstProxyApi interfaceOfInterfaceApi = AstProxyApi( + final interfaceOfInterfaceApi = AstProxyApi( name: 'Api4', methods: [], constructors: [], fields: [], ); - final AstProxyApi interfaceApi2 = AstProxyApi( + final interfaceApi2 = AstProxyApi( name: 'Api3', methods: [], constructors: [], @@ -346,7 +346,7 @@ void main() { ), }, ); - final AstProxyApi interfaceApi = AstProxyApi( + final interfaceApi = AstProxyApi( name: 'Api2', methods: [], constructors: [], @@ -364,7 +364,7 @@ void main() { ), }, ); - final AstProxyApi api = AstProxyApi( + final api = AstProxyApi( name: 'Api', methods: [], constructors: [], @@ -397,19 +397,19 @@ void main() { test( 'recursiveFindAllInterfacesApis throws error if api recursively implements itself', () { - final AstProxyApi a = AstProxyApi( + final a = AstProxyApi( name: 'A', methods: [], constructors: [], fields: [], ); - final AstProxyApi b = AstProxyApi( + final b = AstProxyApi( name: 'B', methods: [], constructors: [], fields: [], ); - final AstProxyApi c = AstProxyApi( + final c = AstProxyApi( name: 'C', methods: [], constructors: [], @@ -443,7 +443,7 @@ void main() { ); test('findHighestApiRequirement', () { - final TypeDeclaration typeWithoutMinApi = TypeDeclaration( + final typeWithoutMinApi = TypeDeclaration( baseName: 'TypeWithoutMinApi', isNullable: false, associatedProxyApi: AstProxyApi( @@ -454,7 +454,7 @@ void main() { ), ); - final TypeDeclaration typeWithMinApi = TypeDeclaration( + final typeWithMinApi = TypeDeclaration( baseName: 'TypeWithMinApi', isNullable: false, associatedProxyApi: AstProxyApi( @@ -465,7 +465,7 @@ void main() { ), ); - final TypeDeclaration typeWithHighestMinApi = TypeDeclaration( + final typeWithHighestMinApi = TypeDeclaration( baseName: 'TypeWithHighestMinApi', isNullable: false, associatedProxyApi: AstProxyApi( @@ -500,8 +500,8 @@ void main() { }); test('Indent.format trims indentation', () { - final StringBuffer buffer = StringBuffer(); - final Indent indent = Indent(buffer); + final buffer = StringBuffer(); + final indent = Indent(buffer); indent.format(''' void myMethod() { diff --git a/packages/pigeon/test/gobject_generator_test.dart b/packages/pigeon/test/gobject_generator_test.dart index 2c66b13afe0..a24a0e8f991 100644 --- a/packages/pigeon/test/gobject_generator_test.dart +++ b/packages/pigeon/test/gobject_generator_test.dart @@ -11,7 +11,7 @@ const String DEFAULT_PACKAGE_NAME = 'test_package'; void main() { test('gen one api', () { - final Class inputClass = Class( + final inputClass = Class( name: 'Input', fields: [ NamedType( @@ -20,7 +20,7 @@ void main() { ), ], ); - final Class outputClass = Class( + final outputClass = Class( name: 'Output', fields: [ NamedType( @@ -29,7 +29,7 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -60,9 +60,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalGObjectOptions( @@ -77,7 +77,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -92,9 +92,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalGObjectOptions( @@ -109,7 +109,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -134,7 +134,7 @@ void main() { }); test('naming follows style', () { - final Class inputClass = Class( + final inputClass = Class( name: 'Input', fields: [ NamedType( @@ -143,7 +143,7 @@ void main() { ), ], ); - final Class outputClass = Class( + final outputClass = Class( name: 'Output', fields: [ NamedType( @@ -152,7 +152,7 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -183,9 +183,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalGObjectOptions( @@ -200,7 +200,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -221,9 +221,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalGObjectOptions( @@ -238,7 +238,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -255,7 +255,7 @@ void main() { }); test('Spaces before {', () { - final Class inputClass = Class( + final inputClass = Class( name: 'Input', fields: [ NamedType( @@ -264,7 +264,7 @@ void main() { ), ], ); - final Class outputClass = Class( + final outputClass = Class( name: 'Output', fields: [ NamedType( @@ -273,7 +273,7 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -304,9 +304,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalGObjectOptions( @@ -321,14 +321,14 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(contains('){'))); expect(code, isNot(contains('const{'))); } { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalGObjectOptions( @@ -343,14 +343,14 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(contains('){'))); expect(code, isNot(contains('const{'))); } }); test('include blocks follow style', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -379,9 +379,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalGObjectOptions( @@ -396,7 +396,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains(''' @@ -405,9 +405,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalGObjectOptions( @@ -422,7 +422,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains(''' @@ -433,7 +433,7 @@ void main() { }); test('data classes handle non-nullable fields', () { - final Class nestedClass = Class( + final nestedClass = Class( name: 'Nested', fields: [ NamedType( @@ -442,7 +442,7 @@ void main() { ), ], ); - final Class inputClass = Class( + final inputClass = Class( name: 'Input', fields: [ NamedType( @@ -467,7 +467,7 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -494,9 +494,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalGObjectOptions( @@ -511,7 +511,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, @@ -521,9 +521,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalGObjectOptions( @@ -538,7 +538,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, @@ -550,7 +550,7 @@ void main() { }); test('host non-nullable return types map correctly', () { - final Class returnDataClass = Class( + final returnDataClass = Class( name: 'ReturnData', fields: [ NamedType( @@ -559,7 +559,7 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -633,9 +633,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalGObjectOptions( @@ -650,7 +650,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -691,7 +691,7 @@ void main() { }); test('host non-nullable arguments map correctly', () { - final Class parameterObjectClass = Class( + final parameterObjectClass = Class( name: 'ParameterObject', fields: [ NamedType( @@ -700,8 +700,8 @@ void main() { ), ], ); - final Class objectClass = Class(name: 'Object', fields: []); - final Root root = Root( + final objectClass = Class(name: 'Object', fields: []); + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -789,9 +789,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalGObjectOptions( @@ -806,7 +806,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -815,9 +815,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalGObjectOptions( @@ -832,7 +832,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -843,7 +843,7 @@ void main() { }); test('transfers documentation comments', () { - final List comments = [ + final comments = [ ' api comment', ' api method comment', ' class comment', @@ -851,12 +851,12 @@ void main() { ' enum comment', ' enum member comment', ]; - int count = 0; + var count = 0; - final List unspacedComments = ['////////']; - int unspacedCount = 0; + final unspacedComments = ['////////']; + var unspacedCount = 0; - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -917,9 +917,9 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalGObjectOptions( @@ -934,15 +934,15 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); - for (final String comment in comments) { + final code = sink.toString(); + for (final comment in comments) { expect(code, contains(' *$comment')); } expect(code, contains(' * ///')); }); test('generates custom class id constants', () { - final Class parameterObjectClass = Class( + final parameterObjectClass = Class( name: 'ParameterObject', fields: [ NamedType( @@ -951,15 +951,15 @@ void main() { ), ], ); - final Class objectClass = Class(name: 'Object', fields: []); - final Enum anEnum = Enum( + final objectClass = Class(name: 'Object', fields: []); + final anEnum = Enum( name: 'enum', members: [ EnumMember(name: 'one'), EnumMember(name: 'two'), ], ); - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -998,9 +998,9 @@ void main() { enums: [anEnum], ); { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalGObjectOptions( @@ -1015,7 +1015,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('extern const int test_packageenum_type_id;')); expect( code, @@ -1024,9 +1024,9 @@ void main() { expect(code, contains('extern const int test_package_object_type_id;')); } { - final StringBuffer sink = StringBuffer(); - const GObjectGenerator generator = GObjectGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = GObjectGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalGObjectOptions( @@ -1041,7 +1041,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('const int test_packageenum_type_id = 129;')); expect( diff --git a/packages/pigeon/test/java_generator_test.dart b/packages/pigeon/test/java_generator_test.dart index deb2e6bbe80..071c20b15b3 100644 --- a/packages/pigeon/test/java_generator_test.dart +++ b/packages/pigeon/test/java_generator_test.dart @@ -26,7 +26,7 @@ final Enum emptyEnum = Enum( void main() { test('gen one class', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -35,24 +35,24 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public class Messages')); expect(code, contains('public static final class Foobar')); expect(code, contains('public static final class Builder')); @@ -61,7 +61,7 @@ void main() { }); test('gen one enum', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'Foobar', members: [ EnumMember(name: 'one'), @@ -69,24 +69,24 @@ void main() { EnumMember(name: 'remoteDB'), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public enum Foobar')); expect(code, contains(' ONE(0),')); expect(code, contains(' TWO_THREE_FOUR(1),')); @@ -97,7 +97,7 @@ void main() { }); test('package', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -106,30 +106,30 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', package: 'com.google.foobar', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('package com.google.foobar;')); }); test('gen one host api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -179,19 +179,19 @@ void main() { enums: [], containsHostApi: true, ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public interface Api')); expect(code, matches('Output.*doSomething.*Input')); expect(code, contains('channel.setMessageHandler(null)')); @@ -219,7 +219,7 @@ void main() { }); test('all the simple datatypes header', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -275,19 +275,19 @@ void main() { enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('private @Nullable Boolean aBool;')); expect(code, contains('private @Nullable Long aInt;')); expect(code, contains('private @Nullable Double aDouble;')); @@ -299,7 +299,7 @@ void main() { }); test('gen one flutter api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -348,25 +348,25 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public static class Api')); expect(code, matches('doSomething.*Input.*Output')); }); test('gen host void api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -402,25 +402,25 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(matches('=.*doSomething'))); expect(code, contains('doSomething(')); }); test('gen flutter void return api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -456,19 +456,19 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -479,7 +479,7 @@ void main() { }); test('gen host void argument api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -510,25 +510,25 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('Output doSomething()')); expect(code, contains('api.doSomething()')); }); test('gen flutter void argument api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -559,19 +559,19 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('public void doSomething(@NonNull Result result)'), @@ -580,7 +580,7 @@ void main() { }); test('gen list', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -595,25 +595,25 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public static final class Foobar')); expect(code, contains('private @Nullable List field1;')); }); test('gen map', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -628,25 +628,25 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public static final class Foobar')); expect(code, contains('private @Nullable Map field1;')); }); test('gen nested', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Outer', fields: [ NamedType( @@ -659,7 +659,7 @@ void main() { ), ], ); - final Class nestedClass = Class( + final nestedClass = Class( name: 'Nested', fields: [ NamedType( @@ -668,24 +668,24 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition, nestedClass], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public class Messages')); expect(code, contains('public static final class Outer')); expect(code, contains('public static final class Nested')); @@ -694,7 +694,7 @@ void main() { }); test('gen one async Host Api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -744,19 +744,19 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public interface Api')); expect(code, contains('public interface Result {')); expect(code, contains('void error(@NonNull Throwable error);')); @@ -771,7 +771,7 @@ void main() { }); test('gen one async Flutter Api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -821,25 +821,25 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public static class Api')); expect(code, matches('doSomething.*Input.*Output')); }); test('gen one enum class', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'Enum1', members: [ EnumMember(name: 'one'), @@ -847,7 +847,7 @@ void main() { EnumMember(name: 'remoteDB'), ], ); - final Class classDefinition = Class( + final classDefinition = Class( name: 'EnumClass', fields: [ NamedType( @@ -860,24 +860,24 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public enum Enum1')); expect(code, contains(' ONE(0),')); expect(code, contains(' TWO_THREE_FOUR(1),')); @@ -891,7 +891,7 @@ void main() { }); test('primitive enum host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Bar', @@ -925,19 +925,19 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public enum Foo')); expect( code, @@ -959,26 +959,26 @@ void main() { } test('header', () { - final Root root = Root(apis: [], classes: [], enums: []); - final StringBuffer sink = StringBuffer(); - final InternalJavaOptions javaOptions = InternalJavaOptions( + final root = Root(apis: [], classes: [], enums: []); + final sink = StringBuffer(); + final javaOptions = InternalJavaOptions( className: 'Messages', copyrightHeader: makeIterable('hello world'), javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, startsWith('// hello world')); }); test('generics', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -993,30 +993,30 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Foobar')); expect(code, contains('List field1;')); }); test('generics - maps', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -1032,30 +1032,30 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Foobar')); expect(code, contains('Map field1;')); }); test('host generics argument', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1083,24 +1083,24 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('doit(@NonNull List arg')); }); test('flutter generics argument', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1128,24 +1128,24 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('doit(@NonNull List arg')); }); test('host generics return', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1168,25 +1168,25 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('List doit(')); expect(code, contains('List output =')); }); test('flutter generics return', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1209,19 +1209,19 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('public void doit(@NonNull Result> result)'), @@ -1230,7 +1230,7 @@ void main() { }); test('flutter int return', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1251,25 +1251,25 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('public void doit(@NonNull Result result)')); expect(code, contains('Long output = (Long) listReply.get(0);')); }); test('host multiple args', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1304,19 +1304,19 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Messages')); expect(code, contains('Long add(@NonNull Long x, @NonNull Long y)')); expect( @@ -1329,7 +1329,7 @@ void main() { }); test('if host argType is Object not cast', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1354,24 +1354,24 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Api', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('Object xArg = args.get(0)')); }); test('flutter multiple args', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1406,19 +1406,19 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Messages')); expect(code, contains('BasicMessageChannel channel')); expect(code, contains('Long output')); @@ -1439,7 +1439,7 @@ void main() { }); test('flutter single args', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1467,19 +1467,19 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1491,7 +1491,7 @@ void main() { }); test('return nullable host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1511,24 +1511,24 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains(RegExp(r'@Nullable\s*Long doit\(\);'))); }); test('return nullable host async', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1549,25 +1549,25 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // Java doesn't accept nullability annotations in type arguments. expect(code, contains('Result')); }); test('nullable argument host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1592,24 +1592,24 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains(' void doit(@Nullable Long foo);')); }); test('nullable argument flutter', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1634,19 +1634,19 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1656,7 +1656,7 @@ void main() { }); test('background platform channel', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1682,19 +1682,19 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1712,49 +1712,49 @@ void main() { }); test('generated annotation', () { - final Class classDefinition = Class(name: 'Foobar', fields: []); - final Root root = Root( + final classDefinition = Class(name: 'Foobar', fields: []); + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', useGeneratedAnnotation: true, javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@javax.annotation.Generated("dev.flutter.pigeon")')); }); test('no generated annotation', () { - final Class classDefinition = Class(name: 'Foobar', fields: []); - final Root root = Root( + final classDefinition = Class(name: 'Foobar', fields: []); + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, isNot(contains('@javax.annotation.Generated("dev.flutter.pigeon")')), @@ -1762,7 +1762,7 @@ void main() { }); test('transfers documentation comments', () { - final List comments = [ + final comments = [ ' api comment', ' api method comment', ' class comment', @@ -1770,12 +1770,12 @@ void main() { ' enum comment', ' enum member comment', ]; - int count = 0; + var count = 0; - final List unspacedComments = ['////////']; - int unspacedCount = 0; + final unspacedComments = ['////////']; + var unspacedCount = 0; - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'api', @@ -1836,20 +1836,20 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); - for (final String comment in comments) { + final code = sink.toString(); + for (final comment in comments) { // This regex finds the comment only between the open and close comment block expect( RegExp( @@ -1863,7 +1863,7 @@ void main() { }); test('creates custom codecs', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1913,48 +1913,48 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains(' extends StandardMessageCodec')); }); test('creates api error class for custom errors', () { final Api api = AstHostApi(name: 'Api', methods: []); - final Root root = Root( + final root = Root( apis: [api], classes: [], enums: [], containsHostApi: true, ); - final StringBuffer sink = StringBuffer(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); - const JavaGenerator generator = JavaGenerator(); + const generator = JavaGenerator(); generator.generate( javaOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class FlutterError')); }); test('connection error contains channel name', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1980,9 +1980,9 @@ void main() { enums: [], containsFlutterApi: true, ); - final StringBuffer sink = StringBuffer(); - const JavaGenerator generator = JavaGenerator(); - const InternalJavaOptions javaOptions = InternalJavaOptions( + final sink = StringBuffer(); + const generator = JavaGenerator(); + const javaOptions = InternalJavaOptions( className: 'Messages', javaOut: '', ); @@ -1992,7 +1992,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('createConnectionError(channelName)')); expect( code, diff --git a/packages/pigeon/test/kotlin/proxy_api_test.dart b/packages/pigeon/test/kotlin/proxy_api_test.dart index 97b1d42c1d9..e942a2c9bd0 100644 --- a/packages/pigeon/test/kotlin/proxy_api_test.dart +++ b/packages/pigeon/test/kotlin/proxy_api_test.dart @@ -11,7 +11,7 @@ const String DEFAULT_PACKAGE_NAME = 'test_package'; void main() { group('ProxyApi', () { test('one api', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -80,8 +80,8 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions( fileSpecificClassNameComponent: 'MyFile', @@ -91,7 +91,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); // Instance Manager @@ -165,13 +165,13 @@ void main() { group('inheritance', () { test('extends', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -189,15 +189,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( collapsedCode, @@ -206,13 +206,13 @@ void main() { }); test('implements', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -232,32 +232,32 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('fun pigeon_getPigeonApiApi2(): PigeonApiApi2')); }); test('implements 2 ProxyApis', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final AstProxyApi api3 = AstProxyApi( + final api3 = AstProxyApi( name: 'Api3', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -283,15 +283,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('fun pigeon_getPigeonApiApi2(): PigeonApiApi2')); expect(code, contains('fun pigeon_getPigeonApiApi3(): PigeonApiApi3')); }); @@ -299,7 +299,7 @@ void main() { group('Constructors', () { test('empty name and no params constructor', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -313,15 +313,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( code, @@ -348,11 +348,11 @@ void main() { }); test('multiple params constructor', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -420,15 +420,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( code, @@ -455,7 +455,7 @@ void main() { }); test('host platform constructor callback method', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -474,8 +474,8 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions( errorClassName: 'TestError', @@ -485,7 +485,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( @@ -499,7 +499,7 @@ void main() { test( 'host platform constructor calls new instance error for required callbacks', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -518,8 +518,8 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions( errorClassName: 'TestError', @@ -529,7 +529,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( @@ -542,11 +542,11 @@ void main() { group('Fields', () { test('constructor with fields', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -611,15 +611,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( collapsedCode, @@ -678,13 +678,13 @@ void main() { }); test('attached field', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -707,15 +707,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains(r'abstract fun aField(pigeon_instance: Api): Api2'), @@ -729,13 +729,13 @@ void main() { }); test('static attached field', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -759,15 +759,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains(r'abstract fun aField(): Api2')); expect( code, @@ -780,11 +780,11 @@ void main() { group('Host methods', () { test('multiple params method', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -854,15 +854,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( collapsedCode, @@ -883,7 +883,7 @@ void main() { }); test('static method', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -903,15 +903,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect(collapsedCode, contains('abstract fun doSomething()')); expect(collapsedCode, contains(r'api.doSomething()')); @@ -920,11 +920,11 @@ void main() { group('Flutter methods', () { test('multiple params flutter method', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -988,15 +988,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( collapsedCode, @@ -1022,7 +1022,7 @@ void main() { test( 'InstanceManager passes runnable field and not a new runnable instance', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -1034,15 +1034,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( @@ -1072,7 +1072,7 @@ void main() { ); test('InstanceManager.getInstance specifies nonnull type', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -1084,15 +1084,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const KotlinGenerator generator = KotlinGenerator(); + final sink = StringBuffer(); + const generator = KotlinGenerator(); generator.generate( const InternalKotlinOptions(kotlinOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( @@ -1121,7 +1121,7 @@ void main() { /// void method( int param1, int param2, ) /// ``` String _collapseNewlineAndIndentation(String string) { - final StringBuffer result = StringBuffer(); + final result = StringBuffer(); for (final String line in string.split('\n')) { result.write('${line.trimLeft()} '); } diff --git a/packages/pigeon/test/kotlin_generator_test.dart b/packages/pigeon/test/kotlin_generator_test.dart index 0196ca85923..5165e4fb63e 100644 --- a/packages/pigeon/test/kotlin_generator_test.dart +++ b/packages/pigeon/test/kotlin_generator_test.dart @@ -25,7 +25,7 @@ final Enum emptyEnum = Enum( void main() { test('gen one class', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -34,23 +34,23 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('data class Foobar (')); expect(code, contains('val field1: Long? = null')); expect(code, contains('fun fromList(pigeonVar_list: List): Foobar')); @@ -59,37 +59,37 @@ void main() { }); test('gen one enum', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'Foobar', members: [ EnumMember(name: 'one'), EnumMember(name: 'two'), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('enum class Foobar(val raw: Int) {')); expect(code, contains('ONE(0)')); expect(code, contains('TWO(1)')); }); test('gen class with enum', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -123,18 +123,18 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('enum class Foo(val raw: Int) {')); expect(code, contains('data class Bar (')); expect(code, contains('val field1: Foo,')); @@ -147,7 +147,7 @@ void main() { }); test('primitive enum host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Bar', @@ -181,24 +181,24 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('enum class Foo(val raw: Int) {')); expect(code, contains('Foo.ofRaw(it.toInt())')); }); test('gen one host api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -247,18 +247,18 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('interface Api')); expect(code, contains('fun doSomething(input: Input): Output')); expect( @@ -291,7 +291,7 @@ void main() { }); test('all the simple datatypes header', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -397,19 +397,19 @@ void main() { enums: [], ); - final StringBuffer sink = StringBuffer(); + final sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('val aBool: Boolean')); expect(code, contains('val aInt: Long')); expect(code, contains('val aDouble: Double')); @@ -429,7 +429,7 @@ void main() { }); test('gen one flutter api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -478,18 +478,18 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -500,7 +500,7 @@ void main() { }); test('gen host void api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -536,24 +536,24 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(matches('.*doSomething(.*) ->'))); expect(code, matches('doSomething(.*)')); }); test('gen flutter void return api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -589,18 +589,18 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('callback: (Result) -> Unit')); expect(code, contains('callback(Result.success(Unit))')); // Lines should not end in semicolons. @@ -608,7 +608,7 @@ void main() { }); test('gen host void argument api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -639,18 +639,18 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('fun doSomething(): Output')); expect(code, contains('listOf(api.doSomething())')); expect(code, contains('wrapError(exception)')); @@ -658,7 +658,7 @@ void main() { }); test('gen flutter void argument api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -689,18 +689,18 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('fun doSomething(callback: (Result) -> Unit)'), @@ -709,7 +709,7 @@ void main() { }); test('gen list', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -724,24 +724,24 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('data class Foobar')); expect(code, contains('val field1: List? = null')); }); test('gen map', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -756,24 +756,24 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('data class Foobar')); expect(code, contains('val field1: Map? = null')); }); test('gen nested', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Outer', fields: [ NamedType( @@ -786,7 +786,7 @@ void main() { ), ], ); - final Class nestedClass = Class( + final nestedClass = Class( name: 'Nested', fields: [ NamedType( @@ -795,23 +795,23 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition, nestedClass], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('data class Outer')); expect(code, contains('data class Nested')); expect(code, contains('val nested: Nested? = null')); @@ -821,7 +821,7 @@ void main() { }); test('gen one async Host Api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -871,25 +871,25 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('interface Api')); expect(code, contains('api.doSomething(argArg) {')); expect(code, contains('reply.reply(PigeonUtils.wrapResult(data))')); }); test('gen one async Flutter Api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -939,31 +939,31 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Api')); expect(code, matches('fun doSomething.*Input.*callback.*Output.*Unit')); }); test('gen one enum class', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'SampleEnum', members: [ EnumMember(name: 'sampleVersion'), EnumMember(name: 'sampleTest'), ], ); - final Class classDefinition = Class( + final classDefinition = Class( name: 'EnumClass', fields: [ NamedType( @@ -976,23 +976,23 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('enum class SampleEnum(val raw: Int)')); expect(code, contains('SAMPLE_VERSION(0)')); expect(code, contains('SAMPLE_TEST(1)')); @@ -1003,25 +1003,25 @@ void main() { } test('header', () { - final Root root = Root(apis: [], classes: [], enums: []); - final StringBuffer sink = StringBuffer(); - final InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final root = Root(apis: [], classes: [], enums: []); + final sink = StringBuffer(); + final kotlinOptions = InternalKotlinOptions( copyrightHeader: makeIterable('hello world'), kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, startsWith('// hello world')); }); test('generics - list', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -1036,29 +1036,29 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('data class Foobar')); expect(code, contains('val field1: List')); }); test('generics - maps', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -1074,29 +1074,29 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('data class Foobar')); expect(code, contains('val field1: Map')); }); test('host generics argument', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1124,23 +1124,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('fun doit(arg: List')); }); test('flutter generics argument', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1168,23 +1168,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('fun doit(argArg: List')); }); test('host generics return', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1207,25 +1207,25 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('fun doit(): List')); expect(code, contains('listOf(api.doit())')); expect(code, contains('reply.reply(wrapped)')); }); test('flutter generics return', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1248,25 +1248,25 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('fun doit(callback: (Result>) -> Unit)')); expect(code, contains('val output = it[0] as List')); expect(code, contains('callback(Result.success(output))')); }); test('host multiple args', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1301,18 +1301,18 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('fun add(x: Long, y: Long): Long')); expect(code, contains('val args = message as List')); expect(code, contains('listOf(api.add(xArg, yArg))')); @@ -1320,7 +1320,7 @@ void main() { }); test('flutter multiple args', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1355,18 +1355,18 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('val channel = BasicMessageChannel')); expect(code, contains('callback(Result.success(output))')); expect( @@ -1379,7 +1379,7 @@ void main() { }); test('return nullable host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1399,23 +1399,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('fun doit(): Long?')); }); test('return nullable host async', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1436,23 +1436,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('fun doit(callback: (Result) -> Unit')); }); test('nullable argument host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1477,23 +1477,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('val fooArg = args[0]')); }); test('nullable argument flutter', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1518,18 +1518,18 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('fun doit(fooArg: Long?, callback: (Result) -> Unit)'), @@ -1537,7 +1537,7 @@ void main() { }); test('nonnull fields', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1576,23 +1576,23 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('val input: String\n')); }); test('transfers documentation comments', () { - final List comments = [ + final comments = [ ' api comment', ' api method comment', ' class comment', @@ -1600,12 +1600,12 @@ void main() { ' enum comment', ' enum member comment', ]; - int count = 0; + var count = 0; - final List unspacedComments = ['////////']; - int unspacedCount = 0; + final unspacedComments = ['////////']; + var unspacedCount = 0; - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'api', @@ -1666,19 +1666,19 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); - for (final String comment in comments) { + final code = sink.toString(); + for (final comment in comments) { // This regex finds the comment only between the open and close comment block expect( RegExp( @@ -1692,7 +1692,7 @@ void main() { }); test('creates custom codecs', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1742,51 +1742,51 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains(' : StandardMessageCodec() ')); }); test('creates api error class for custom errors', () { - final Method method = Method( + final method = Method( name: 'doSomething', location: ApiLocation.host, returnType: const TypeDeclaration.voidDeclaration(), parameters: [], ); - final AstHostApi api = AstHostApi( + final api = AstHostApi( name: 'SomeApi', methods: [method], ); - final Root root = Root( + final root = Root( apis: [api], classes: [], enums: [], containsHostApi: true, ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( errorClassName: 'SomeError', kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class SomeError')); expect(code, contains('if (exception is SomeError)')); expect(code, contains('exception.code,')); @@ -1795,7 +1795,7 @@ void main() { }); test('connection error contains channel name', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1821,18 +1821,18 @@ void main() { enums: [], containsFlutterApi: true, ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1848,7 +1848,7 @@ void main() { }); test('gen host uses default error class', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1873,23 +1873,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('FlutterError')); }); test('gen flutter uses default error class', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1914,23 +1914,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions( kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('FlutterError')); }); test('gen host uses error class', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1955,26 +1955,26 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const String errorClassName = 'FooError'; - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const errorClassName = 'FooError'; + const kotlinOptions = InternalKotlinOptions( errorClassName: errorClassName, kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains(errorClassName)); expect(code, isNot(contains('FlutterError'))); }); test('gen flutter uses error class', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1999,26 +1999,26 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const String errorClassName = 'FooError'; - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const errorClassName = 'FooError'; + const kotlinOptions = InternalKotlinOptions( errorClassName: errorClassName, kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains(errorClassName)); expect(code, isNot(contains('FlutterError'))); }); test('do not generate duplicated entries in writeValue', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'FooBar', @@ -2067,13 +2067,13 @@ void main() { enums: [], ); - final StringBuffer sink = StringBuffer(); - const String errorClassName = 'FooError'; - const InternalKotlinOptions kotlinOptions = InternalKotlinOptions( + final sink = StringBuffer(); + const errorClassName = 'FooError'; + const kotlinOptions = InternalKotlinOptions( errorClassName: errorClassName, kotlinOut: '', ); - const KotlinGenerator generator = KotlinGenerator(); + const generator = KotlinGenerator(); generator.generate( kotlinOptions, root, @@ -2081,7 +2081,7 @@ void main() { dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); // Extract override fun writeValue block final int blockStart = code.indexOf('override fun writeValue'); @@ -2091,8 +2091,8 @@ void main() { final String writeValueBlock = code.substring(blockStart, blockEnd); // Count the occurrence of 'is Foo' in the block - int count = 0; - int index = 0; + var count = 0; + var index = 0; while (index != -1) { index = writeValueBlock.indexOf('is Foo', index); if (index != -1) { diff --git a/packages/pigeon/test/objc_generator_test.dart b/packages/pigeon/test/objc_generator_test.dart index 2c806907828..017c499fae1 100644 --- a/packages/pigeon/test/objc_generator_test.dart +++ b/packages/pigeon/test/objc_generator_test.dart @@ -27,7 +27,7 @@ final Enum emptyEnum = Enum( void main() { test('gen one class header', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -42,9 +42,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -59,13 +59,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@interface Foobar')); expect(code, matches('@property.*NSString.*field1')); }); test('gen one class source', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -80,9 +80,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -97,13 +97,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('#import "foo.h"')); expect(code, contains('@implementation Foobar')); }); test('gen one enum header', () { - final Root root = Root( + final root = Root( apis: [], classes: [], enums: [ @@ -116,9 +116,9 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -133,14 +133,14 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('typedef NS_ENUM(NSUInteger, Enum1) {')); expect(code, contains(' Enum1One = 0,')); expect(code, contains(' Enum1Two = 1,')); }); test('gen one enum header with prefix', () { - final Root root = Root( + final root = Root( apis: [], classes: [], enums: [ @@ -153,9 +153,9 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -171,14 +171,14 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('typedef NS_ENUM(NSUInteger, PREFIXEnum1) {')); expect(code, contains(' PREFIXEnum1One = 0,')); expect(code, contains(' PREFIXEnum1Two = 1,')); }); test('gen one class source with enum', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -209,9 +209,9 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -226,7 +226,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('#import "foo.h"')); expect(code, contains('@implementation Foobar')); expect( @@ -238,7 +238,7 @@ void main() { }); test('primitive enum host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Bar', @@ -272,16 +272,16 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const InternalObjcOptions options = InternalObjcOptions( + final sink = StringBuffer(); + const options = InternalObjcOptions( headerIncludePath: 'foo.h', prefix: 'AC', objcHeaderOut: '', objcSourceOut: '', ); { - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: options, @@ -292,13 +292,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('typedef NS_ENUM(NSUInteger, ACFoo)')); expect(code, contains(':(ACFoo)foo error:')); } { - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: options, @@ -309,7 +309,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -322,7 +322,7 @@ void main() { }); test('validate nullable primitive enum', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Bar', @@ -356,7 +356,7 @@ void main() { ), ], ); - const InternalObjcOptions options = InternalObjcOptions( + const options = InternalObjcOptions( headerIncludePath: 'foo.h', objcHeaderOut: '', objcSourceOut: '', @@ -367,7 +367,7 @@ void main() { }); test('gen one class header with enum', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -398,9 +398,9 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -415,7 +415,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('@property(nonatomic, strong, nullable) Enum1Box * enum1;'), @@ -423,7 +423,7 @@ void main() { }); test('gen one api header', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -472,9 +472,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -489,7 +489,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@interface Input')); expect(code, contains('@interface Output')); expect(code, contains('@protocol Api')); @@ -499,7 +499,7 @@ void main() { }); test('gen one api source', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -548,9 +548,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -565,7 +565,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('#import "foo.h"')); expect(code, contains('@implementation Input')); expect(code, contains('@implementation Output')); @@ -579,7 +579,7 @@ void main() { }); test('all the simple datatypes header', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -635,9 +635,9 @@ void main() { enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -652,7 +652,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@interface Foobar')); expect(code, contains('@class FlutterStandardTypedData;')); expect(code, matches('@property.*strong.*NSNumber.*aBool')); @@ -678,7 +678,7 @@ void main() { }); test('bool source', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -694,9 +694,9 @@ void main() { enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -711,7 +711,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@implementation Foobar')); expect( code, @@ -720,7 +720,7 @@ void main() { }); test('nested class header', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -748,9 +748,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -765,7 +765,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('@property(nonatomic, strong, nullable) Input * nested;'), @@ -773,7 +773,7 @@ void main() { }); test('nested class source', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -801,9 +801,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -818,7 +818,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('pigeonResult.nested = GetNullableObjectAtIndex(list, 0);'), @@ -826,7 +826,7 @@ void main() { }); test('prefix class header', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -841,9 +841,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -859,12 +859,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@interface ABCFoobar')); }); test('prefix class source', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -879,9 +879,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -897,12 +897,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@implementation ABCFoobar')); }); test('prefix nested class header', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -955,9 +955,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -973,14 +973,14 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, matches('property.*ABCInput')); expect(code, matches('ABCNested.*doSomething.*ABCInput')); expect(code, contains('@protocol ABCApi')); }); test('prefix nested class source', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1033,9 +1033,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -1051,14 +1051,14 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('ABCInput fromList')); expect(code, matches(r'ABCInput.*=.*args.*0.*\;')); expect(code, contains('void SetUpABCApi(')); }); test('gen flutter api header', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1107,9 +1107,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -1124,7 +1124,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@interface Api : NSObject')); expect( code, @@ -1136,7 +1136,7 @@ void main() { }); test('gen flutter api source', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1185,9 +1185,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -1202,13 +1202,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@implementation Api')); expect(code, matches('void.*doSomething.*Input.*Output.*{')); }); test('gen host void header', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1244,9 +1244,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -1262,12 +1262,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('(void)doSomething:')); }); test('gen host void source', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1303,9 +1303,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -1321,14 +1321,14 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(matches('=.*doSomething'))); expect(code, matches('[.*doSomething:.*]')); expect(code, contains('callback(wrapResult(nil, error))')); }); test('gen flutter void return header', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1364,9 +1364,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -1382,12 +1382,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('completion:(void (^)(FlutterError *_Nullable))')); }); test('gen flutter void return source', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1423,9 +1423,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -1441,13 +1441,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('completion:(void (^)(FlutterError *_Nullable))')); expect(code, contains('completion(nil)')); }); test('gen host void arg header', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1478,9 +1478,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -1496,12 +1496,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, matches('ABCOutput.*doSomethingWithError:[(]FlutterError')); }); test('gen host void arg source', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1532,9 +1532,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -1550,12 +1550,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, matches('output.*=.*api doSomethingWithError:&error')); }); test('gen flutter void arg header', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1586,9 +1586,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -1604,7 +1604,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1614,7 +1614,7 @@ void main() { }); test('gen flutter void arg source', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1645,9 +1645,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -1663,7 +1663,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1674,7 +1674,7 @@ void main() { }); test('gen list', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -1689,9 +1689,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -1706,13 +1706,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@interface Foobar')); expect(code, matches('@property.*NSArray.*field1')); }); test('gen map', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -1727,9 +1727,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -1744,13 +1744,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@interface Foobar')); expect(code, matches('@property.*NSDictionary.*field1')); }); test('gen map field with object', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -1772,9 +1772,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -1789,7 +1789,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@interface Foobar')); expect( code, @@ -1800,7 +1800,7 @@ void main() { }); test('gen map argument with object', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1829,9 +1829,9 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -1846,12 +1846,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('(NSDictionary *)foo')); }); test('async void (input) HostApi header', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1897,9 +1897,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -1915,7 +1915,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1925,7 +1925,7 @@ void main() { }); test('async output(input) HostApi header', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1975,9 +1975,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -1993,7 +1993,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2003,7 +2003,7 @@ void main() { }); test('async output(void) HostApi header', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2035,9 +2035,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -2053,7 +2053,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2063,7 +2063,7 @@ void main() { }); test('async void (void) HostApi header', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2081,9 +2081,9 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -2099,7 +2099,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2109,7 +2109,7 @@ void main() { }); test('async output(input) HostApi source', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2159,9 +2159,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -2177,7 +2177,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2187,7 +2187,7 @@ void main() { }); test('async void (input) HostApi source', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2233,9 +2233,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -2251,7 +2251,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2261,7 +2261,7 @@ void main() { }); test('async void (void) HostApi source', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2279,9 +2279,9 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -2297,7 +2297,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2307,7 +2307,7 @@ void main() { }); test('async output(void) HostApi source', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2339,9 +2339,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -2357,7 +2357,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2371,10 +2371,10 @@ void main() { } test('source copyright', () { - final Root root = Root(apis: [], classes: [], enums: []); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final root = Root(apis: [], classes: [], enums: []); + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: InternalObjcOptions( @@ -2391,15 +2391,15 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, startsWith('// hello world')); }); test('header copyright', () { - final Root root = Root(apis: [], classes: [], enums: []); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final root = Root(apis: [], classes: [], enums: []); + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: InternalObjcOptions( @@ -2416,12 +2416,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, startsWith('// hello world')); }); test('field generics', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -2436,14 +2436,14 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -2459,12 +2459,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('NSArray * field1')); }); test('host generics argument', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2493,9 +2493,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -2511,13 +2511,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('doitArg:(NSArray *)arg')); } { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -2533,7 +2533,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2544,7 +2544,7 @@ void main() { }); test('flutter generics argument', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -2573,9 +2573,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -2591,13 +2591,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('doitArg:(NSArray *)arg')); } { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -2613,13 +2613,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('doitArg:(NSArray *)arg')); } }); test('host nested generic argument', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2654,9 +2654,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -2672,13 +2672,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('doitArg:(NSArray *> *)arg')); } }); test('host generics return', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2702,9 +2702,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -2720,16 +2720,16 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('- (nullable NSArray *)doitWithError:'), ); } { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -2745,13 +2745,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('NSArray *output =')); } }); test('flutter generics return', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -2775,9 +2775,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -2793,16 +2793,16 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('doitWithCompletion:(void (^)(NSArray *'), ); } { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -2818,7 +2818,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('doitWithCompletion:(void (^)(NSArray *'), @@ -2827,7 +2827,7 @@ void main() { }); test('host multiple args', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2863,9 +2863,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -2881,7 +2881,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2890,9 +2890,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -2908,7 +2908,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('NSArray *args = message;')); expect( code, @@ -2930,7 +2930,7 @@ void main() { }); test('host multiple args async', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -2967,9 +2967,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -2985,7 +2985,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -2994,9 +2994,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -3012,7 +3012,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('NSArray *args = message;')); expect( code, @@ -3031,7 +3031,7 @@ void main() { }); test('flutter multiple args', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -3067,9 +3067,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -3085,7 +3085,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -3094,9 +3094,9 @@ void main() { ); } { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -3112,7 +3112,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -3198,9 +3198,9 @@ void main() { test('host custom objc selector', () { final Root divideRoot = getDivideRoot(ApiLocation.host); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -3216,13 +3216,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, matches('divideValue:.*by:.*error.*;')); } { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -3238,7 +3238,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, matches('divideValue:.*by:.*error.*;')); } }); @@ -3246,9 +3246,9 @@ void main() { test('flutter custom objc selector', () { final Root divideRoot = getDivideRoot(ApiLocation.flutter); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -3264,13 +3264,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, matches('divideValue:.*by:.*completion.*;')); } { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -3286,13 +3286,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, matches('divideValue:.*by:.*completion.*{')); } }); test('test non null field', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -3310,9 +3310,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -3327,13 +3327,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('@interface Foobar')); expect(code, contains('@property(nonatomic, copy) NSString * field1')); }); test('return nullable flutter header', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -3353,9 +3353,9 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -3370,7 +3370,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, matches( @@ -3380,7 +3380,7 @@ void main() { }); test('return nullable flutter source', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -3400,9 +3400,9 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -3417,12 +3417,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, matches(r'doitWithCompletion.*NSNumber \*_Nullable')); }); test('return nullable host header', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -3442,9 +3442,9 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -3459,12 +3459,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, matches(r'nullable NSNumber.*doitWithError')); }); test('nullable argument host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -3490,9 +3490,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -3507,13 +3507,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('doitFoo:(nullable NSNumber *)foo')); } { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -3528,7 +3528,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('NSNumber *arg_foo = GetNullableObjectAtIndex(args, 0);'), @@ -3537,7 +3537,7 @@ void main() { }); test('nullable argument flutter', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -3563,9 +3563,9 @@ void main() { enums: [], ); { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -3580,13 +3580,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('doitFoo:(nullable NSNumber *)foo')); } { - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -3601,13 +3601,13 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('- (void)doitFoo:(nullable NSNumber *)arg_foo')); } }); test('background platform channel', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -3628,9 +3628,9 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -3645,7 +3645,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -3656,7 +3656,7 @@ void main() { }); test('transfers documentation comments', () { - final List comments = [ + final comments = [ ' api comment', ' api method comment', ' class comment', @@ -3664,12 +3664,12 @@ void main() { ' enum comment', ' enum member comment', ]; - int count = 0; + var count = 0; - final List unspacedComments = ['////////']; - int unspacedCount = 0; + final unspacedComments = ['////////']; + var unspacedCount = 0; - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'api', @@ -3730,9 +3730,9 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -3747,15 +3747,15 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); - for (final String comment in comments) { + final code = sink.toString(); + for (final comment in comments) { expect(code, contains('///$comment')); } expect(code, contains('/// ///')); }); test('creates custom codecs', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -3805,9 +3805,9 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -3822,12 +3822,12 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains(' : FlutterStandardReader')); }); test('connection error contains channel name', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -3853,9 +3853,9 @@ void main() { enums: [], containsFlutterApi: true, ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -3870,7 +3870,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -3881,14 +3881,14 @@ void main() { }); test('header of FlutterApi uses correct enum name with prefix', () { - final Enum enum1 = Enum( + final enum1 = Enum( name: 'Enum1', members: [ EnumMember(name: 'one'), EnumMember(name: 'two'), ], ); - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -3910,9 +3910,9 @@ void main() { classes: [], enums: [enum1], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -3928,20 +3928,20 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(contains('FLTFLT'))); expect(code, contains('FLTEnum1Box')); }); test('source of FlutterApi uses correct enum name with prefix', () { - final Enum enum1 = Enum( + final enum1 = Enum( name: 'Enum1', members: [ EnumMember(name: 'one'), EnumMember(name: 'two'), ], ); - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -3963,9 +3963,9 @@ void main() { classes: [], enums: [enum1], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -3981,25 +3981,25 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(contains('FLTFLT'))); expect(code, contains('FLTEnum1Box')); }); test('header of HostApi uses correct enum name with prefix', () { - final Enum enum1 = Enum( + final enum1 = Enum( name: 'Enum1', members: [ EnumMember(name: 'one'), EnumMember(name: 'two'), ], ); - final TypeDeclaration enumType = TypeDeclaration( + final enumType = TypeDeclaration( baseName: 'Enum1', isNullable: false, associatedEnum: enum1, ); - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -4017,9 +4017,9 @@ void main() { classes: [], enums: [enum1], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.header, languageOptions: const InternalObjcOptions( @@ -4035,25 +4035,25 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(contains('FLTFLT'))); expect(code, contains('FLTEnum1Box')); }); test('source of HostApi uses correct enum name with prefix', () { - final Enum enum1 = Enum( + final enum1 = Enum( name: 'Enum1', members: [ EnumMember(name: 'one'), EnumMember(name: 'two'), ], ); - final TypeDeclaration enumType = TypeDeclaration( + final enumType = TypeDeclaration( baseName: 'Enum1', isNullable: false, associatedEnum: enum1, ); - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -4071,9 +4071,9 @@ void main() { classes: [], enums: [enum1], ); - final StringBuffer sink = StringBuffer(); - const ObjcGenerator generator = ObjcGenerator(); - final OutputFileOptions generatorOptions = + final sink = StringBuffer(); + const generator = ObjcGenerator(); + final generatorOptions = OutputFileOptions( fileType: FileType.source, languageOptions: const InternalObjcOptions( @@ -4089,7 +4089,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(contains('FLTFLT'))); expect(code, contains('FLTEnum1Box')); }); diff --git a/packages/pigeon/test/pigeon_lib_test.dart b/packages/pigeon/test/pigeon_lib_test.dart index b2409c4dbc5..eac04d89b06 100644 --- a/packages/pigeon/test/pigeon_lib_test.dart +++ b/packages/pigeon/test/pigeon_lib_test.dart @@ -45,8 +45,8 @@ void main() { /// after the [callback] is executed. void withTempFile(String filename, void Function(File) callback) { final Directory dir = Directory.systemTemp.createTempSync(); - final String path = '${dir.path}/$filename'; - final File file = File(path); + final path = '${dir.path}/$filename'; + final file = File(path); file.createSync(); try { callback(file); @@ -177,7 +177,7 @@ void main() { }); test('simple parse api', () { - const String code = ''' + const code = ''' class Input1 { String? input; } @@ -243,7 +243,7 @@ abstract class Api1 { }); test('invalid datatype', () { - const String source = ''' + const source = ''' class InvalidDatatype { dynamic something; } @@ -260,7 +260,7 @@ abstract class Api { }); test('Only allow one api annotation', () { - const String source = ''' + const source = ''' @HostApi() @FlutterApi() abstract class Api { @@ -278,7 +278,7 @@ abstract class Api { }); test('Only allow one api annotation plus @ConfigurePigeon', () { - const String source = ''' + const source = ''' @ConfigurePigeon(InternalPigeonOptions( dartOut: 'stdout', javaOut: 'stdout', @@ -295,7 +295,7 @@ abstract class Api { }); test('enum in classes', () { - const String code = ''' + const code = ''' enum Enum1 { one, two, @@ -321,7 +321,7 @@ abstract class Api { }); test('two methods', () { - const String code = ''' + const code = ''' class Input1 { String? input; } @@ -345,7 +345,7 @@ abstract class ApiTwoMethods { }); test('nested', () { - const String code = ''' + const code = ''' class Input1 { String? input; } @@ -371,7 +371,7 @@ abstract class Api { }); test('flutter api', () { - const String code = ''' + const code = ''' class Input1 { String? input; } @@ -393,7 +393,7 @@ abstract class AFlutterApi { }); test('void host api', () { - const String code = ''' + const code = ''' class Input1 { String? input; } @@ -412,7 +412,7 @@ abstract class VoidApi { }); test('void arg host api', () { - const String code = ''' + const code = ''' class Output1 { String? output; } @@ -435,7 +435,7 @@ abstract class VoidArgApi { }); test('mockDartClass', () { - const String code = ''' + const code = ''' class Output1 { String? output; } @@ -455,7 +455,7 @@ abstract class ApiWithMockDartClass { }); test('only visible from nesting', () { - const String code = ''' + const code = ''' class OnlyVisibleFromNesting { String? foo; } @@ -489,13 +489,13 @@ abstract class NestorApi { }); test('Dart generator copyright flag', () { - final Root root = Root(apis: [], classes: [], enums: []); - const PigeonOptions options = PigeonOptions( + final root = Root(apis: [], classes: [], enums: []); + const options = PigeonOptions( copyrightHeader: './copyright_header.txt', dartOut: '', ); - final DartGeneratorAdapter dartGeneratorAdapter = DartGeneratorAdapter(); - final StringBuffer buffer = StringBuffer(); + final dartGeneratorAdapter = DartGeneratorAdapter(); + final buffer = StringBuffer(); dartGeneratorAdapter.generate( buffer, InternalPigeonOptions.fromPigeonOptions(options), @@ -506,13 +506,13 @@ abstract class NestorApi { }); test('Java generator copyright flag', () { - final Root root = Root(apis: [], classes: [], enums: []); - const PigeonOptions options = PigeonOptions( + final root = Root(apis: [], classes: [], enums: []); + const options = PigeonOptions( javaOut: 'Foo.java', copyrightHeader: './copyright_header.txt', ); - final JavaGeneratorAdapter javaGeneratorAdapter = JavaGeneratorAdapter(); - final StringBuffer buffer = StringBuffer(); + final javaGeneratorAdapter = JavaGeneratorAdapter(); + final buffer = StringBuffer(); javaGeneratorAdapter.generate( buffer, InternalPigeonOptions.fromPigeonOptions(options), @@ -523,15 +523,15 @@ abstract class NestorApi { }); test('Objc header generator copyright flag', () { - final Root root = Root(apis: [], classes: [], enums: []); - const PigeonOptions options = PigeonOptions( + final root = Root(apis: [], classes: [], enums: []); + const options = PigeonOptions( copyrightHeader: './copyright_header.txt', objcHeaderOut: '', objcSourceOut: '', ); - final ObjcGeneratorAdapter objcHeaderGeneratorAdapter = + final objcHeaderGeneratorAdapter = ObjcGeneratorAdapter(); - final StringBuffer buffer = StringBuffer(); + final buffer = StringBuffer(); objcHeaderGeneratorAdapter.generate( buffer, InternalPigeonOptions.fromPigeonOptions(options), @@ -542,15 +542,15 @@ abstract class NestorApi { }); test('Objc source generator copyright flag', () { - final Root root = Root(apis: [], classes: [], enums: []); - const PigeonOptions options = PigeonOptions( + final root = Root(apis: [], classes: [], enums: []); + const options = PigeonOptions( copyrightHeader: './copyright_header.txt', objcHeaderOut: '', objcSourceOut: '', ); - final ObjcGeneratorAdapter objcSourceGeneratorAdapter = + final objcSourceGeneratorAdapter = ObjcGeneratorAdapter(); - final StringBuffer buffer = StringBuffer(); + final buffer = StringBuffer(); objcSourceGeneratorAdapter.generate( buffer, InternalPigeonOptions.fromPigeonOptions(options), @@ -561,13 +561,13 @@ abstract class NestorApi { }); test('Swift generator copyright flag', () { - final Root root = Root(apis: [], classes: [], enums: []); - const PigeonOptions options = PigeonOptions( + final root = Root(apis: [], classes: [], enums: []); + const options = PigeonOptions( swiftOut: 'Foo.swift', copyrightHeader: './copyright_header.txt', ); - final SwiftGeneratorAdapter swiftGeneratorAdapter = SwiftGeneratorAdapter(); - final StringBuffer buffer = StringBuffer(); + final swiftGeneratorAdapter = SwiftGeneratorAdapter(); + final buffer = StringBuffer(); swiftGeneratorAdapter.generate( buffer, InternalPigeonOptions.fromPigeonOptions(options), @@ -578,14 +578,14 @@ abstract class NestorApi { }); test('C++ header generator copyright flag', () { - final Root root = Root(apis: [], classes: [], enums: []); - const PigeonOptions options = PigeonOptions( + final root = Root(apis: [], classes: [], enums: []); + const options = PigeonOptions( cppSourceOut: '', cppHeaderOut: 'Foo.h', copyrightHeader: './copyright_header.txt', ); - final CppGeneratorAdapter cppHeaderGeneratorAdapter = CppGeneratorAdapter(); - final StringBuffer buffer = StringBuffer(); + final cppHeaderGeneratorAdapter = CppGeneratorAdapter(); + final buffer = StringBuffer(); cppHeaderGeneratorAdapter.generate( buffer, InternalPigeonOptions.fromPigeonOptions(options), @@ -596,16 +596,16 @@ abstract class NestorApi { }); test('C++ source generator copyright flag', () { - final Root root = Root(apis: [], classes: [], enums: []); - const PigeonOptions options = PigeonOptions( + final root = Root(apis: [], classes: [], enums: []); + const options = PigeonOptions( copyrightHeader: './copyright_header.txt', cppHeaderOut: '', cppSourceOut: '', ); - final CppGeneratorAdapter cppSourceGeneratorAdapter = CppGeneratorAdapter( + final cppSourceGeneratorAdapter = CppGeneratorAdapter( fileTypeList: [FileType.source], ); - final StringBuffer buffer = StringBuffer(); + final buffer = StringBuffer(); cppSourceGeneratorAdapter.generate( buffer, InternalPigeonOptions.fromPigeonOptions(options), @@ -616,7 +616,7 @@ abstract class NestorApi { }); test('nested enum', () { - const String code = ''' + const code = ''' enum NestedEnum { one, two } class NestedEnum1 { @@ -645,7 +645,7 @@ abstract class NestedEnumApi { }); test('test circular references', () { - const String code = ''' + const code = ''' class Foo { Bar? bar; } @@ -670,14 +670,14 @@ abstract class NotificationsHostApi { }); test('test compilation error', () { - const String code = 'Hello\n'; + const code = 'Hello\n'; final ParseResults results = parseSource(code); expect(results.errors.length, greaterThanOrEqualTo(1)); expect(results.errors[0].lineNumber, 1); }); test('test method in data class error', () { - const String code = ''' + const code = ''' class Foo { int? x; int? foo() { return x; } @@ -695,7 +695,7 @@ abstract class Api { }); test('test field initialization', () { - const String code = ''' + const code = ''' class Foo { int? x = 123; } @@ -712,7 +712,7 @@ abstract class Api { }); test('test field in api error', () { - const String code = ''' + const code = ''' class Foo { int? x; } @@ -730,7 +730,7 @@ abstract class Api { }); test('constructor in data class', () { - const String code = ''' + const code = ''' class Foo { int? x; Foo({this.x}); @@ -746,7 +746,7 @@ abstract class Api { }); test('constructor body in data class', () { - const String code = ''' + const code = ''' class Foo { int? x; Foo({this.x}) { print('hi'); } @@ -764,7 +764,7 @@ abstract class Api { }); test('constructor body in data class', () { - const String code = ''' + const code = ''' class Foo { int? x; Foo() : x = 0; @@ -782,7 +782,7 @@ abstract class Api { }); test('constructor in api class', () { - const String code = ''' + const code = ''' class Foo { int? x; } @@ -800,20 +800,20 @@ abstract class Api { }); test('test invalid import', () { - const String code = "import 'foo.dart';\n"; + const code = "import 'foo.dart';\n"; final ParseResults results = parseSource(code); expect(results.errors.length, greaterThanOrEqualTo(1)); expect(results.errors[0].lineNumber, 1); }); test('test valid import', () { - const String code = "import 'package:pigeon/pigeon.dart';\n"; + const code = "import 'package:pigeon/pigeon.dart';\n"; final ParseResults parseResults = parseSource(code); expect(parseResults.errors.length, 0); }); test('error with static field', () { - const String code = ''' + const code = ''' class WithStaticField { static int? x; int? y; @@ -831,7 +831,7 @@ abstract class WithStaticFieldApi { }); test('parse generics', () { - const String code = ''' + const code = ''' class Foo { List? list; } @@ -849,7 +849,7 @@ abstract class Api { }); test('parse recursive generics', () { - const String code = ''' + const code = ''' class Foo { List?>? list; } @@ -868,7 +868,7 @@ abstract class Api { }); test('enums argument host', () { - const String code = ''' + const code = ''' enum Foo { one, two, @@ -884,7 +884,7 @@ abstract class Api { }); test('enums argument flutter', () { - const String code = ''' + const code = ''' enum Foo { one, @@ -901,7 +901,7 @@ abstract class Api { }); test('enums list argument', () { - const String code = ''' + const code = ''' enum Foo { one, two } @HostApi() @@ -914,7 +914,7 @@ abstract class Api { }); test('enums map argument key', () { - const String code = ''' + const code = ''' enum Foo { one, two } @HostApi() @@ -927,7 +927,7 @@ abstract class Api { }); test('enums map argument value', () { - const String code = ''' + const code = ''' enum Foo { one, two } @HostApi() @@ -940,7 +940,7 @@ abstract class Api { }); test('enums return value', () { - const String code = ''' + const code = ''' enum Foo { one, @@ -957,7 +957,7 @@ abstract class Api { }); test('return type generics', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { List doit(); @@ -982,7 +982,7 @@ abstract class Api { }); test('argument generics', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { void doit(int x, List value); @@ -1018,7 +1018,7 @@ abstract class Api { }); test('map generics', () { - const String code = ''' + const code = ''' class Foo { Map map; } @@ -1036,7 +1036,7 @@ abstract class Api { }); test('two parameters', () { - const String code = ''' + const code = ''' class Input { String? input; } @@ -1054,7 +1054,7 @@ abstract class Api { }); test('no type name argument', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { void method(x); @@ -1070,7 +1070,7 @@ abstract class Api { }); test('custom objc selector', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { @ObjCSelector('subtractValue:by:') @@ -1088,7 +1088,7 @@ abstract class Api { }); test('custom objc invalid selector', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { @ObjCSelector('subtractValue:by:error:') @@ -1105,7 +1105,7 @@ abstract class Api { }); test('custom objc no parameters', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { @ObjCSelector('foobar') @@ -1120,7 +1120,7 @@ abstract class Api { }); test('custom swift valid function signature', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { @SwiftFunction('subtractValue(_:by:)') @@ -1138,7 +1138,7 @@ abstract class Api { }); test('custom swift invalid function signature', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { @SwiftFunction('subtractValue(_:by:error:)') @@ -1155,7 +1155,7 @@ abstract class Api { }); test('custom swift function signature no parameters', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { @SwiftFunction('foobar()') @@ -1170,15 +1170,15 @@ abstract class Api { }); test('dart test has copyright', () { - final Root root = Root(apis: [], classes: [], enums: []); - const PigeonOptions options = PigeonOptions( + final root = Root(apis: [], classes: [], enums: []); + const options = PigeonOptions( copyrightHeader: './copyright_header.txt', dartTestOut: 'stdout', dartOut: 'stdout', ); - final DartTestGeneratorAdapter dartTestGeneratorAdapter = + final dartTestGeneratorAdapter = DartTestGeneratorAdapter(); - final StringBuffer buffer = StringBuffer(); + final buffer = StringBuffer(); dartTestGeneratorAdapter.generate( buffer, InternalPigeonOptions.fromPigeonOptions(options), @@ -1189,7 +1189,7 @@ abstract class Api { }); test('only class reference is type argument for return value', () { - const String code = ''' + const code = ''' class Foo { int? foo; } @@ -1206,7 +1206,7 @@ abstract class Api { }); test('only class reference is type argument for argument', () { - const String code = ''' + const code = ''' class Foo { int? foo; } @@ -1223,7 +1223,7 @@ abstract class Api { }); test('recurse into type parameters', () { - const String code = ''' + const code = ''' class Foo { int? foo; List bars; @@ -1256,7 +1256,7 @@ abstract class Api { }); test('undeclared class in argument type argument', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { void storeAll(List foos); @@ -1269,7 +1269,7 @@ abstract class Api { }); test('Object type argument', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { void storeAll(List foos); @@ -1280,7 +1280,7 @@ abstract class Api { }); test('Export unreferenced enums', () { - const String code = ''' + const code = ''' enum MessageKey { title, subtitle, @@ -1303,7 +1303,7 @@ abstract class HostApiBridge { }); test('@ConfigurePigeon JavaOptions.copyrightHeader', () { - const String code = ''' + const code = ''' @ConfigurePigeon(InternalPigeonOptions( javaOptions: JavaOptions(copyrightHeader: ['A', 'Header']), )) @@ -1318,7 +1318,7 @@ class Message { }); test('@ConfigurePigeon DartOptions.copyrightHeader', () { - const String code = ''' + const code = ''' @ConfigurePigeon(PigeonOptions( dartOptions: DartOptions(copyrightHeader: ['A', 'Header']), )) @@ -1333,7 +1333,7 @@ class Message { }); test('@ConfigurePigeon ObjcOptions.copyrightHeader', () { - const String code = ''' + const code = ''' @ConfigurePigeon(PigeonOptions( objcOptions: ObjcOptions(copyrightHeader: ['A', 'Header']), )) @@ -1348,7 +1348,7 @@ class Message { }); test('@ConfigurePigeon ObjcOptions.headerIncludePath', () { - const String code = ''' + const code = ''' @ConfigurePigeon(PigeonOptions( objcOptions: ObjcOptions(headerIncludePath: 'Header.path'), )) @@ -1363,7 +1363,7 @@ class Message { }); test('@ConfigurePigeon CppOptions.headerIncludePath', () { - const String code = ''' + const code = ''' @ConfigurePigeon(PigeonOptions( cppOptions: CppOptions(headerIncludePath: 'Header.path'), )) @@ -1378,7 +1378,7 @@ class Message { }); test('return nullable', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { int? calc(); @@ -1391,7 +1391,7 @@ abstract class Api { }); test('nullable parameters', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { void calc(int? value); @@ -1406,7 +1406,7 @@ abstract class Api { }); test('task queue specified', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { @TaskQueue(type: TaskQueueType.serialBackgroundThread) @@ -1423,7 +1423,7 @@ abstract class Api { }); test('task queue unspecified', () { - const String code = ''' + const code = ''' @HostApi() abstract class Api { int? calc(); @@ -1439,7 +1439,7 @@ abstract class Api { }); test('unsupported task queue on FlutterApi', () { - const String code = ''' + const code = ''' @FlutterApi() abstract class Api { @TaskQueue(type: TaskQueueType.serialBackgroundThread) @@ -1456,9 +1456,9 @@ abstract class Api { }); test('generator validation', () async { - final Completer completer = Completer(); + final completer = Completer(); withTempFile('foo.dart', (File input) async { - final _ValidatorGeneratorAdapter generator = _ValidatorGeneratorAdapter( + final generator = _ValidatorGeneratorAdapter( stdout, ); final int result = await Pigeon.run( @@ -1473,9 +1473,9 @@ abstract class Api { }); test('generator validation skipped', () async { - final Completer completer = Completer(); + final completer = Completer(); withTempFile('foo.dart', (File input) async { - final _ValidatorGeneratorAdapter generator = _ValidatorGeneratorAdapter( + final generator = _ValidatorGeneratorAdapter( null, ); final int result = await Pigeon.run( @@ -1490,9 +1490,9 @@ abstract class Api { }); test('run with PigeonOptions', () async { - final Completer completer = Completer(); + final completer = Completer(); withTempFile('foo.dart', (File input) async { - final _ValidatorGeneratorAdapter generator = _ValidatorGeneratorAdapter( + final generator = _ValidatorGeneratorAdapter( null, ); final int result = await Pigeon.runWithOptions( @@ -1507,7 +1507,7 @@ abstract class Api { }); test('unsupported non-positional parameters on FlutterApi', () { - const String code = ''' + const code = ''' @FlutterApi() abstract class Api { int? calc({int? anInt}); @@ -1523,7 +1523,7 @@ abstract class Api { }); test('unsupported optional parameters on FlutterApi', () { - const String code = ''' + const code = ''' @FlutterApi() abstract class Api { int? calc([int? anInt]); @@ -1539,7 +1539,7 @@ abstract class Api { }); test('simple parse ProxyApi', () { - const String code = ''' + const code = ''' @ProxyApi() abstract class MyClass { MyClass(); @@ -1553,7 +1553,7 @@ abstract class MyClass { final Root root = parseResult.root; expect(root.apis.length, equals(1)); - final AstProxyApi proxyApi = root.apis.single as AstProxyApi; + final proxyApi = root.apis.single as AstProxyApi; expect(proxyApi.name, equals('MyClass')); expect(proxyApi.constructors.single.name, equals('')); expect(proxyApi.methods.length, equals(2)); @@ -1569,7 +1569,7 @@ abstract class MyClass { group('ProxyApi validation', () { test('error with using data class', () { - const String code = ''' + const code = ''' class DataClass { late int input; } @@ -1588,7 +1588,7 @@ abstract class MyClass { }); test('super class must be proxy api', () { - const String code = ''' + const code = ''' class DataClass { late int input; } @@ -1607,7 +1607,7 @@ abstract class MyClass extends DataClass { }); test('interface must be proxy api', () { - const String code = ''' + const code = ''' class DataClass { late int input; } @@ -1626,7 +1626,7 @@ abstract class MyClass implements DataClass { }); test('unattached fields can not be inherited', () { - const String code = ''' + const code = ''' @ProxyApi() abstract class MyClass extends MyOtherClass { } @@ -1648,7 +1648,7 @@ abstract class MyOtherClass { test( 'api is not used as an attached field while having an unattached field', () { - const String code = ''' + const code = ''' @ProxyApi() abstract class MyClass { @attached @@ -1674,7 +1674,7 @@ abstract class MyOtherClass { test( 'api is not used as an attached field while having a required Flutter method', () { - const String code = ''' + const code = ''' @ProxyApi() abstract class MyClass { @attached @@ -1698,7 +1698,7 @@ abstract class MyOtherClass { ); test('interfaces can only have callback methods', () { - const String code = ''' + const code = ''' @ProxyApi() abstract class MyClass implements MyOtherClass { } @@ -1719,7 +1719,7 @@ abstract class MyOtherClass { }); test('attached fields must be a ProxyApi', () { - const String code = ''' + const code = ''' @ProxyApi() abstract class MyClass { @attached @@ -1735,7 +1735,7 @@ abstract class MyClass { }); test('attached fields must not be nullable', () { - const String code = ''' + const code = ''' @ProxyApi() abstract class MyClass { @attached @@ -1751,7 +1751,7 @@ abstract class MyClass { }); test('callback methods with non-null return types must be non-null', () { - const String code = ''' + const code = ''' @ProxyApi() abstract class MyClass { late String Function()? aCallbackMethod; @@ -1770,7 +1770,7 @@ abstract class MyClass { group('event channel validation', () { test('methods cannot contain parameters', () { - const String code = ''' + const code = ''' @EventChannelApi() abstract class EventChannelApi { int streamInts(int event); @@ -1789,7 +1789,7 @@ abstract class EventChannelApi { group('sealed inheritance validation', () { test('super class must be sealed', () { - const String code = ''' + const code = ''' class DataClass {} class ChildClass extends DataClass { ChildClass(this.input); @@ -1810,7 +1810,7 @@ abstract class events { }); test('super class must be sealed', () { - const String code = ''' + const code = ''' sealed class DataClass { DataClass(this.input); int input; diff --git a/packages/pigeon/test/pigeon_test.dart b/packages/pigeon/test/pigeon_test.dart index 564cdcedf7c..8756fdcbdc7 100644 --- a/packages/pigeon/test/pigeon_test.dart +++ b/packages/pigeon/test/pigeon_test.dart @@ -7,22 +7,22 @@ import 'package:test/test.dart'; void main() { test('Should be able to import JavaOptions', () async { - const JavaOptions javaOptions = JavaOptions(); + const javaOptions = JavaOptions(); expect(javaOptions, isNotNull); }); test('Should be able to import ObjcOptions', () async { - const ObjcOptions objcOptions = ObjcOptions(); + const objcOptions = ObjcOptions(); expect(objcOptions, isNotNull); }); test('Should be able to import SwiftOptions', () async { - const SwiftOptions swiftOptions = SwiftOptions(); + const swiftOptions = SwiftOptions(); expect(swiftOptions, isNotNull); }); test('Should be able to import KotlinOptions', () async { - const KotlinOptions kotlinOptions = KotlinOptions(); + const kotlinOptions = KotlinOptions(); expect(kotlinOptions, isNotNull); }); } diff --git a/packages/pigeon/test/swift/proxy_api_test.dart b/packages/pigeon/test/swift/proxy_api_test.dart index b35d1ba8292..ccf1df2f97e 100644 --- a/packages/pigeon/test/swift/proxy_api_test.dart +++ b/packages/pigeon/test/swift/proxy_api_test.dart @@ -11,7 +11,7 @@ const String DEFAULT_PACKAGE_NAME = 'test_package'; void main() { group('ProxyApi', () { test('one api', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -81,8 +81,8 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions( fileSpecificClassNameComponent: 'MyFile', @@ -92,7 +92,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); // import @@ -174,7 +174,7 @@ void main() { group('imports', () { test('add check if every class does not support iOS', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -190,21 +190,21 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('#if !os(iOS)\nimport MyImport\n#endif')); }); test('add check if every class does not support macOS', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -220,21 +220,21 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('#if !os(macOS)\nimport MyImport\n#endif')); }); test('add check if for multiple unsupported platforms', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -251,15 +251,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, @@ -268,7 +268,7 @@ void main() { }); test('do not add check if at least one class is supported', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -291,15 +291,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(contains('#if !os(iOS)\nimport MyImport'))); }); @@ -307,13 +307,13 @@ void main() { group('inheritance', () { test('extends', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -331,26 +331,26 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('var pigeonApiApi2: PigeonApiApi2')); }); test('implements', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -370,32 +370,32 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('var pigeonApiApi2: PigeonApiApi2')); }); test('implements 2 ProxyApis', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final AstProxyApi api3 = AstProxyApi( + final api3 = AstProxyApi( name: 'Api3', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -421,15 +421,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('var pigeonApiApi2: PigeonApiApi2')); expect(code, contains('var pigeonApiApi3: PigeonApiApi3')); }); @@ -437,7 +437,7 @@ void main() { group('Constructors', () { test('empty name and no params constructor', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -451,15 +451,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect(code, contains('class PigeonApiApi: PigeonApiProtocolApi ')); expect( @@ -483,7 +483,7 @@ void main() { }); test('named constructor', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -500,15 +500,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( collapsedCode, @@ -525,11 +525,11 @@ void main() { }); test('multiple params constructor', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -597,15 +597,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect(code, contains('class PigeonApiApi: PigeonApiProtocolApi ')); expect( @@ -628,7 +628,7 @@ void main() { test( 'host platform constructor calls new instance error for required callbacks', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -647,8 +647,8 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions( errorClassName: 'TestError', @@ -658,7 +658,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( @@ -673,11 +673,11 @@ void main() { group('Fields', () { test('constructor with fields', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -742,15 +742,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( collapsedCode, @@ -814,13 +814,13 @@ void main() { }); test('attached field', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -843,15 +843,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -867,13 +867,13 @@ void main() { }); test('static attached field', () { - final AstProxyApi api2 = AstProxyApi( + final api2 = AstProxyApi( name: 'Api2', constructors: [], fields: [], methods: [], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -897,15 +897,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains(r'func aField(pigeonApi: PigeonApiApi) throws -> Api2'), @@ -921,11 +921,11 @@ void main() { group('Host methods', () { test('multiple params method', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -995,15 +995,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( collapsedCode, @@ -1025,7 +1025,7 @@ void main() { }); test('static method', () { - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -1045,15 +1045,15 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( collapsedCode, @@ -1068,11 +1068,11 @@ void main() { group('Flutter methods', () { test('multiple params flutter method', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'AnEnum', members: [EnumMember(name: 'one')], ); - final Root root = Root( + final root = Root( apis: [ AstProxyApi( name: 'Api', @@ -1136,15 +1136,15 @@ void main() { classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const SwiftGenerator generator = SwiftGenerator(); + final sink = StringBuffer(); + const generator = SwiftGenerator(); generator.generate( const InternalSwiftOptions(swiftOut: ''), root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); expect( collapsedCode, @@ -1185,7 +1185,7 @@ void main() { /// void method( int param1, int param2, ) /// ``` String _collapseNewlineAndIndentation(String string) { - final StringBuffer result = StringBuffer(); + final result = StringBuffer(); for (final String line in string.split('\n')) { result.write('${line.trimLeft()} '); } diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart index d30cd8ae4ed..1772bde30f8 100644 --- a/packages/pigeon/test/swift_generator_test.dart +++ b/packages/pigeon/test/swift_generator_test.dart @@ -25,7 +25,7 @@ final Enum emptyEnum = Enum( void main() { test('gen one class', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -34,23 +34,23 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('struct Foobar')); expect(code, contains('var field1: Int64? = nil')); expect( @@ -62,30 +62,30 @@ void main() { }); test('gen one enum', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'Foobar', members: [ EnumMember(name: 'one'), EnumMember(name: 'two'), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('enum Foobar: Int')); expect(code, contains(' case one = 0')); expect(code, contains(' case two = 1')); @@ -93,7 +93,7 @@ void main() { }); test('primitive enum host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Bar', @@ -127,18 +127,18 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('enum Foo: Int')); expect( code, @@ -152,7 +152,7 @@ void main() { }); test('gen one host api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -201,18 +201,18 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('protocol Api')); expect(code, matches('func doSomething.*Input.*Output')); expect(code, contains('doSomethingChannel.setMessageHandler')); @@ -220,7 +220,7 @@ void main() { }); test('all the simple datatypes header', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -276,18 +276,18 @@ void main() { enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('var aBool: Bool? = nil')); expect(code, contains('var aInt: Int64? = nil')); expect(code, contains('var aDouble: Double? = nil')); @@ -299,12 +299,12 @@ void main() { }); test('gen pigeon error type', () { - final Root root = Root(apis: [], classes: [], enums: []); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final root = Root(apis: [], classes: [], enums: []); + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, @@ -312,7 +312,7 @@ void main() { sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class PigeonError: Error')); expect(code, contains('let code: String')); expect(code, contains('let message: String?')); @@ -324,7 +324,7 @@ void main() { }); test('gen one flutter api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -373,18 +373,18 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Api')); expect( code, @@ -398,7 +398,7 @@ void main() { }); test('gen host void api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -434,25 +434,25 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, isNot(matches('.*doSomething(.*) ->'))); expect(code, matches('doSomething(.*)')); expect(code, isNot(contains('if ('))); }); test('gen flutter void return api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -488,18 +488,18 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains('completion: @escaping (Result) -> Void'), @@ -509,7 +509,7 @@ void main() { }); test('gen host void argument api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -540,18 +540,18 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('func doSomething() throws -> Output')); expect(code, contains('let result = try api.doSomething()')); expect(code, contains('reply(wrapResult(result))')); @@ -559,7 +559,7 @@ void main() { }); test('gen flutter void argument api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -590,18 +590,18 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -613,7 +613,7 @@ void main() { }); test('gen list', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -628,25 +628,25 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('struct Foobar')); expect(code, contains('var field1: [Any?]? = nil')); expect(code, isNot(contains('if ('))); }); test('gen map', () { - final Root root = Root( + final root = Root( apis: [], classes: [ Class( @@ -661,25 +661,25 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('struct Foobar')); expect(code, contains('var field1: [AnyHashable?: Any?]? = nil')); expect(code, isNot(contains('if ('))); }); test('gen nested', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Outer', fields: [ NamedType( @@ -692,7 +692,7 @@ void main() { ), ], ); - final Class nestedClass = Class( + final nestedClass = Class( name: 'Nested', fields: [ NamedType( @@ -701,23 +701,23 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition, nestedClass], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('struct Outer')); expect(code, contains('struct Nested')); expect(code, contains('var nested: Nested? = nil')); @@ -736,7 +736,7 @@ void main() { }); test('gen one async Host Api', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -786,18 +786,18 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('protocol Api')); expect(code, contains('api.doSomething(arg: argArg) { result in')); expect(code, contains('reply(wrapResult(res))')); @@ -805,7 +805,7 @@ void main() { }); test('gen one async Flutter Api', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -855,32 +855,32 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('class Api')); expect(code, matches('func doSomething.*Input.*completion.*Output.*Void')); expect(code, isNot(contains('if ('))); }); test('gen one enum class', () { - final Enum anEnum = Enum( + final anEnum = Enum( name: 'Enum1', members: [ EnumMember(name: 'one'), EnumMember(name: 'two'), ], ); - final Class classDefinition = Class( + final classDefinition = Class( name: 'EnumClass', fields: [ NamedType( @@ -893,23 +893,23 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [anEnum], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('enum Enum1: Int')); expect(code, contains('case one = 0')); expect(code, contains('case two = 1')); @@ -917,27 +917,27 @@ void main() { }); test('header', () { - final Root root = Root(apis: [], classes: [], enums: []); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final root = Root(apis: [], classes: [], enums: []); + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', copyrightHeader: ['hello world', ''], ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, startsWith('// hello world')); // There should be no trailing whitespace on generated comments. expect(code, isNot(matches(RegExp(r'^//.* $', multiLine: true)))); }); test('generics - list', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -952,29 +952,29 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('struct Foobar')); expect(code, contains('var field1: [Int64?]')); }); test('generics - maps', () { - final Class classDefinition = Class( + final classDefinition = Class( name: 'Foobar', fields: [ NamedType( @@ -990,29 +990,29 @@ void main() { ), ], ); - final Root root = Root( + final root = Root( apis: [], classes: [classDefinition], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('struct Foobar')); expect(code, contains('var field1: [String?: String?]')); }); test('host generics argument', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1040,23 +1040,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('func doit(arg: [Int64?]')); }); test('flutter generics argument', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1084,23 +1084,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('func doit(arg argArg: [Int64?]')); }); test('host generics return', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1123,25 +1123,25 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('func doit() throws -> [Int64?]')); expect(code, contains('let result = try api.doit()')); expect(code, contains('reply(wrapResult(result))')); }); test('flutter generics return', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1164,18 +1164,18 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1187,7 +1187,7 @@ void main() { }); test('host multiple args', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1222,18 +1222,18 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('func add(x: Int64, y: Int64) throws -> Int64')); expect(code, contains('let args = message as! [Any?]')); expect(code, contains('let xArg = args[0] as! Int64')); @@ -1243,7 +1243,7 @@ void main() { }); test('flutter multiple args', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1278,18 +1278,18 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('let channel = FlutterBasicMessageChannel')); expect(code, contains('let result = listResponse[0] as! Int64')); expect(code, contains('completion(.success(result))')); @@ -1306,7 +1306,7 @@ void main() { }); test('return nullable host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1326,23 +1326,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('func doit() throws -> Int64?')); }); test('return nullable host async', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1363,18 +1363,18 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1384,7 +1384,7 @@ void main() { }); test('nullable argument host', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1409,23 +1409,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('let fooArg: Int64? = nilOrValue(args[0])')); }); test('nullable argument flutter', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1450,18 +1450,18 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( @@ -1471,7 +1471,7 @@ void main() { }); test('nonnull fields', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1510,23 +1510,23 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('var input: String\n')); }); test('transfers documentation comments', () { - final List comments = [ + final comments = [ ' api comment', ' api method comment', ' class comment', @@ -1534,12 +1534,12 @@ void main() { ' enum comment', ' enum member comment', ]; - int count = 0; + var count = 0; - final List unspacedComments = ['////////']; - int unspacedCount = 0; + final unspacedComments = ['////////']; + var unspacedCount = 0; - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'api', @@ -1600,26 +1600,26 @@ void main() { ), ], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); - for (final String comment in comments) { + final code = sink.toString(); + for (final comment in comments) { expect(code, contains('///$comment')); } expect(code, contains('/// ///')); }); test('creates custom codecs', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1669,23 +1669,23 @@ void main() { ], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains(': FlutterStandardReader ')); }); test('swift function signature', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1718,23 +1718,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('func setValue(_ value: Int64, for key: String)')); }); test('swift function signature with same name argument', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1760,23 +1760,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('func removeValue(key: String)')); }); test('swift function signature with no arguments', () { - final Root root = Root( + final root = Root( apis: [ AstHostApi( name: 'Api', @@ -1794,23 +1794,23 @@ void main() { classes: [], enums: [], ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions swiftOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const swiftOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( swiftOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect(code, contains('func removeAll()')); }); test('connection error contains channel name', () { - final Root root = Root( + final root = Root( apis: [ AstFlutterApi( name: 'Api', @@ -1836,18 +1836,18 @@ void main() { enums: [], containsFlutterApi: true, ); - final StringBuffer sink = StringBuffer(); - const InternalSwiftOptions kotlinOptions = InternalSwiftOptions( + final sink = StringBuffer(); + const kotlinOptions = InternalSwiftOptions( swiftOut: '', ); - const SwiftGenerator generator = SwiftGenerator(); + const generator = SwiftGenerator(); generator.generate( kotlinOptions, root, sink, dartPackageName: DEFAULT_PACKAGE_NAME, ); - final String code = sink.toString(); + final code = sink.toString(); expect( code, contains( diff --git a/packages/pigeon/test/version_test.dart b/packages/pigeon/test/version_test.dart index 766c77da767..53cb80b35e6 100644 --- a/packages/pigeon/test/version_test.dart +++ b/packages/pigeon/test/version_test.dart @@ -9,9 +9,9 @@ import 'package:test/test.dart'; void main() { test('pigeon version matches pubspec', () { - final String pubspecPath = '${Directory.current.path}/pubspec.yaml'; + final pubspecPath = '${Directory.current.path}/pubspec.yaml'; final String pubspec = File(pubspecPath).readAsStringSync(); - final RegExp regex = RegExp(r'version:\s*(.*?) #'); + final regex = RegExp(r'version:\s*(.*?) #'); final RegExpMatch? match = regex.firstMatch(pubspec); expect(match, isNotNull); expect( diff --git a/packages/pigeon/tool/generate.dart b/packages/pigeon/tool/generate.dart index b32381eb09b..ed9e2bde111 100644 --- a/packages/pigeon/tool/generate.dart +++ b/packages/pigeon/tool/generate.dart @@ -28,7 +28,7 @@ const String _overflowFiller = 'overflow'; const List _fileGroups = [_test, _example]; Future main(List args) async { - final ArgParser parser = ArgParser() + final parser = ArgParser() ..addFlag( _formatFlag, abbr: 'f', diff --git a/packages/pigeon/tool/run_tests.dart b/packages/pigeon/tool/run_tests.dart index b0885d01b59..ced9f9c9848 100644 --- a/packages/pigeon/tool/run_tests.dart +++ b/packages/pigeon/tool/run_tests.dart @@ -28,7 +28,7 @@ void _validateTestCoverage(List> shards) { if (missing.isNotEmpty) { print('The following test suites are not being run on any host:'); - for (final String suite in missing) { + for (final suite in missing) { print(' $suite'); } exit(1); @@ -185,7 +185,7 @@ Future> _modifiedFiles({ Future main(List args) async { // Run most tests on Linux, since Linux tends to be the easiest and cheapest. - const List linuxHostTests = [ + const linuxHostTests = [ commandLineTests, androidJavaUnitTests, androidJavaLint, @@ -196,7 +196,7 @@ Future main(List args) async { linuxUnitTests, linuxIntegrationTests, ]; - const List macOSHostTests = [ + const macOSHostTests = [ iOSObjCUnitTests, // Currently these are testing exactly the same thing as // macOS*IntegrationTests, so we don't need to run both by default. This @@ -210,7 +210,7 @@ Future main(List args) async { macOSSwiftIntegrationTests, ]; // Run Windows tests on Windows, since that's the only place they can run. - const List windowsHostTests = [ + const windowsHostTests = [ windowsUnitTests, windowsIntegrationTests, ]; diff --git a/packages/pigeon/tool/shared/flutter_utils.dart b/packages/pigeon/tool/shared/flutter_utils.dart index 97f6abe3652..c6e3ed9f534 100644 --- a/packages/pigeon/tool/shared/flutter_utils.dart +++ b/packages/pigeon/tool/shared/flutter_utils.dart @@ -18,7 +18,7 @@ Future getDeviceForPlatform(String platform) async { return null; } - String output = result.stdout as String; + var output = result.stdout as String; // --machine doesn't currently prevent the tool from printing banners; // see https://github.com/flutter/flutter/issues/86055. This workaround // can be removed once that is fixed. @@ -26,11 +26,11 @@ Future getDeviceForPlatform(String platform) async { final List> devices = (jsonDecode(output) as List).cast>(); - for (final Map deviceInfo in devices) { + for (final deviceInfo in devices) { final String targetPlatform = (deviceInfo['targetPlatform'] as String?) ?? ''; if (targetPlatform.startsWith(platform)) { - final String? deviceId = deviceInfo['id'] as String?; + final deviceId = deviceInfo['id'] as String?; if (deviceId != null) { return deviceId; } diff --git a/packages/pigeon/tool/shared/generation.dart b/packages/pigeon/tool/shared/generation.dart index 48ee3daf16a..4a435a94f40 100644 --- a/packages/pigeon/tool/shared/generation.dart +++ b/packages/pigeon/tool/shared/generation.dart @@ -54,14 +54,14 @@ String _snakeToPascalCase(String snake) { // TODO(stuartmorgan): Remove the need for this when addressing // https://github.com/flutter/flutter/issues/115168. String _javaFilenameForName(String inputName) { - const Map specialCases = { + const specialCases = { 'message': 'MessagePigeon', }; return specialCases[inputName] ?? _snakeToPascalCase(inputName); } Future generateExamplePigeons() async { - int success = 0; + var success = 0; success = await runPigeon( input: './example/app/pigeons/messages.dart', basePath: './example/app', @@ -81,7 +81,7 @@ Future generateTestPigeons({ }) async { // TODO(stuartmorgan): Make this dynamic rather than hard-coded. Or eliminate // it entirely; see https://github.com/flutter/flutter/issues/115169. - const Set inputs = { + const inputs = { 'core_tests', 'enum', 'event_channel_tests', @@ -96,8 +96,8 @@ Future generateTestPigeons({ 'proxy_api_tests', }; - const String testPluginName = 'test_plugin'; - const String alternateTestPluginName = 'alternate_language_test_plugin'; + const testPluginName = 'test_plugin'; + const alternateTestPluginName = 'alternate_language_test_plugin'; final String outputBase = p.join(baseDir, 'platform_tests', testPluginName); final String alternateOutputBase = p.join( baseDir, @@ -110,7 +110,7 @@ Future generateTestPigeons({ 'shared_test_plugin_code', ); - for (final String input in inputs) { + for (final input in inputs) { final String pascalCaseName = _snakeToPascalCase(input); final Set skipLanguages = _unsupportedFiles[input] ?? {}; @@ -118,7 +118,7 @@ Future generateTestPigeons({ final bool kotlinErrorClassGenerationTestFiles = input == 'core_tests' || input == 'primitive'; - final String kotlinErrorName = kotlinErrorClassGenerationTestFiles + final kotlinErrorName = kotlinErrorClassGenerationTestFiles ? 'FlutterError' : '${pascalCaseName}Error'; @@ -174,9 +174,9 @@ Future generateTestPigeons({ } // Generate the alternate language test plugin output. - final String objcBase = + final objcBase = '$alternateOutputBase/darwin/$alternateTestPluginName/Sources/$alternateTestPluginName/'; - final String objcBaseRelativeHeaderPath = + final objcBaseRelativeHeaderPath = 'include/$alternateTestPluginName/$pascalCaseName.gen.h'; generateCode = await runPigeon( input: './pigeons/$input.dart', @@ -259,7 +259,7 @@ Future runPigeon({ // parse results in advance when overflow is included to avoid exposing as public option final ParseResults parseResults = Pigeon().parseFile(input); if (injectOverflowTypes) { - final List addedEnums = List.generate( + final addedEnums = List.generate( totalCustomCodecKeysAllowed - 1, (final int tag) { return Enum( @@ -334,7 +334,7 @@ Future formatAllFiles({ GeneratorLanguage.swift, }, }) { - final String dartCommand = Platform.isWindows ? 'dart.exe' : 'dart'; + final dartCommand = Platform.isWindows ? 'dart.exe' : 'dart'; return runProcess( dartCommand, [ diff --git a/packages/pigeon/tool/shared/process_utils.dart b/packages/pigeon/tool/shared/process_utils.dart index 2055ecd4fec..e795f00b5d0 100644 --- a/packages/pigeon/tool/shared/process_utils.dart +++ b/packages/pigeon/tool/shared/process_utils.dart @@ -25,8 +25,8 @@ Future runProcess( return process.exitCode; } - final List stdoutBuffer = []; - final List stderrBuffer = []; + final stdoutBuffer = []; + final stderrBuffer = []; final Future stdoutFuture = process.stdout.forEach(stdoutBuffer.addAll); final Future stderrFuture = process.stderr.forEach(stderrBuffer.addAll); final int exitCode = await process.exitCode; diff --git a/packages/pigeon/tool/shared/test_runner.dart b/packages/pigeon/tool/shared/test_runner.dart index 055f0b700a6..810e4746cb1 100644 --- a/packages/pigeon/tool/shared/test_runner.dart +++ b/packages/pigeon/tool/shared/test_runner.dart @@ -88,7 +88,7 @@ Future _runFormat(String baseDir, {required bool ciMode}) async { } Future _runTests(List testsToRun, {required bool ciMode}) async { - for (final String test in testsToRun) { + for (final test in testsToRun) { final TestInfo? info = testSuites[test]; if (info != null) { _printHeading('Running $test', ciMode: ciMode); @@ -107,9 +107,9 @@ Future _runTests(List testsToRun, {required bool ciMode}) async { } void _printHeading(String heading, {required bool ciMode}) { - String timestamp = ''; + var timestamp = ''; if (ciMode) { - final DateTime now = DateTime.now(); + final now = DateTime.now(); timestamp = ' [start time ${now.hour}:${now.minute}:${now.second}]'; } print('##############################'); diff --git a/packages/pigeon/tool/shared/test_suites.dart b/packages/pigeon/tool/shared/test_suites.dart index c00db854741..f08d0b55ccb 100644 --- a/packages/pigeon/tool/shared/test_suites.dart +++ b/packages/pigeon/tool/shared/test_suites.dart @@ -171,9 +171,9 @@ Future _runAndroidKotlinLint({bool ciMode = false}) async { } Future _runAndroidUnitTests(String testPluginPath) async { - final String examplePath = './$testPluginPath/example'; - final String androidProjectPath = '$examplePath/android'; - final File gradleFile = File(p.join(androidProjectPath, 'gradlew')); + final examplePath = './$testPluginPath/example'; + final androidProjectPath = '$examplePath/android'; + final gradleFile = File(p.join(androidProjectPath, 'gradlew')); if (!gradleFile.existsSync()) { final int compileCode = await runFlutterBuild(examplePath, 'apk'); if (compileCode != 0) { @@ -188,9 +188,9 @@ Future _runAndroidLint({ required String testPluginName, required String testPluginPath, }) async { - final String examplePath = './$testPluginPath/example'; - final String androidProjectPath = '$examplePath/android'; - final File gradleFile = File(p.join(androidProjectPath, 'gradlew')); + final examplePath = './$testPluginPath/example'; + final androidProjectPath = '$examplePath/android'; + final gradleFile = File(p.join(androidProjectPath, 'gradlew')); if (!gradleFile.existsSync()) { final int compileCode = await runFlutterBuild( examplePath, @@ -222,7 +222,7 @@ Future _runMobileIntegrationTests( return _noDeviceAvailableExitCode; } - final String examplePath = './$testPluginPath/example'; + final examplePath = './$testPluginPath/example'; return runFlutterCommand(examplePath, 'test', [ _integrationTestFileRelativePath, '-d', @@ -244,8 +244,8 @@ Future _runDartUnitTests({bool ciMode = false}) async { } Future _analyzeFlutterUnitTests(String flutterUnitTestsPath) async { - final String messagePath = '$flutterUnitTestsPath/lib/message.gen.dart'; - final String messageTestPath = '$flutterUnitTestsPath/test/message_test.dart'; + final messagePath = '$flutterUnitTestsPath/lib/message.gen.dart'; + final messageTestPath = '$flutterUnitTestsPath/test/message_test.dart'; final int generateTestCode = await runPigeon( input: 'pigeons/message.dart', dartOut: messagePath, @@ -271,7 +271,7 @@ Future _analyzeFlutterUnitTests(String flutterUnitTestsPath) async { } Future _runFlutterUnitTests({bool ciMode = false}) async { - const String flutterUnitTestsPath = 'platform_tests/shared_test_plugin_code'; + const flutterUnitTestsPath = 'platform_tests/shared_test_plugin_code'; final int analyzeCode = await _analyzeFlutterUnitTests(flutterUnitTestsPath); if (analyzeCode != 0) { return analyzeCode; @@ -303,7 +303,7 @@ Future _runIOSObjCIntegrationTests({bool ciMode = false}) async { return _noDeviceAvailableExitCode; } - const String examplePath = + const examplePath = './$_alternateLanguageTestPluginRelativePath/example'; return runFlutterCommand(examplePath, 'test', [ _integrationTestFileRelativePath, @@ -313,7 +313,7 @@ Future _runIOSObjCIntegrationTests({bool ciMode = false}) async { } Future _runMacOSObjCIntegrationTests({bool ciMode = false}) async { - const String examplePath = + const examplePath = './$_alternateLanguageTestPluginRelativePath/example'; return runFlutterCommand(examplePath, 'test', [ _integrationTestFileRelativePath, @@ -323,7 +323,7 @@ Future _runMacOSObjCIntegrationTests({bool ciMode = false}) async { } Future _runMacOSSwiftUnitTests({bool ciMode = false}) async { - const String examplePath = './$_testPluginRelativePath/example'; + const examplePath = './$_testPluginRelativePath/example'; final int compileCode = await runFlutterBuild(examplePath, 'macos'); if (compileCode != 0) { return compileCode; @@ -336,7 +336,7 @@ Future _runMacOSSwiftUnitTests({bool ciMode = false}) async { } Future _runMacOSSwiftIntegrationTests({bool ciMode = false}) async { - const String examplePath = './$_testPluginRelativePath/example'; + const examplePath = './$_testPluginRelativePath/example'; return runFlutterCommand(examplePath, 'test', [ _integrationTestFileRelativePath, '-d', @@ -349,7 +349,7 @@ Future _runIOSSwiftUnitTests({bool ciMode = false}) async { } Future _runIOSPluginUnitTests(String testPluginPath) async { - final String examplePath = './$testPluginPath/example'; + final examplePath = './$testPluginPath/example'; final int compileCode = await runFlutterBuild( examplePath, 'ios', @@ -359,10 +359,10 @@ Future _runIOSPluginUnitTests(String testPluginPath) async { return compileCode; } - const String deviceName = 'Pigeon-Test-iPhone'; - const String deviceType = 'com.apple.CoreSimulator.SimDeviceType.iPhone-14'; - const String deviceRuntime = 'com.apple.CoreSimulator.SimRuntime.iOS-18-2'; - const String deviceOS = '18.2'; + const deviceName = 'Pigeon-Test-iPhone'; + const deviceType = 'com.apple.CoreSimulator.SimDeviceType.iPhone-14'; + const deviceRuntime = 'com.apple.CoreSimulator.SimRuntime.iOS-18-2'; + const deviceOS = '18.2'; await _createSimulator(deviceName, deviceType, deviceRuntime); return runXcodeBuild( '$examplePath/ios', @@ -380,7 +380,7 @@ Future _createSimulator( // Delete any existing simulators with the same name until it fails. It will // fail once there are no simulators with the name. Having more than one may // cause issues when builds target the device. - int deleteResult = 0; + var deleteResult = 0; while (deleteResult == 0) { deleteResult = await _deleteSimulator(deviceName); } @@ -405,18 +405,18 @@ Future _runIOSSwiftIntegrationTests({bool ciMode = false}) async { } Future _runLinuxUnitTests({bool ciMode = false}) async { - const String examplePath = './$_testPluginRelativePath/example'; + const examplePath = './$_testPluginRelativePath/example'; final int compileCode = await runFlutterBuild(examplePath, 'linux'); if (compileCode != 0) { return compileCode; } - const String buildDirBase = '$examplePath/build/linux'; - const String buildRelativeBinaryPath = + const buildDirBase = '$examplePath/build/linux'; + const buildRelativeBinaryPath = 'debug/plugins/test_plugin/test_plugin_test'; - const String arm64Path = '$buildDirBase/arm64/$buildRelativeBinaryPath'; - const String x64Path = '$buildDirBase/x64/$buildRelativeBinaryPath'; - final String testBinary = File(arm64Path).existsSync() ? arm64Path : x64Path; + const arm64Path = '$buildDirBase/arm64/$buildRelativeBinaryPath'; + const x64Path = '$buildDirBase/x64/$buildRelativeBinaryPath'; + final testBinary = File(arm64Path).existsSync() ? arm64Path : x64Path; if (ciMode) { // To avoid having all custom tests in the repo run under xvfb, xvfb-run is // done here rather than at the CI config level. Ideally, Pigeon tests @@ -429,7 +429,7 @@ Future _runLinuxUnitTests({bool ciMode = false}) async { } Future _runLinuxIntegrationTests({bool ciMode = false}) async { - const String examplePath = './$_testPluginRelativePath/example'; + const examplePath = './$_testPluginRelativePath/example'; return runFlutterCommand( examplePath, 'test', @@ -443,7 +443,7 @@ Future _runLinuxIntegrationTests({bool ciMode = false}) async { } Future _runWindowsUnitTests({bool ciMode = false}) async { - const String examplePath = './$_testPluginRelativePath/example'; + const examplePath = './$_testPluginRelativePath/example'; final int compileCode = await runFlutterBuild(examplePath, 'windows'); if (compileCode != 0) { return compileCode; @@ -458,11 +458,11 @@ Future _runWindowsUnitTests({bool ciMode = false}) async { // support a version of Flutter without // https://github.com/flutter/flutter/issues/129807, and just construct the // version of the path with the current architecture. - const String buildDirBase = '$examplePath/build/windows'; - const String buildRelativeBinaryPath = + const buildDirBase = '$examplePath/build/windows'; + const buildRelativeBinaryPath = 'plugins/test_plugin/Debug/test_plugin_test.exe'; - const String arm64Path = '$buildDirBase/arm64/$buildRelativeBinaryPath'; - const String x64Path = '$buildDirBase/x64/$buildRelativeBinaryPath'; + const arm64Path = '$buildDirBase/arm64/$buildRelativeBinaryPath'; + const x64Path = '$buildDirBase/x64/$buildRelativeBinaryPath'; if (File(arm64Path).existsSync()) { return runProcess(arm64Path, []); } else { @@ -471,7 +471,7 @@ Future _runWindowsUnitTests({bool ciMode = false}) async { } Future _runWindowsIntegrationTests({bool ciMode = false}) async { - const String examplePath = './$_testPluginRelativePath/example'; + const examplePath = './$_testPluginRelativePath/example'; return runFlutterCommand(examplePath, 'test', [ _integrationTestFileRelativePath, '-d', @@ -482,7 +482,7 @@ Future _runWindowsIntegrationTests({bool ciMode = false}) async { Future _runCommandLineTests({bool ciMode = false}) async { final Directory tempDir = Directory.systemTemp.createTempSync('pigeon'); final String tempOutput = p.join(tempDir.path, 'pigeon_output'); - const String pigeonScript = 'bin/pigeon.dart'; + const pigeonScript = 'bin/pigeon.dart'; final String snapshot = p.join(tempDir.path, 'pigeon.dart.dill'); // Precompile to make the repeated calls faster. @@ -496,7 +496,7 @@ Future _runCommandLineTests({bool ciMode = false}) async { return 1; } - final List> testArguments = >[ + final testArguments = >[ // Test with no arguments. [], // Test dartOut in ConfigurePigeon overrides output. @@ -513,8 +513,8 @@ Future _runCommandLineTests({bool ciMode = false}) async { ], ]; - int exitCode = 0; - for (final List arguments in testArguments) { + var exitCode = 0; + for (final arguments in testArguments) { print('Testing dart $pigeonScript ${arguments.join(', ')}'); exitCode = await runProcess( 'dart', diff --git a/packages/pigeon/tool/test.dart b/packages/pigeon/tool/test.dart index 5754778c191..97ca9fa3238 100644 --- a/packages/pigeon/tool/test.dart +++ b/packages/pigeon/tool/test.dart @@ -26,7 +26,7 @@ const String _format = 'format'; const String _overflow = 'overflow'; Future main(List args) async { - final ArgParser parser = ArgParser() + final parser = ArgParser() ..addMultiOption(_testFlag, abbr: 't', help: 'Only run specified tests.') ..addFlag( _noGen, @@ -59,7 +59,7 @@ Future main(List args) async { ); final ArgResults argResults = parser.parse(args); - List testsToRun = []; + var testsToRun = []; if (argResults.wasParsed(_listFlag)) { print('available tests:'); @@ -84,12 +84,12 @@ ${parser.usage}'''); // If no tests are provided, run everything that is supported on the current // platform. if (testsToRun.isEmpty) { - const List dartTests = [ + const dartTests = [ dartUnitTests, flutterUnitTests, commandLineTests, ]; - const List androidTests = [ + const androidTests = [ androidJavaUnitTests, androidKotlinUnitTests, androidJavaIntegrationTests, @@ -97,22 +97,22 @@ ${parser.usage}'''); androidJavaLint, androidKotlinLint, ]; - const List iOSTests = [ + const iOSTests = [ iOSObjCUnitTests, iOSObjCIntegrationTests, iOSSwiftUnitTests, iOSSwiftIntegrationTests, ]; - const List linuxTests = [ + const linuxTests = [ linuxUnitTests, linuxIntegrationTests, ]; - const List macOSTests = [ + const macOSTests = [ macOSObjCIntegrationTests, macOSSwiftUnitTests, macOSSwiftIntegrationTests, ]; - const List windowsTests = [ + const windowsTests = [ windowsUnitTests, windowsIntegrationTests, ]; diff --git a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart index d7c0f6b0915..2a40957e252 100644 --- a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart +++ b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart @@ -86,7 +86,7 @@ abstract class PlatformInterface { required bool preventConstObject, }) { if (instance is MockPlatformInterfaceMixin) { - bool assertionsEnabled = false; + var assertionsEnabled = false; assert(() { assertionsEnabled = true; return true; diff --git a/packages/pointer_interceptor/pointer_interceptor/example/lib/platforms/native_widget_ios.dart b/packages/pointer_interceptor/pointer_interceptor/example/lib/platforms/native_widget_ios.dart index dabf9178b5d..37f4ca4e89e 100644 --- a/packages/pointer_interceptor/pointer_interceptor/example/lib/platforms/native_widget_ios.dart +++ b/packages/pointer_interceptor/pointer_interceptor/example/lib/platforms/native_widget_ios.dart @@ -16,8 +16,8 @@ class NativeWidget extends StatelessWidget { @override Widget build(BuildContext context) { - const String viewType = 'dummy_platform_view'; - final Map creationParams = {}; + const viewType = 'dummy_platform_view'; + final creationParams = {}; return UiKitView( viewType: viewType, diff --git a/packages/pointer_interceptor/pointer_interceptor_ios/example/lib/main.dart b/packages/pointer_interceptor/pointer_interceptor_ios/example/lib/main.dart index ce131717bc6..f41d224e783 100644 --- a/packages/pointer_interceptor/pointer_interceptor_ios/example/lib/main.dart +++ b/packages/pointer_interceptor/pointer_interceptor_ios/example/lib/main.dart @@ -15,8 +15,8 @@ class _DummyPlatformView extends StatelessWidget { @override Widget build(BuildContext context) { - const String viewType = 'dummy_platform_view'; - final Map creationParams = {}; + const viewType = 'dummy_platform_view'; + final creationParams = {}; return UiKitView( viewType: viewType, diff --git a/packages/pointer_interceptor/pointer_interceptor_platform_interface/test/default_pointer_interceptor_test.dart b/packages/pointer_interceptor/pointer_interceptor_platform_interface/test/default_pointer_interceptor_test.dart index a310e985fd0..8355102ff36 100644 --- a/packages/pointer_interceptor/pointer_interceptor_platform_interface/test/default_pointer_interceptor_test.dart +++ b/packages/pointer_interceptor/pointer_interceptor_platform_interface/test/default_pointer_interceptor_test.dart @@ -13,7 +13,7 @@ void main() { final PointerInterceptorPlatform defaultPointerInterceptor = PointerInterceptorPlatform.instance; - final Container testChild = Container(); + final testChild = Container(); expect(defaultPointerInterceptor.buildWidget(child: testChild), testChild); }); } diff --git a/packages/pointer_interceptor/pointer_interceptor_platform_interface/test/pointer_interceptor_platform_test.dart b/packages/pointer_interceptor/pointer_interceptor_platform_interface/test/pointer_interceptor_platform_test.dart index 3a666e1e759..4caa0bd235e 100644 --- a/packages/pointer_interceptor/pointer_interceptor_platform_interface/test/pointer_interceptor_platform_test.dart +++ b/packages/pointer_interceptor/pointer_interceptor_platform_interface/test/pointer_interceptor_platform_test.dart @@ -15,7 +15,7 @@ void main() { final PointerInterceptorPlatform unimplementedPointerInterceptorPlatform = UnimplementedPointerInterceptorPlatform(); - final Container testChild = Container(); + final testChild = Container(); expect( () => unimplementedPointerInterceptorPlatform.buildWidget( child: testChild, diff --git a/packages/pointer_interceptor/pointer_interceptor_web/example/integration_test/widget_test.dart b/packages/pointer_interceptor/pointer_interceptor_web/example/integration_test/widget_test.dart index 77cff645976..c2b5be5877a 100644 --- a/packages/pointer_interceptor/pointer_interceptor_web/example/integration_test/widget_test.dart +++ b/packages/pointer_interceptor/pointer_interceptor_web/example/integration_test/widget_test.dart @@ -91,8 +91,8 @@ void main() { ); expect(element.tagName.toLowerCase(), 'div'); - for (int i = 0; i <= 4; i++) { - final web.MouseEvent event = web.MouseEvent( + for (var i = 0; i <= 4; i++) { + final event = web.MouseEvent( 'mousedown', web.MouseEventInit(button: i, cancelable: true), ); diff --git a/packages/quick_actions/quick_actions/example/integration_test/quick_actions_test.dart b/packages/quick_actions/quick_actions/example/integration_test/quick_actions_test.dart index 889c573a9c9..cd54f2cf8fd 100644 --- a/packages/quick_actions/quick_actions/example/integration_test/quick_actions_test.dart +++ b/packages/quick_actions/quick_actions/example/integration_test/quick_actions_test.dart @@ -10,10 +10,10 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); testWidgets('Can set shortcuts', (WidgetTester tester) async { - const QuickActions quickActions = QuickActions(); + const quickActions = QuickActions(); await quickActions.initialize((String _) {}); - const ShortcutItem shortCutItem = ShortcutItem( + const shortCutItem = ShortcutItem( type: 'action_one', localizedTitle: 'Action one', icon: 'AppIcon', diff --git a/packages/quick_actions/quick_actions/example/lib/main.dart b/packages/quick_actions/quick_actions/example/lib/main.dart index 8a450d7e2b8..0c08713fb5f 100644 --- a/packages/quick_actions/quick_actions/example/lib/main.dart +++ b/packages/quick_actions/quick_actions/example/lib/main.dart @@ -38,7 +38,7 @@ class _MyHomePageState extends State { void initState() { super.initState(); - const QuickActions quickActions = QuickActions(); + const quickActions = QuickActions(); quickActions.initialize((String shortcutType) { setState(() { shortcut = shortcutType; diff --git a/packages/quick_actions/quick_actions/test/quick_actions_test.dart b/packages/quick_actions/quick_actions/test/quick_actions_test.dart index f07248c2cb4..7ce442feece 100644 --- a/packages/quick_actions/quick_actions/test/quick_actions_test.dart +++ b/packages/quick_actions/quick_actions/test/quick_actions_test.dart @@ -15,12 +15,12 @@ void main() { }); test('constructor() should return valid QuickActions instance', () { - const QuickActions quickActions = QuickActions(); + const quickActions = QuickActions(); expect(quickActions, isNotNull); }); test('initialize() PlatformInterface', () async { - const QuickActions quickActions = QuickActions(); + const quickActions = QuickActions(); void handler(String type) {} await quickActions.initialize(handler); @@ -28,7 +28,7 @@ void main() { }); test('setShortcutItems() PlatformInterface', () { - const QuickActions quickActions = QuickActions(); + const quickActions = QuickActions(); void handler(String type) {} quickActions.initialize(handler); quickActions.setShortcutItems([]); @@ -40,7 +40,7 @@ void main() { }); test('clearShortcutItems() PlatformInterface', () { - const QuickActions quickActions = QuickActions(); + const quickActions = QuickActions(); void handler(String type) {} quickActions.initialize(handler); 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 f6f2dacaec9..4f3fe3e3eae 100644 --- a/packages/quick_actions/quick_actions_android/example/lib/main.dart +++ b/packages/quick_actions/quick_actions_android/example/lib/main.dart @@ -38,7 +38,7 @@ class _MyHomePageState extends State { void initState() { super.initState(); - final QuickActionsAndroid quickActions = QuickActionsAndroid(); + final quickActions = QuickActionsAndroid(); quickActions.initialize((String shortcutType) { setState(() { shortcut = '$shortcutType has launched'; diff --git a/packages/quick_actions/quick_actions_android/lib/quick_actions_android.dart b/packages/quick_actions/quick_actions_android/lib/quick_actions_android.dart index 5a69f8badd5..31e5e8ed6c8 100644 --- a/packages/quick_actions/quick_actions_android/lib/quick_actions_android.dart +++ b/packages/quick_actions/quick_actions_android/lib/quick_actions_android.dart @@ -26,7 +26,7 @@ class QuickActionsAndroid extends QuickActionsPlatform { @override Future initialize(QuickActionHandler handler) async { - final _QuickActionHandlerApi quickActionsHandlerApi = + final quickActionsHandlerApi = _QuickActionHandlerApi(); AndroidQuickActionsFlutterApi.setUp(quickActionsHandlerApi); _handler = handler; diff --git a/packages/quick_actions/quick_actions_android/test/quick_actions_android_test.dart b/packages/quick_actions/quick_actions_android/test/quick_actions_android_test.dart index f15060ffcdf..dc7acffcca6 100644 --- a/packages/quick_actions/quick_actions_android/test/quick_actions_android_test.dart +++ b/packages/quick_actions/quick_actions_android/test/quick_actions_android_test.dart @@ -24,8 +24,8 @@ ShortcutItem shortcutItemMessageToShortcutItem(ShortcutItemMessage item) { void main() { TestWidgetsFlutterBinding.ensureInitialized(); - final _FakeQuickActionsApi api = _FakeQuickActionsApi(); - final QuickActionsAndroid quickActions = QuickActionsAndroid(api: api); + final api = _FakeQuickActionsApi(); + final quickActions = QuickActionsAndroid(api: api); test('registerWith() registers correct instance', () { QuickActionsAndroid.registerWith(); @@ -40,7 +40,7 @@ void main() { }); test('initialize', () async { - final Completer quickActionsHandler = Completer(); + final quickActionsHandler = Completer(); await quickActions.initialize((_) => quickActionsHandler.complete(true)); expect(quickActionsHandler.future, completion(isTrue)); @@ -49,7 +49,7 @@ void main() { test('setShortCutItems', () async { await quickActions.initialize((String type) {}); - const ShortcutItem item = ShortcutItem( + const item = ShortcutItem( type: 'test', localizedTitle: 'title', icon: 'icon.svg', @@ -63,7 +63,7 @@ void main() { test('clearShortCutItems', () { quickActions.initialize((String type) {}); - const ShortcutItem item = ShortcutItem( + const item = ShortcutItem( type: 'test', localizedTitle: 'title', icon: 'icon.svg', @@ -75,11 +75,11 @@ void main() { }); test('Shortcut item can be constructed', () { - const String type = 'type'; - const String localizedTitle = 'title'; - const String icon = 'foo'; + const type = 'type'; + const localizedTitle = 'title'; + const icon = 'foo'; - const ShortcutItem item = ShortcutItem( + const item = ShortcutItem( type: type, localizedTitle: localizedTitle, icon: icon, @@ -110,7 +110,7 @@ class _FakeQuickActionsApi implements AndroidQuickActionsApi { @override Future setShortcutItems(List itemsList) async { await clearShortcutItems(); - for (final ShortcutItemMessage? element in itemsList) { + for (final element in itemsList) { items.add(shortcutItemMessageToShortcutItem(element!)); } } diff --git a/packages/quick_actions/quick_actions_ios/example/integration_test/quick_actions_test.dart b/packages/quick_actions/quick_actions_ios/example/integration_test/quick_actions_test.dart index 56f22935469..328da2f4b82 100644 --- a/packages/quick_actions/quick_actions_ios/example/integration_test/quick_actions_test.dart +++ b/packages/quick_actions/quick_actions_ios/example/integration_test/quick_actions_test.dart @@ -10,10 +10,10 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); testWidgets('Can set shortcuts', (WidgetTester tester) async { - final QuickActionsIos quickActions = QuickActionsIos(); + final quickActions = QuickActionsIos(); await quickActions.initialize((String value) {}); - const ShortcutItem shortCutItem = ShortcutItem( + const shortCutItem = ShortcutItem( type: 'action_one', localizedTitle: 'Action one', icon: 'AppIcon', 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 9f323bcf6fc..768638538ce 100644 --- a/packages/quick_actions/quick_actions_ios/example/lib/main.dart +++ b/packages/quick_actions/quick_actions_ios/example/lib/main.dart @@ -38,7 +38,7 @@ class _MyHomePageState extends State { void initState() { super.initState(); - final QuickActionsIos quickActions = QuickActionsIos(); + final quickActions = QuickActionsIos(); quickActions.initialize((String shortcutType) { setState(() { shortcut = shortcutType; diff --git a/packages/quick_actions/quick_actions_ios/lib/quick_actions_ios.dart b/packages/quick_actions/quick_actions_ios/lib/quick_actions_ios.dart index 85db5fe7757..c41039dc398 100644 --- a/packages/quick_actions/quick_actions_ios/lib/quick_actions_ios.dart +++ b/packages/quick_actions/quick_actions_ios/lib/quick_actions_ios.dart @@ -26,7 +26,7 @@ class QuickActionsIos extends QuickActionsPlatform { @override Future initialize(QuickActionHandler handler) async { - final _QuickActionHandlerApi quickActionsHandlerApi = + final quickActionsHandlerApi = _QuickActionHandlerApi(); IOSQuickActionsFlutterApi.setUp(quickActionsHandlerApi); _handler = handler; diff --git a/packages/quick_actions/quick_actions_ios/test/quick_actions_ios_test.dart b/packages/quick_actions/quick_actions_ios/test/quick_actions_ios_test.dart index e8870782149..ab2240576fa 100644 --- a/packages/quick_actions/quick_actions_ios/test/quick_actions_ios_test.dart +++ b/packages/quick_actions/quick_actions_ios/test/quick_actions_ios_test.dart @@ -11,8 +11,8 @@ import 'package:quick_actions_platform_interface/quick_actions_platform_interfac void main() { TestWidgetsFlutterBinding.ensureInitialized(); - final _FakeQuickActionsApi api = _FakeQuickActionsApi(); - final QuickActionsIos quickActions = QuickActionsIos(api: api); + final api = _FakeQuickActionsApi(); + final quickActions = QuickActionsIos(api: api); test('registerWith() registers correct instance', () { QuickActionsIos.registerWith(); @@ -27,7 +27,7 @@ void main() { test('setShortcutItems', () async { await quickActions.initialize((String type) {}); - const ShortcutItem item = ShortcutItem( + const item = ShortcutItem( type: 'test', localizedTitle: 'title', localizedSubtitle: 'subtitle', @@ -43,7 +43,7 @@ void main() { test('clearShortCutItems', () { quickActions.initialize((String type) {}); - const ShortcutItem item = ShortcutItem( + const item = ShortcutItem( type: 'test', localizedTitle: 'title', localizedSubtitle: 'subtitle', @@ -56,12 +56,12 @@ void main() { }); test('Shortcut item can be constructed', () { - const String type = 'type'; - const String localizedTitle = 'title'; - const String localizedSubtitle = 'subtitle'; - const String icon = 'foo'; + const type = 'type'; + const localizedTitle = 'title'; + const localizedSubtitle = 'subtitle'; + const icon = 'foo'; - const ShortcutItem item = ShortcutItem( + const item = ShortcutItem( type: type, localizedTitle: localizedTitle, localizedSubtitle: localizedSubtitle, @@ -88,7 +88,7 @@ class _FakeQuickActionsApi implements IOSQuickActionsApi { @override Future setShortcutItems(List itemsList) async { await clearShortcutItems(); - for (final ShortcutItemMessage? element in itemsList) { + for (final element in itemsList) { items.add(shortcutItemMessageToShortcutItem(element!)); } } diff --git a/packages/quick_actions/quick_actions_platform_interface/test/method_channel_quick_actions_test.dart b/packages/quick_actions/quick_actions_platform_interface/test/method_channel_quick_actions_test.dart index 384627a5566..d9f5b7cfe14 100644 --- a/packages/quick_actions/quick_actions_platform_interface/test/method_channel_quick_actions_test.dart +++ b/packages/quick_actions/quick_actions_platform_interface/test/method_channel_quick_actions_test.dart @@ -13,9 +13,9 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); group('$MethodChannelQuickActions', () { - final MethodChannelQuickActions quickActions = MethodChannelQuickActions(); + final quickActions = MethodChannelQuickActions(); - final List log = []; + final log = []; setUp(() { TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger @@ -39,7 +39,7 @@ void main() { }); test('initialize', () async { - final Completer quickActionsHandler = Completer(); + final quickActionsHandler = Completer(); await quickActions.initialize( (_) => quickActionsHandler.complete(true), ); @@ -109,10 +109,10 @@ void main() { ); test('setShortcutItems with demo data', () async { - const String type = 'type'; - const String localizedTitle = 'localizedTitle'; - const String localizedSubtitle = 'localizedSubtitle'; - const String icon = 'icon'; + const type = 'type'; + const localizedTitle = 'localizedTitle'; + const localizedSubtitle = 'localizedSubtitle'; + const icon = 'icon'; await quickActions.setShortcutItems(const [ ShortcutItem( type: type, @@ -161,12 +161,12 @@ void main() { group('$ShortcutItem', () { test('Shortcut item can be constructed', () { - const String type = 'type'; - const String localizedTitle = 'title'; - const String localizedSubtitle = 'subtitle'; - const String icon = 'foo'; + const type = 'type'; + const localizedTitle = 'title'; + const localizedSubtitle = 'subtitle'; + const icon = 'foo'; - const ShortcutItem item = ShortcutItem( + const item = ShortcutItem( type: type, localizedTitle: localizedTitle, localizedSubtitle: localizedSubtitle, diff --git a/packages/quick_actions/quick_actions_platform_interface/test/quick_actions_platform_interface_test.dart b/packages/quick_actions/quick_actions_platform_interface/test/quick_actions_platform_interface_test.dart index 69e0cd8d593..89a6d02cd25 100644 --- a/packages/quick_actions/quick_actions_platform_interface/test/quick_actions_platform_interface_test.dart +++ b/packages/quick_actions/quick_actions_platform_interface/test/quick_actions_platform_interface_test.dart @@ -39,7 +39,7 @@ void main() { 'Default implementation of initialize() should throw unimplemented error', () { // Arrange - final ExtendsQuickActionsPlatform quickActionsPlatform = + final quickActionsPlatform = ExtendsQuickActionsPlatform(); // Act & Assert @@ -54,7 +54,7 @@ void main() { 'Default implementation of setShortcutItems() should throw unimplemented error', () { // Arrange - final ExtendsQuickActionsPlatform quickActionsPlatform = + final quickActionsPlatform = ExtendsQuickActionsPlatform(); // Act & Assert @@ -69,7 +69,7 @@ void main() { 'Default implementation of clearShortcutItems() should throw unimplemented error', () { // Arrange - final ExtendsQuickActionsPlatform quickActionsPlatform = + final quickActionsPlatform = ExtendsQuickActionsPlatform(); // Act & Assert diff --git a/packages/rfw/example/remote/lib/main.dart b/packages/rfw/example/remote/lib/main.dart index 82885cd3fa3..368f6da11c5 100644 --- a/packages/rfw/example/remote/lib/main.dart +++ b/packages/rfw/example/remote/lib/main.dart @@ -46,15 +46,15 @@ class _ExampleState extends State { Future _updateWidgets() async { final Directory home = await getApplicationSupportDirectory(); - final File settingsFile = File(path.join(home.path, 'settings.txt')); - String nextFile = 'counter_app1.rfw'; + final settingsFile = File(path.join(home.path, 'settings.txt')); + var nextFile = 'counter_app1.rfw'; if (settingsFile.existsSync()) { final String settings = await settingsFile.readAsString(); if (settings == nextFile) { nextFile = 'counter_app2.rfw'; } } - final File currentFile = File(path.join(home.path, 'current.rfw')); + final currentFile = File(path.join(home.path, 'current.rfw')); if (currentFile.existsSync()) { try { _runtime.update(const LibraryName(['main']), decodeLibraryBlob(await currentFile.readAsBytes())); diff --git a/packages/rfw/lib/src/dart/binary.dart b/packages/rfw/lib/src/dart/binary.dart index 1d516b4d41b..a49190407f6 100644 --- a/packages/rfw/lib/src/dart/binary.dart +++ b/packages/rfw/lib/src/dart/binary.dart @@ -39,7 +39,7 @@ const List libraryBlobSignature = [0xFE, 0x52, 0x46, 0x57]; /// * [encodeLibraryBlob], which uses a superset of this format to encode /// Remote Flutter Widgets binary library blobs. Uint8List encodeDataBlob(Object value) { - final _BlobEncoder encoder = _BlobEncoder(); + final encoder = _BlobEncoder(); encoder.writeSignature(dataBlobSignature); encoder.writeValue(value); return encoder.bytes.toBytes(); @@ -65,7 +65,7 @@ Uint8List encodeDataBlob(Object value) { /// Remote Flutter Widgets binary library blobs. /// * [parseDataFile], which parses the text variant of this format. Object decodeDataBlob(Uint8List bytes) { - final _BlobDecoder decoder = _BlobDecoder(bytes.buffer.asByteData(bytes.offsetInBytes, bytes.lengthInBytes)); + final decoder = _BlobDecoder(bytes.buffer.asByteData(bytes.offsetInBytes, bytes.lengthInBytes)); decoder.expectSignature(dataBlobSignature); final Object result = decoder.readValue(); if (!decoder.finished) { @@ -83,7 +83,7 @@ Object decodeDataBlob(Uint8List bytes) { /// Remote Flutter Widgets binary data blobs. /// * [parseLibraryFile], which parses the text variant of this format. Uint8List encodeLibraryBlob(RemoteWidgetLibrary value) { - final _BlobEncoder encoder = _BlobEncoder(); + final encoder = _BlobEncoder(); encoder.writeSignature(libraryBlobSignature); encoder.writeLibrary(value); return encoder.bytes.toBytes(); @@ -276,7 +276,7 @@ Uint8List encodeLibraryBlob(RemoteWidgetLibrary value) { /// Remote Flutter Widgets binary data blobs. /// * [parseDataFile], which parses the text variant of this format. RemoteWidgetLibrary decodeLibraryBlob(Uint8List bytes) { - final _BlobDecoder decoder = _BlobDecoder(bytes.buffer.asByteData(bytes.offsetInBytes, bytes.lengthInBytes)); + final decoder = _BlobDecoder(bytes.buffer.asByteData(bytes.offsetInBytes, bytes.lengthInBytes)); decoder.expectSignature(libraryBlobSignature); final RemoteWidgetLibrary result = decoder.readLibrary(); if (!decoder.finished) { @@ -410,7 +410,7 @@ class _BlobDecoder { Switch _readSwitch() { final Object value = _readArgument(); final int count = _readInt64(); - final Map cases = Map.fromEntries( + final cases = Map.fromEntries( Iterable>.generate( count, (int index) => MapEntry( @@ -530,9 +530,9 @@ class _BlobDecoder { void expectSignature(List signature) { assert(signature.length == 4); - final List bytes = []; - bool match = true; - for (final int byte in signature) { + final bytes = []; + var match = true; + for (final byte in signature) { final int read = _readByte(); bytes.add(read); if (read != byte) { @@ -685,7 +685,7 @@ class _BlobEncoder { }); } else if (value is SetStateHandler) { bytes.addByte(_msSetState); - final StateReference reference = value.stateReference as StateReference; + final reference = value.stateReference as StateReference; _writeInt64(reference.parts.length); reference.parts.forEach(_writePart); _writeArgument(value.value); @@ -697,7 +697,7 @@ class _BlobEncoder { void _writeDeclarationList(List value) { _writeInt64(value.length); - for (final WidgetDeclaration declaration in value) { + for (final declaration in value) { _writeString(declaration.name); if (declaration.initialState != null) { _writeMap(declaration.initialState!, _writeArgument); @@ -710,7 +710,7 @@ class _BlobEncoder { void _writeImportList(List value) { _writeInt64(value.length); - for (final Import import in value) { + for (final import in value) { _writeInt64(import.name.parts.length); import.name.parts.forEach(_writeString); } diff --git a/packages/rfw/lib/src/dart/model.dart b/packages/rfw/lib/src/dart/model.dart index 90d5420b20f..2af5adeca27 100644 --- a/packages/rfw/lib/src/dart/model.dart +++ b/packages/rfw/lib/src/dart/model.dart @@ -248,7 +248,7 @@ bool _listEquals(List? a, List? b) { if (a == null || b == null || a.length != b.length) { return false; } - for (int index = 0; index < a.length; index += 1) { + for (var index = 0; index < a.length; index += 1) { if (a[index] != b[index]) { return false; } @@ -290,7 +290,7 @@ class LibraryName implements Comparable { @override int compareTo(LibraryName other) { - for (int index = 0; index < parts.length; index += 1) { + for (var index = 0; index < parts.length; index += 1) { if (other.parts.length <= index) { return 1; } diff --git a/packages/rfw/lib/src/dart/text.dart b/packages/rfw/lib/src/dart/text.dart index 81f2ef8f6d3..b036490fc75 100644 --- a/packages/rfw/lib/src/dart/text.dart +++ b/packages/rfw/lib/src/dart/text.dart @@ -169,7 +169,7 @@ import 'model.dart'; /// Remote Flutter Widgets text library files. /// * [decodeDataBlob], which decodes the binary variant of this format. DynamicMap parseDataFile(String file) { - final _Parser parser = _Parser(_tokenize(file), null); + final parser = _Parser(_tokenize(file), null); return parser.readDataFile(); } @@ -628,7 +628,7 @@ DynamicMap parseDataFile(String file) { /// Remote Flutter Widgets text data files. /// * [decodeLibraryBlob], which decodes the binary variant of this format. RemoteWidgetLibrary parseLibraryFile(String file, { Object? sourceIdentifier }) { - final _Parser parser = _Parser(_tokenize(file), sourceIdentifier); + final parser = _Parser(_tokenize(file), sourceIdentifier); return parser.readLibraryFile(); } @@ -814,12 +814,12 @@ String _describeRune(int current) { Iterable<_Token> _tokenize(String file) sync* { final List characters = file.runes.toList(); - int start = 0; - int index = 0; - int line = 1; - int column = 0; - final List buffer = []; - final List buffer2 = []; + var start = 0; + var index = 0; + var line = 1; + var column = 0; + final buffer = []; + final buffer2 = []; _TokenizerMode mode = _TokenizerMode.main; while (true) { final int current; @@ -2263,7 +2263,7 @@ class _Parser { List widgetBuilderScope = const [], }) { final Object value = _readValue(extended: true, widgetBuilderScope: widgetBuilderScope); - final Map cases = {}; + final cases = {}; _expectSymbol(_SymbolToken.openBrace); while (_source.current is! _SymbolToken) { final Object? key; @@ -2296,7 +2296,7 @@ class _Parser { if (optional && !_foundSymbol(_SymbolToken.dot)) { return const []; } - final List results = []; + final results = []; do { _expectSymbol(_SymbolToken.dot); if (_source.current is _IntegerToken) { @@ -2478,7 +2478,7 @@ class _Parser { Import _readImport() { final SourceLocation? start = _getSourceLocation(); _expectIdentifier('import'); - final List parts = []; + final parts = []; do { parts.add(_readKey()); } while (_maybeReadSymbol(_SymbolToken.dot)); @@ -2499,7 +2499,7 @@ class _Parser { } RemoteWidgetLibrary readLibraryFile() { - final RemoteWidgetLibrary result = RemoteWidgetLibrary( + final result = RemoteWidgetLibrary( _readImports().toList(), _readWidgetDeclarations().toList(), ); diff --git a/packages/rfw/lib/src/flutter/argument_decoders.dart b/packages/rfw/lib/src/flutter/argument_decoders.dart index ae02b59c89b..10977fc2369 100644 --- a/packages/rfw/lib/src/flutter/argument_decoders.dart +++ b/packages/rfw/lib/src/flutter/argument_decoders.dart @@ -623,7 +623,7 @@ class ArgumentDecoders { if (value == null) { return null; } - for (int index = 0; index < values.length; index += 1) { + for (var index = 0; index < values.length; index += 1) { if (value == values[index].toString().split('.').last) { return values[index]; } @@ -1028,7 +1028,7 @@ class ArgumentDecoders { if (!source.isMap(key)) { return null; } - final Paint result = Paint(); + final result = Paint(); final BlendMode? paintBlendMode = enumValue(BlendMode.values, source, [...key, 'blendMode']); if (paintBlendMode != null) { result.blendMode = paintBlendMode; diff --git a/packages/rfw/lib/src/flutter/core_widgets.dart b/packages/rfw/lib/src/flutter/core_widgets.dart index 8100a14c2df..ec770d4161b 100644 --- a/packages/rfw/lib/src/flutter/core_widgets.dart +++ b/packages/rfw/lib/src/flutter/core_widgets.dart @@ -643,9 +643,9 @@ Map get _coreWidgetsDefinitions => (['text']); if (text == null) { - final StringBuffer builder = StringBuffer(); + final builder = StringBuffer(); final int count = source.length(['text']); - for (int index = 0; index < count; index += 1) { + for (var index = 0; index < count; index += 1) { builder.write(source.v(['text', index]) ?? ''); } text = builder.toString(); diff --git a/packages/rfw/lib/src/flutter/material_widgets.dart b/packages/rfw/lib/src/flutter/material_widgets.dart index 3f7afc253f2..7354d4a134d 100644 --- a/packages/rfw/lib/src/flutter/material_widgets.dart +++ b/packages/rfw/lib/src/flutter/material_widgets.dart @@ -270,7 +270,7 @@ Map get _materialWidgetsDefinitions => > dropdownMenuItems = List>.generate( + final dropdownMenuItems = List>.generate( length, (int index) => DropdownMenuItem( onTap: source.voidHandler(['items', index, 'onTap']), @@ -508,10 +508,10 @@ Map get _materialWidgetsDefinitions => (['min']) ?? 0.0; - final value = source.v(['value']) ?? min; - final labelText = source.v(['label']); - final label = labelText != null ? '$labelText: ${value.toStringAsFixed(2)}' : value.toStringAsFixed(2); + final double min = source.v(['min']) ?? 0.0; + final double value = source.v(['value']) ?? min; + final String? labelText = source.v(['label']); + final String label = labelText != null ? '$labelText: ${value.toStringAsFixed(2)}' : value.toStringAsFixed(2); return Slider( value: value, secondaryTrackValue: source.v(['secondaryTrackValue']), diff --git a/packages/rfw/lib/src/flutter/runtime.dart b/packages/rfw/lib/src/flutter/runtime.dart index b3363214e63..9087ef1c43b 100644 --- a/packages/rfw/lib/src/flutter/runtime.dart +++ b/packages/rfw/lib/src/flutter/runtime.dart @@ -364,7 +364,7 @@ class Runtime extends ChangeNotifier { for (final Import import in library.imports) { final LibraryName dependency = import.name; if (visited.contains(dependency)) { - final List path = [dependency]; + final path = [dependency]; for (final LibraryName name in visited.toList().reversed) { if (name == dependency) { break; @@ -462,7 +462,7 @@ class Runtime extends ChangeNotifier { )..propagateSource(source); } usedWidgets = usedWidgets.toSet()..add(widget.fullName); - final WidgetDeclaration constructor = widget.constructor as WidgetDeclaration; + final constructor = widget.constructor as WidgetDeclaration; final int newDepth; if (constructor.initialState != null) { newDepth = stateDepth + 1; @@ -527,7 +527,7 @@ class Runtime extends ChangeNotifier { Set usedWidgets, ) { if (node is ConstructorCall) { - final DynamicMap subArguments = _bindArguments( + final subArguments = _bindArguments( context, node.arguments, arguments, @@ -546,7 +546,7 @@ class Runtime extends ChangeNotifier { } if (node is WidgetBuilderDeclaration) { return (DynamicMap widgetBuilderArg) { - final DynamicMap newWidgetBuilderScope = { + final newWidgetBuilderScope = { ...widgetBuilderScope, node.argumentName: widgetBuilderArg, }; @@ -763,8 +763,8 @@ abstract class _CurriedWidget extends BlobNode { _DataResolverCallback dataResolver, _WidgetBuilderArgResolverCallback widgetBuilderArgResolver, ) { - int currentIndex = 0; // where we are in `list` (some entries of which might represent multiple values, because they are themselves loops) - int effectiveIndex = 0; // where we are in the fully expanded list (the coordinate space in which we're aiming for `targetEffectiveIndex`) + var currentIndex = 0; // where we are in `list` (some entries of which might represent multiple values, because they are themselves loops) + var effectiveIndex = 0; // where we are in the fully expanded list (the coordinate space in which we're aiming for `targetEffectiveIndex`) while ((effectiveIndex <= targetEffectiveIndex || targetEffectiveIndex < 0) && currentIndex < list.length) { final Object node = list[currentIndex]!; if (node is Loop) { @@ -838,8 +838,8 @@ abstract class _CurriedWidget extends BlobNode { _DataResolverCallback dataResolver, _WidgetBuilderArgResolverCallback widgetBuilderArgResolver, ) { - int index = 0; - Object current = root; + var index = 0; + var current = root; while (true) { if (current is DataReference) { if (index < parts.length) { @@ -1207,7 +1207,7 @@ class _WidgetState extends State<_Widget> implements DataSource { void applySetState(List parts, Object value) { assert(parts.isNotEmpty); assert(_stateStore != null); - int index = 0; + var index = 0; Object current = _stateStore!; while (index < parts.length) { final Object subindex = parts[index]; @@ -1379,7 +1379,7 @@ class _WidgetState extends State<_Widget> implements DataSource { final List handlers = value.whereType().toList(); if (handlers.isNotEmpty) { return generator(([DynamicMap? extraArguments]) { - for (final AnyEventHandler entry in handlers) { + for (final entry in handlers) { if (entry is EventHandler) { DynamicMap arguments = entry.eventArguments; if (extraArguments != null) { @@ -1404,7 +1404,7 @@ class _WidgetState extends State<_Widget> implements DataSource { final List<_Subscription> _dependencies = <_Subscription>[]; Object _fetch(List argsKey, { required bool expandLists }) { - final _Key key = _Key(_kArgsSection, argsKey); + final key = _Key(_kArgsSection, argsKey); final Object? value = _argsCache[key]; if (value != null && (value is! DynamicList || !expandLists)) { return value; @@ -1437,7 +1437,7 @@ class _WidgetState extends State<_Widget> implements DataSource { } Object _dataResolver(List rawDataKey) { - final _Key dataKey = _Key(_kDataSection, rawDataKey); + final dataKey = _Key(_kDataSection, rawDataKey); final _Subscription subscription; if (!_subscriptions.containsKey(dataKey)) { subscription = _Subscription(widget.data, this, rawDataKey); @@ -1450,7 +1450,7 @@ class _WidgetState extends State<_Widget> implements DataSource { } Object _widgetBuilderArgResolver(List rawDataKey) { - final _Key widgetBuilderArgKey = _Key(_kWidgetBuilderArgSection, rawDataKey); + final widgetBuilderArgKey = _Key(_kWidgetBuilderArgSection, rawDataKey); final _Subscription subscription = _subscriptions[widgetBuilderArgKey] ??= _Subscription( widget.widgetBuilderScope, this, @@ -1461,7 +1461,7 @@ class _WidgetState extends State<_Widget> implements DataSource { } Object _stateResolver(List rawStateKey, int depth) { - final _Key stateKey = _Key(depth, rawStateKey); + final stateKey = _Key(depth, rawStateKey); final _Subscription subscription; if (!_subscriptions.containsKey(stateKey)) { if (depth >= _states.length) { @@ -1482,7 +1482,7 @@ class _WidgetState extends State<_Widget> implements DataSource { void updateData(Set<_Key> affectedArgs) { setState(() { - for (final _Key key in affectedArgs) { + for (final key in affectedArgs) { _argsCache[key] = null; } }); @@ -1564,7 +1564,7 @@ class _Subscription { } Widget _buildErrorWidget(String message) { - final FlutterErrorDetails detail = FlutterErrorDetails( + final detail = FlutterErrorDetails( exception: message, stack: StackTrace.current, library: 'Remote Flutter Widgets', diff --git a/packages/rfw/test/argument_decoders_test.dart b/packages/rfw/test/argument_decoders_test.dart index e668283e89c..a23aadbec8b 100644 --- a/packages/rfw/test/argument_decoders_test.dart +++ b/packages/rfw/test/argument_decoders_test.dart @@ -19,7 +19,7 @@ void main() { testWidgets('String example', (WidgetTester tester) async { Duration? duration; Curve? curve; - int buildCount = 0; + var buildCount = 0; final Widget builder = Builder( builder: (BuildContext context) { buildCount += 1; @@ -59,8 +59,8 @@ void main() { testWidgets('spot checks', (WidgetTester tester) async { Duration? duration; Curve? curve; - int buildCount = 0; - final Runtime runtime = Runtime() + var buildCount = 0; + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()) ..update(const LibraryName(['builder']), LocalWidgetLibrary({ 'Test': (BuildContext context, DataSource source) { @@ -72,8 +72,8 @@ void main() { })) ..update(const LibraryName(['test']), parseLibraryFile('import core; widget root = SizedBox();')); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -234,12 +234,12 @@ void main() { }); testWidgets('golden checks', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()) ..update(const LibraryName(['test']), parseLibraryFile('import core; widget root = SizedBox();')); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( Directionality( textDirection: TextDirection.rtl, @@ -519,7 +519,7 @@ void main() { skip: !runGoldens, ); - int sawGridDelegateDecoder = 0; + var sawGridDelegateDecoder = 0; ArgumentDecoders.gridDelegateDecoders['custom'] = (DataSource source, List key) { sawGridDelegateDecoder += 1; return null; diff --git a/packages/rfw/test/binary_test.dart b/packages/rfw/test/binary_test.dart index 827ed59c184..857dbaf8811 100644 --- a/packages/rfw/test/binary_test.dart +++ b/packages/rfw/test/binary_test.dart @@ -175,7 +175,7 @@ void main() { }); testWidgets('Library decoder: invalid widget declaration root', (WidgetTester tester) async { - final Uint8List bytes = Uint8List.fromList([ + final bytes = Uint8List.fromList([ 0xfe, 0x52, 0x46, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEF, @@ -227,7 +227,7 @@ void main() { }); testWidgets('Library decoder: invalid args references', (WidgetTester tester) async { - final Uint8List bytes = Uint8List.fromList([ + final bytes = Uint8List.fromList([ 0xfe, 0x52, 0x46, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x01, @@ -505,7 +505,7 @@ void main() { }); testWidgets('Library encoder: widget builders work', (WidgetTester tester) async { - const String source = ''' + const source = ''' widget Foo = Builder( builder: (scope) => Text(text: scope.text), ); @@ -518,7 +518,7 @@ void main() { }); testWidgets('Library encoder: widget builders throws', (WidgetTester tester) async { - const RemoteWidgetLibrary remoteWidgetLibrary = RemoteWidgetLibrary( + const remoteWidgetLibrary = RemoteWidgetLibrary( [], [ WidgetDeclaration( diff --git a/packages/rfw/test/core_widgets_test.dart b/packages/rfw/test/core_widgets_test.dart index 5710747eb2d..1f3e69bec2c 100644 --- a/packages/rfw/test/core_widgets_test.dart +++ b/packages/rfw/test/core_widgets_test.dart @@ -14,11 +14,11 @@ import 'package:rfw/rfw.dart'; void main() { testWidgets('Core widgets', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -248,11 +248,11 @@ void main() { }); testWidgets('More core widgets', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( MaterialApp( home: RemoteWidget( diff --git a/packages/rfw/test/material_widgets_test.dart b/packages/rfw/test/material_widgets_test.dart index e227b416cdf..c0fa13e335f 100644 --- a/packages/rfw/test/material_widgets_test.dart +++ b/packages/rfw/test/material_widgets_test.dart @@ -22,12 +22,12 @@ import 'utils.dart'; const bool kIsJS = kIsWeb && !kIsWasm; void main() { - const LibraryName coreName = LibraryName(['core']); - const LibraryName materialName = LibraryName(['material']); - const LibraryName testName = LibraryName(['test']); + const coreName = LibraryName(['core']); + const materialName = LibraryName(['material']); + const testName = LibraryName(['test']); Runtime setupRuntime() { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(coreName, createCoreWidgets()) ..update(materialName, createMaterialWidgets()); addTearDown(runtime.dispose); @@ -43,8 +43,8 @@ void main() { testWidgets('Material widgets', (WidgetTester tester) async { final Runtime runtime = setupRuntime(); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), @@ -258,8 +258,8 @@ void main() { testWidgets('Implement ButtonBar properties', (WidgetTester tester) async { final Runtime runtime = setupRuntime(); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), @@ -342,8 +342,8 @@ void main() { WidgetTester tester, ) async { final Runtime runtime = setupRuntime(); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), @@ -408,8 +408,8 @@ void main() { testWidgets('Implement OverflowBar properties', (WidgetTester tester) async { final Runtime runtime = setupRuntime(); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), @@ -489,8 +489,8 @@ void main() { testWidgets('Implement InkResponse properties', (WidgetTester tester) async { final Runtime runtime = setupRuntime(); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), @@ -572,8 +572,8 @@ void main() { testWidgets('Implement Material properties', (WidgetTester tester) async { final Runtime runtime = setupRuntime(); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), @@ -655,8 +655,8 @@ void main() { testWidgets('Slider properties', (WidgetTester tester) async { final Runtime runtime = setupRuntime(); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), diff --git a/packages/rfw/test/model_test.dart b/packages/rfw/test/model_test.dart index 5deebb1966f..683f2b5a884 100644 --- a/packages/rfw/test/model_test.dart +++ b/packages/rfw/test/model_test.dart @@ -10,10 +10,10 @@ import 'package:rfw/formats.dart'; void main() { testWidgets('$LibraryName', (WidgetTester tester) async { T deconst(T value) => value; - final LibraryName a = LibraryName(['core', deconst('widgets')]); - final LibraryName b = LibraryName(['core', deconst('widgets')]); - final LibraryName c = LibraryName(['core', deconst('material')]); - const LibraryName d = LibraryName(['core']); + final a = LibraryName(['core', deconst('widgets')]); + final b = LibraryName(['core', deconst('widgets')]); + final c = LibraryName(['core', deconst('material')]); + const d = LibraryName(['core']); expect('$a', 'core.widgets'); expect('$c', 'core.material'); expect(a, equals(b)); @@ -35,9 +35,9 @@ void main() { }); testWidgets('$FullyQualifiedWidgetName', (WidgetTester tester) async { - const FullyQualifiedWidgetName aa = FullyQualifiedWidgetName(LibraryName(['a']), 'a'); - const FullyQualifiedWidgetName ab = FullyQualifiedWidgetName(LibraryName(['a']), 'b'); - const FullyQualifiedWidgetName bb = FullyQualifiedWidgetName(LibraryName(['b']), 'b'); + const aa = FullyQualifiedWidgetName(LibraryName(['a']), 'a'); + const ab = FullyQualifiedWidgetName(LibraryName(['a']), 'b'); + const bb = FullyQualifiedWidgetName(LibraryName(['b']), 'b'); expect('$aa', 'a:a'); expect(aa, isNot(equals(bb))); expect(aa.hashCode, isNot(equals(bb.hashCode))); @@ -73,7 +73,7 @@ void main() { }); testWidgets('$BoundArgsReference', (WidgetTester tester) async { - final Object target = Object(); + final target = Object(); final BoundArgsReference result = const ArgsReference([0]).bind(target); expect(result.arguments, target); expect(result.parts, const [0]); @@ -90,7 +90,7 @@ void main() { }); testWidgets('$BoundLoopReference', (WidgetTester tester) async { - final Object target = Object(); + final target = Object(); final BoundLoopReference result = const LoopReference(9, [0]).bind(target).constructReference([1]); expect(result.value, target); expect(result.parts, const [0, 1]); @@ -103,8 +103,8 @@ void main() { }); testWidgets('$SourceLocation comparison', (WidgetTester tester) async { - const SourceLocation test1 = SourceLocation('test', 123); - const SourceLocation test2 = SourceLocation('test', 234); + const test1 = SourceLocation('test', 123); + const test2 = SourceLocation('test', 234); expect(test1.compareTo(test2), lessThan(0)); // test1 vs test1 expect(test1 == test1, isTrue); @@ -125,7 +125,7 @@ void main() { expect(test2 > test1, isTrue); expect(test2 >= test1, isTrue); // map - final Map map = { + final map = { test1: test1, test2: test2, }; @@ -134,8 +134,8 @@ void main() { }); testWidgets('$SourceLocation with non-matching sources', (WidgetTester tester) async { - const SourceLocation test1 = SourceLocation('test1', 123); - const SourceLocation test2 = SourceLocation('test2', 234); + const test1 = SourceLocation('test1', 123); + const test2 = SourceLocation('test2', 234); expect(() => test1.compareTo(test2), throwsA(anything)); expect(() => test1 < test2, throwsA(anything)); expect(() => test1 <= test2, throwsA(anything)); @@ -144,16 +144,16 @@ void main() { }); testWidgets('$SourceLocation toString', (WidgetTester tester) async { - const SourceLocation test = SourceLocation('test1', 123); + const test = SourceLocation('test1', 123); expect('$test', 'test1@123'); }); testWidgets('$SourceRange', (WidgetTester tester) async { - const SourceLocation a = SourceLocation('test', 123); - const SourceLocation b = SourceLocation('test', 124); - const SourceLocation c = SourceLocation('test', 125); - final SourceRange range1 = SourceRange(a, b); - final SourceRange range2 = SourceRange(b, c); + const a = SourceLocation('test', 123); + const b = SourceLocation('test', 124); + const c = SourceLocation('test', 125); + final range1 = SourceRange(a, b); + final range2 = SourceRange(b, c); // toString expect('$range1', 'test@123..124'); // equality @@ -161,7 +161,7 @@ void main() { expect(range1 == range2, isFalse); expect(range2 == range1, isFalse); // map - final Map map = { + final map = { range1: range1, range2: range2, }; diff --git a/packages/rfw/test/readme_test.dart b/packages/rfw/test/readme_test.dart index b859637bac9..46dd327c1f5 100644 --- a/packages/rfw/test/readme_test.dart +++ b/packages/rfw/test/readme_test.dart @@ -237,8 +237,8 @@ List _createLocalWidgets(String region) { 'Foo': (BuildContext context, DataSource source) { final int length = source.length(['text']); if (length > 0) { - final StringBuffer text = StringBuffer(); - for (int index = 0; index < length; index += 1) { + final text = StringBuffer(); + for (var index = 0; index < length; index += 1) { text.write(source.v(['text', index])); } return Text(text.toString(), textDirection: TextDirection.ltr); @@ -323,11 +323,11 @@ List _createLocalWidgets(String region) { void main() { testWidgets('readme snippets', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()) ..update(const LibraryName(['material']), createMaterialWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(parseDataFile(gameData)); + final data = DynamicContent(parseDataFile(gameData)); for (final String region in rawRemoteWidgetSnippets.keys) { final String body = rawRemoteWidgetSnippets[region]!; runtime.update(LibraryName([region]), parseLibraryFile(body)); diff --git a/packages/rfw/test/remote_widget_test.dart b/packages/rfw/test/remote_widget_test.dart index b9f075e8ace..1665bdbd105 100644 --- a/packages/rfw/test/remote_widget_test.dart +++ b/packages/rfw/test/remote_widget_test.dart @@ -9,7 +9,7 @@ import 'package:rfw/rfw.dart'; void main() { testWidgets('RemoteWidget', (WidgetTester tester) async { - final Runtime runtime1 = Runtime() + final runtime1 = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()) ..update( const LibraryName(['test']), @@ -19,7 +19,7 @@ void main() { '''), ); addTearDown(runtime1.dispose); - final Runtime runtime2 = Runtime() + final runtime2 = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()) ..update( const LibraryName(['test']), @@ -29,7 +29,7 @@ void main() { '''), ); addTearDown(runtime2.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime1, diff --git a/packages/rfw/test/runtime_test.dart b/packages/rfw/test/runtime_test.dart index 6ab795f1830..9d51c71e94c 100644 --- a/packages/rfw/test/runtime_test.dart +++ b/packages/rfw/test/runtime_test.dart @@ -16,10 +16,10 @@ import 'package:rfw/rfw.dart'; void main() { testWidgets('list lookup', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent({ + final data = DynamicContent({ 'list': [ 0, 1, 2, 3, 4 ], }); await tester.pumpWidget( @@ -46,9 +46,9 @@ void main() { }); testWidgets('data updates', (WidgetTester tester) async { - int buildCount = 0; + var buildCount = 0; int? lastValue; - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), LocalWidgetLibrary({ 'Test': (BuildContext context, DataSource source) { buildCount += 1; @@ -57,7 +57,7 @@ void main() { }, })); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent({ + final data = DynamicContent({ 'list': [ { 'a': 0 }, { 'a': 1 }, @@ -121,7 +121,7 @@ void main() { }); testWidgets('deepClone', (WidgetTester tester) async { - final Map map = { + final map = { 'outer': { 'inner': true, } @@ -131,10 +131,10 @@ void main() { }); testWidgets('updateText, updateBinary, clearLibraries', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -168,10 +168,10 @@ void main() { }); testWidgets('Runtime cached build', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -200,7 +200,7 @@ void main() { }); testWidgets('Import loops', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['a']), parseLibraryFile(''' import b; ''')) @@ -208,7 +208,7 @@ void main() { import a; ''')); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -220,12 +220,12 @@ void main() { }); testWidgets('Import loops', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['a']), parseLibraryFile(''' import a; ''')); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -237,12 +237,12 @@ void main() { }); testWidgets('Missing libraries in import', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['a']), parseLibraryFile(''' import b; ''')); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -255,9 +255,9 @@ void main() { }); testWidgets('Missing libraries in specified widget', (WidgetTester tester) async { - final Runtime runtime = Runtime(); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -270,13 +270,13 @@ void main() { }); testWidgets('Missing libraries in import via dependency', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['a']), parseLibraryFile(''' import b; widget widget = test(); ''')); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -289,10 +289,10 @@ void main() { }); testWidgets('Missing widget', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['a']), parseLibraryFile('')); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -305,10 +305,10 @@ void main() { }); testWidgets('Runtime', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -336,10 +336,10 @@ void main() { }); testWidgets('Runtime', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -360,7 +360,7 @@ void main() { }); testWidgets('Runtime', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); expect(runtime.libraries.length, 1); @@ -373,10 +373,10 @@ void main() { }); testWidgets('Runtime', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -401,10 +401,10 @@ void main() { }); testWidgets('DynamicContent', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -443,15 +443,15 @@ void main() { }); testWidgets('DynamicContent', (WidgetTester tester) async { - final DynamicContent data = DynamicContent({'hello': 'world'}); + final data = DynamicContent({'hello': 'world'}); expect(data.toString(), 'DynamicContent({hello: world})'); }); testWidgets('binding loop variables', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent({ + final data = DynamicContent({ 'list': [ { 'a': { 'b': 0xEE }, @@ -459,7 +459,7 @@ void main() { }, ], }); - final List eventLog = []; + final eventLog = []; await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -614,10 +614,10 @@ void main() { }); testWidgets('list lookup of esoteric values', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -735,10 +735,10 @@ void main() { }); testWidgets('data lookup', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent({ + final data = DynamicContent({ 'map': { 'list': [ 0xAB ] }, }); await tester.pumpWidget( @@ -760,10 +760,10 @@ void main() { }); testWidgets('args lookup', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -784,10 +784,10 @@ void main() { }); testWidgets('state lookup', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -807,10 +807,10 @@ void main() { }); testWidgets('switch', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -843,11 +843,11 @@ void main() { }); testWidgets('events with arguments', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -892,10 +892,10 @@ void main() { }); testWidgets('_CurriedWidget toStrings', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); runtime.update(const LibraryName(['test']), parseLibraryFile(''' import core; widget stateless = ColoredBox(color: 0xAA); @@ -932,10 +932,10 @@ void main() { }); testWidgets('state setting', (WidgetTester tester) async { - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -1052,10 +1052,10 @@ void main() { }); testWidgets('DataSource', (WidgetTester tester) async { - final Runtime runtime = Runtime(); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); - final List eventLog = []; + final data = DynamicContent(); + final eventLog = []; await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -1091,7 +1091,7 @@ void main() { ''')); await tester.pump(); expect(tester.widget(find.byType(ColoredBox)).color, const Color(0xAABBCCDD)); - bool tested = false; + var tested = false; tester.element(find.byType(ColoredBox)).visitAncestorElements((Element node) { expect(node.toString(), equalsIgnoringHashCodes('_Widget(state: _WidgetState#00000(name: "local:Test"))')); tested = true; @@ -1101,8 +1101,8 @@ void main() { }); testWidgets('DynamicContent subscriptions', (WidgetTester tester) async { - final List log = []; - final DynamicContent data = DynamicContent({ + final log = []; + final data = DynamicContent({ 'a': [0, 1], 'b': ['q', 'r'], }); @@ -1115,12 +1115,12 @@ void main() { }); testWidgets('Data source - optional builder works', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); runtime.update(coreLibraryName, createCoreWidgets()); runtime.update(localLibraryName, LocalWidgetLibrary( { 'Builder': (BuildContext context, DataSource source) { @@ -1149,13 +1149,13 @@ void main() { }); testWidgets('Data source - builder returns an error widget', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); - const String expectedErrorMessage = 'Not a builder at [builder] (got core:Text {} {text: Not a builder :/}) for local:Builder.'; + final data = DynamicContent(); + const expectedErrorMessage = 'Not a builder at [builder] (got core:Text {} {text: Not a builder :/}) for local:Builder.'; runtime.update(coreLibraryName, createCoreWidgets()); runtime.update(localLibraryName, LocalWidgetLibrary( { @@ -1188,10 +1188,10 @@ void main() { ErrorWidget.builder = (FlutterErrorDetails details) { return const Text('oopsie!', textDirection: TextDirection.ltr); }; - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['a']), parseLibraryFile('')); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); await tester.pumpWidget( RemoteWidget( runtime: runtime, @@ -1206,12 +1206,12 @@ void main() { }); testWidgets('Widget builders - work when scope is not used', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); final Finder textFinder = find.byType(Text); runtime.update(coreLibraryName, createCoreWidgets()); @@ -1239,18 +1239,18 @@ void main() { }); testWidgets('Widget builders - work when scope is used', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); final Finder textFinder = find.byType(Text); runtime.update(coreLibraryName, createCoreWidgets()); runtime.update(localLibraryName, LocalWidgetLibrary( { 'HelloWorld': (BuildContext context, DataSource source) { - const String result = 'Hello World!'; + const result = 'Hello World!'; return source.builder(['builder'], {'result': result}); }, })); @@ -1273,19 +1273,19 @@ void main() { }); testWidgets('Widget builders - work with state', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); final Finder textFinder = find.byType(Text); runtime.update(coreLibraryName, createCoreWidgets()); runtime.update(localLibraryName, LocalWidgetLibrary( { 'IntToString': (BuildContext context, DataSource source) { final int value = source.v(['value'])!; - final String result = value.toString(); + final result = value.toString(); return source.builder(['builder'], {'result': result}); }, })); @@ -1310,19 +1310,19 @@ void main() { testWidgets('Widget builders - work with data', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent({'value': 0}); + final data = DynamicContent({'value': 0}); final Finder textFinder = find.byType(Text); runtime.update(coreLibraryName, createCoreWidgets()); runtime.update(localLibraryName, LocalWidgetLibrary( { 'IntToString': (BuildContext context, DataSource source) { final int value = source.v(['value'])!; - final String result = value.toString(); + final result = value.toString(); return source.builder(['builder'], {'result': result}); }, })); @@ -1350,13 +1350,13 @@ void main() { }); testWidgets('Widget builders - work with events', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); - final List dispatchedEvents = []; + final data = DynamicContent(); + final dispatchedEvents = []; final Finder textFinder = find.byType(Text); runtime.update(coreLibraryName, createCoreWidgets()); @@ -1392,12 +1392,12 @@ void main() { }); testWidgets('Widget builders - works nested', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); final Finder textFinder = find.byType(Text); runtime.update(coreLibraryName, createCoreWidgets()); runtime.update(localLibraryName, LocalWidgetLibrary( { @@ -1409,7 +1409,7 @@ void main() { }, 'IntToString': (BuildContext context, DataSource source) { final int value = source.v(['value'])!; - final String result = value.toString(); + final result = value.toString(); return source.builder(['builder'], {'result': result}); }, })); @@ -1437,13 +1437,13 @@ void main() { }); testWidgets('Widget builders - works nested dynamically', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Map handlers = {}; - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final handlers = {}; + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent({ + final data = DynamicContent({ 'a1': 'apricot', 'b1': 'blueberry', }); @@ -1505,12 +1505,12 @@ void main() { }); testWidgets('Widget builders - switch works with builder', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); final Finder textFinder = find.byType(Text); runtime.update(coreLibraryName, createCoreWidgets()); @@ -1554,12 +1554,12 @@ void main() { }); testWidgets('Widget builders - builder works with switch', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); final Finder textFinder = find.byType(Text); runtime.update(coreLibraryName, createCoreWidgets()); runtime.update(localLibraryName, LocalWidgetLibrary( { @@ -1608,12 +1608,12 @@ void main() { }); testWidgets('Widget builders - builder works with loops', (WidgetTester tester) async { - const LibraryName coreLibraryName = LibraryName(['core']); - const LibraryName localLibraryName = LibraryName(['local']); - const LibraryName remoteLibraryName = LibraryName(['remote']); - final Runtime runtime = Runtime(); + const coreLibraryName = LibraryName(['core']); + const localLibraryName = LibraryName(['local']); + const remoteLibraryName = LibraryName(['remote']); + final runtime = Runtime(); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent(); + final data = DynamicContent(); final Finder textFinder = find.byType(Text); runtime.update(coreLibraryName, createCoreWidgets()); diff --git a/packages/rfw/test/source_locations_test.dart b/packages/rfw/test/source_locations_test.dart index 0c272112897..2b9369fa976 100644 --- a/packages/rfw/test/source_locations_test.dart +++ b/packages/rfw/test/source_locations_test.dart @@ -50,13 +50,13 @@ widget verify { state: true } = switch args.value.c.0 { } return (node.source!.start.source as String).substring(node.source!.start.offset, node.source!.end.offset); } - final Runtime runtime = Runtime() + final runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()) // We use the actual source text as the sourceIdentifier to make it trivial to find the source contents. // In normal operation, the sourceIdentifier would be the file name or some similar object. ..update(const LibraryName(['test']), parseLibraryFile(sourceFile, sourceIdentifier: sourceFile)); addTearDown(runtime.dispose); - final DynamicContent data = DynamicContent({ + final data = DynamicContent({ 'list': [ { 'a': { 'b': 0xEE }, diff --git a/packages/rfw/test/text_test.dart b/packages/rfw/test/text_test.dart index 210eb7b5b59..bb301099286 100644 --- a/packages/rfw/test/text_test.dart +++ b/packages/rfw/test/text_test.dart @@ -387,7 +387,7 @@ void main() { } } - const String expectedErrorMessage = + const expectedErrorMessage = 'Expecting a switch or constructor call got 1 at line 1 column 27.'; test('widget a = B(b: (foo) => 1);', expectedErrorMessage); }); @@ -402,7 +402,7 @@ void main() { } } - const String expectedErrorMessage = + const expectedErrorMessage = 'args is a reserved word at line 1 column 34.'; test('widget a = Builder(builder: (args) => Container(width: args.width));', expectedErrorMessage); }); @@ -417,7 +417,7 @@ void main() { } } - const String expectedErrorMessage = + const expectedErrorMessage = 'Expected symbol "{" but found widget at line 1 column 7.'; test('widget a = Builder(builder: (args) => Container(width: args.width));', expectedErrorMessage); }); diff --git a/packages/rfw/test/tolerant_comparator.dart b/packages/rfw/test/tolerant_comparator.dart index 5349849dc8f..87fa54e0d2d 100644 --- a/packages/rfw/test/tolerant_comparator.dart +++ b/packages/rfw/test/tolerant_comparator.dart @@ -12,7 +12,7 @@ void setUpTolerantComparator({ required double precisionTolerance, }) { final GoldenFileComparator oldComparator = goldenFileComparator; - final _TolerantGoldenFileComparator newComparator = + final newComparator = _TolerantGoldenFileComparator( Uri.parse(testPath), precisionTolerance: precisionTolerance, diff --git a/packages/rfw/test_coverage/bin/test_coverage.dart b/packages/rfw/test_coverage/bin/test_coverage.dart index 15bb2ee8613..4a16b701e30 100644 --- a/packages/rfw/test_coverage/bin/test_coverage.dart +++ b/packages/rfw/test_coverage/bin/test_coverage.dart @@ -50,7 +50,7 @@ final class LcovLine { Future main(List arguments) async { // This script is mentioned in the CONTRIBUTING.md file. - final Directory coverageDirectory = Directory('coverage'); + final coverageDirectory = Directory('coverage'); if (coverageDirectory.existsSync()) { coverageDirectory.deleteSync(recursive: true); @@ -85,10 +85,10 @@ Future main(List arguments) async { .whereType() .where((File file) => file.path.endsWith('.dart')) .toList(); - final Set flakyLines = {}; - final Set deadLines = {}; - for (final File file in libFiles) { - int lineNumber = 0; + final flakyLines = {}; + final deadLines = {}; + for (final file in libFiles) { + var lineNumber = 0; for (final String line in file.readAsLinesSync()) { lineNumber += 1; if (line.endsWith('// dead code on VM target')) { @@ -103,18 +103,18 @@ Future main(List arguments) async { final List records = await lcov.Parser.parse( 'coverage/lcov.info', ); - int totalLines = 0; - int coveredLines = 0; - bool deadLinesError = false; - for (final lcov.Record record in records) { + var totalLines = 0; + var coveredLines = 0; + var deadLinesError = false; + for (final record in records) { if (record.lines != null) { totalLines += record.lines!.found ?? 0; coveredLines += record.lines!.hit ?? 0; if (record.file != null && record.lines!.details != null) { - for (int index = 0; index < record.lines!.details!.length; index += 1) { + for (var index = 0; index < record.lines!.details!.length; index += 1) { if (record.lines!.details![index].hit != null && record.lines!.details![index].line != null) { - final LcovLine line = LcovLine( + final line = LcovLine( record.file!, record.lines!.details![index].line!, ); @@ -140,7 +140,7 @@ Future main(List arguments) async { } } if (deadLines.isNotEmpty || deadLinesError) { - for (final LcovLine line in deadLines) { + for (final line in deadLines) { print( '$line: Line is marked as being undetectably dead code but was not considered reachable.', ); diff --git a/packages/shared_preferences/shared_preferences/example/integration_test/shared_preferences_migration_util_test.dart b/packages/shared_preferences/shared_preferences/example/integration_test/shared_preferences_migration_util_test.dart index 4f290b78254..668733f25d1 100644 --- a/packages/shared_preferences/shared_preferences/example/integration_test/shared_preferences_migration_util_test.dart +++ b/packages/shared_preferences/shared_preferences/example/integration_test/shared_preferences_migration_util_test.dart @@ -42,7 +42,7 @@ void main() { group('SharedPreferences with setPrefix and allowList', () { runAllGroups(() { - final Set allowList = { + final allowList = { 'prefix.$boolKey', 'prefix.$intKey', 'prefix.$doubleKey', @@ -65,7 +65,7 @@ void runAllGroups( bool keysCollide = false, }) { group('default sharedPreferencesAsyncOptions', () { - const SharedPreferencesOptions sharedPreferencesAsyncOptions = + const sharedPreferencesAsyncOptions = SharedPreferencesOptions(); runTests( @@ -160,7 +160,7 @@ void runTests( migrationCompletedKey: migrationCompletedKey, ); - final SharedPreferencesAsync asyncPreferences = SharedPreferencesAsync( + final asyncPreferences = SharedPreferencesAsync( options: sharedPreferencesAsyncOptions, ); @@ -179,7 +179,7 @@ void runTests( migrationCompletedKey: migrationCompletedKey, ); - final SharedPreferencesAsync asyncPreferences = SharedPreferencesAsync( + final asyncPreferences = SharedPreferencesAsync( options: sharedPreferencesAsyncOptions, ); @@ -197,7 +197,7 @@ void runTests( migrationCompletedKey: migrationCompletedKey, ); - final SharedPreferencesAsync asyncPreferences = SharedPreferencesAsync( + final asyncPreferences = SharedPreferencesAsync( options: sharedPreferencesAsyncOptions, ); await preferences.setInt(intKey, -0); diff --git a/packages/shared_preferences/shared_preferences/example/integration_test/shared_preferences_test.dart b/packages/shared_preferences/shared_preferences/example/integration_test/shared_preferences_test.dart index 3788025bc75..3146949126a 100644 --- a/packages/shared_preferences/shared_preferences/example/integration_test/shared_preferences_test.dart +++ b/packages/shared_preferences/shared_preferences/example/integration_test/shared_preferences_test.dart @@ -9,17 +9,17 @@ import 'package:shared_preferences/shared_preferences.dart'; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; - - const String testString2 = 'goodbye world'; - const bool testBool2 = false; - const int testInt2 = 1337; - const double testDouble2 = 2.71828; - const List testList2 = ['baz', 'qux']; + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; + + const testString2 = 'goodbye world'; + const testBool2 = false; + const testInt2 = 1337; + const testDouble2 = 2.71828; + const testList2 = ['baz', 'qux']; group('shared_preferences', () { late SharedPreferences preferences; @@ -56,7 +56,7 @@ void main() { }); testWidgets('removing', (WidgetTester _) async { - const String key = 'testKey'; + const key = 'testKey'; await preferences.setString(key, testString); await preferences.remove(key); expect(preferences.get('testKey'), isNull); @@ -77,9 +77,9 @@ void main() { }); testWidgets('simultaneous writes', (WidgetTester _) async { - final List> writes = >[]; - const int writeCount = 100; - for (int i = 1; i <= writeCount; i++) { + final writes = >[]; + const writeCount = 100; + for (var i = 1; i <= writeCount; i++) { writes.add(preferences.setInt('int', i)); } final List result = await Future.wait(writes, eagerError: true); @@ -134,12 +134,12 @@ void main() { }); testWidgets('allowList only gets allowed items', (WidgetTester _) async { - const String allowedString = 'stringKey'; - const String allowedBool = 'boolKey'; - const String notAllowedDouble = 'doubleKey'; - const String resultString = 'resultString'; + const allowedString = 'stringKey'; + const allowedBool = 'boolKey'; + const notAllowedDouble = 'doubleKey'; + const resultString = 'resultString'; - const Set allowList = {allowedString, allowedBool}; + const allowList = {allowedString, allowedBool}; SharedPreferences.resetStatic(); SharedPreferences.setPrefix('', allowList: allowList); @@ -164,21 +164,21 @@ void main() { }); group('shared_preferences_async', () { - const String stringKey = 'testString'; - const String boolKey = 'testBool'; - const String intKey = 'testInt'; - const String doubleKey = 'testDouble'; - const String listKey = 'testList'; - - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; + const stringKey = 'testString'; + const boolKey = 'testBool'; + const intKey = 'testInt'; + const doubleKey = 'testDouble'; + const listKey = 'testList'; + + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; group('Async', () { Future getPreferences() async { - final SharedPreferencesAsync preferences = SharedPreferencesAsync(); + final preferences = SharedPreferencesAsync(); await preferences.clear(); return preferences; } @@ -307,7 +307,7 @@ void main() { testWidgets('containsKey', (WidgetTester _) async { final SharedPreferencesAsync preferences = await getPreferences(); - const String key = 'testKey'; + const key = 'testKey'; expect(false, await preferences.containsKey(key)); @@ -411,7 +411,7 @@ void main() { group('withCache', () { Future<(SharedPreferencesWithCache, Map)> getPreferences() async { - final Map cache = {}; + final cache = {}; final SharedPreferencesWithCache preferences = await SharedPreferencesWithCache.create( cache: cache, @@ -480,7 +480,7 @@ void main() { testWidgets('containsKey', (WidgetTester _) async { final (SharedPreferencesWithCache preferences, _) = await getPreferences(); - const String key = 'testKey'; + const key = 'testKey'; expect(false, preferences.containsKey(key)); @@ -531,7 +531,7 @@ void main() { group('withCache with filter', () { Future<(SharedPreferencesWithCache, Map)> getPreferences() async { - final Map cache = {}; + final cache = {}; final SharedPreferencesWithCache preferences = await SharedPreferencesWithCache.create( cache: cache, @@ -554,7 +554,7 @@ void main() { ) async { final (SharedPreferencesWithCache preferences, _) = await getPreferences(); - const String key = 'testKey'; + const key = 'testKey'; expect( () async => preferences.setString(key, 'test'), @@ -609,7 +609,7 @@ void main() { SharedPreferencesWithCache preferences, Map cache, ) = await getPreferences(); - final List listObject = ['one', 'two']; + final listObject = ['one', 'two']; cache[listKey] = listObject; expect(preferences.getStringList(listKey), listObject); }); diff --git a/packages/shared_preferences/shared_preferences/example/lib/main.dart b/packages/shared_preferences/shared_preferences/example/lib/main.dart index a51bb141762..bbd5a630ea3 100644 --- a/packages/shared_preferences/shared_preferences/example/lib/main.dart +++ b/packages/shared_preferences/shared_preferences/example/lib/main.dart @@ -64,7 +64,7 @@ class SharedPreferencesDemoState extends State { /// Gets external button presses that could occur in another instance, thread, /// or via some native system. Future _getExternalCounter() async { - final SharedPreferencesAsync prefs = SharedPreferencesAsync(); + final prefs = SharedPreferencesAsync(); final int externalCounter = (await prefs.getInt('externalCounter')) ?? 0; setState(() { _externalCounter = externalCounter; @@ -73,7 +73,7 @@ class SharedPreferencesDemoState extends State { Future _migratePreferences() async { // #docregion migrate - const SharedPreferencesOptions sharedPreferencesOptions = + const sharedPreferencesOptions = SharedPreferencesOptions(); final SharedPreferences prefs = await SharedPreferences.getInstance(); await migrateLegacySharedPreferencesToSharedPreferencesAsyncIfNecessary( diff --git a/packages/shared_preferences/shared_preferences/example/lib/readme_excerpts.dart b/packages/shared_preferences/shared_preferences/example/lib/readme_excerpts.dart index edd39ab5f3d..b917383df8b 100644 --- a/packages/shared_preferences/shared_preferences/example/lib/readme_excerpts.dart +++ b/packages/shared_preferences/shared_preferences/example/lib/readme_excerpts.dart @@ -46,7 +46,7 @@ Future readmeSnippets() async { Future readmeSnippetsAsync() async { // #docregion Async - final SharedPreferencesAsync asyncPrefs = SharedPreferencesAsync(); + final asyncPrefs = SharedPreferencesAsync(); await asyncPrefs.setBool('repeat', true); await asyncPrefs.setString('action', 'Start'); @@ -91,7 +91,7 @@ Future readmeSnippetsWithCache() async { // from examples. Future readmeTestSnippets() async { // #docregion Tests - final Map values = {'counter': 1}; + final values = {'counter': 1}; SharedPreferences.setMockInitialValues(values); // #enddocregion Tests } diff --git a/packages/shared_preferences/shared_preferences/example/test/readme_excerpts_test.dart b/packages/shared_preferences/shared_preferences/example/test/readme_excerpts_test.dart index e2c38731f54..714443a46f7 100644 --- a/packages/shared_preferences/shared_preferences/example/test/readme_excerpts_test.dart +++ b/packages/shared_preferences/shared_preferences/example/test/readme_excerpts_test.dart @@ -11,7 +11,7 @@ void main() { test('sanity check readmeSnippets', () async { // This key is set and cleared in the snippets. - const String clearedKey = 'counter'; + const clearedKey = 'counter'; // Set a mock store so that there's a platform implementation. SharedPreferences.setMockInitialValues({clearedKey: 2}); diff --git a/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_async.dart b/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_async.dart index 72c05d9b9aa..53d1ef2f43e 100644 --- a/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_async.dart +++ b/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_async.dart @@ -42,7 +42,7 @@ class SharedPreferencesAsync { /// /// Ignores any keys whose values are types which are incompatible with shared_preferences. Future> getKeys({Set? allowList}) async { - final GetPreferencesParameters parameters = GetPreferencesParameters( + final parameters = GetPreferencesParameters( filter: PreferencesFilters(allowList: allowList), ); return _platform.getKeys(parameters, _options); @@ -54,7 +54,7 @@ class SharedPreferencesAsync { /// /// Ignores any entries of types which are incompatible with shared_preferences. Future> getAll({Set? allowList}) async { - final GetPreferencesParameters parameters = GetPreferencesParameters( + final parameters = GetPreferencesParameters( filter: PreferencesFilters(allowList: allowList), ); return _platform.getPreferences(parameters, _options); @@ -145,7 +145,7 @@ class SharedPreferencesAsync { /// /// It is highly recommended that an [allowList] be provided to this call. Future clear({Set? allowList}) { - final ClearPreferencesParameters parameters = ClearPreferencesParameters( + final parameters = ClearPreferencesParameters( filter: PreferencesFilters(allowList: allowList), ); return _platform.clear(parameters, _options); @@ -197,7 +197,7 @@ class SharedPreferencesWithCache { required SharedPreferencesWithCacheOptions cacheOptions, Map? cache, }) async { - final SharedPreferencesWithCache preferences = + final preferences = SharedPreferencesWithCache._create( sharedPreferencesOptions: sharedPreferencesOptions, cacheOptions: cacheOptions, diff --git a/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_devtools_extension_data.dart b/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_devtools_extension_data.dart index 9c337ef4676..5bd3eb7e82d 100644 --- a/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_devtools_extension_data.dart +++ b/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_devtools_extension_data.dart @@ -93,7 +93,7 @@ class SharedPreferencesDevToolsExtensionData { ); } } else { - final SharedPreferencesAsync prefs = SharedPreferencesAsync(); + final prefs = SharedPreferencesAsync(); // we need to check the kind because sometimes a double // gets interpreted as an int. If this was not an issue // we'd only need to do a simple pattern matching on value. diff --git a/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_legacy.dart b/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_legacy.dart index e7730a5b04e..5b27fe5af26 100644 --- a/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_legacy.dart +++ b/packages/shared_preferences/shared_preferences/lib/src/shared_preferences_legacy.dart @@ -78,7 +78,7 @@ class SharedPreferences { /// performance-sensitive blocks. static Future getInstance() async { if (_completer == null) { - final Completer completer = + final completer = Completer(); _completer = completer; try { @@ -135,7 +135,7 @@ class SharedPreferences { /// Reads a set of string values from persistent storage, throwing an /// exception if it's not a string list. List? getStringList(String key) { - List? list = _preferenceCache[key] as List?; + var list = _preferenceCache[key] as List?; list = list?.cast(); // Make a copy of the list so that later mutations won't propagate return list?.toList() as List?; @@ -170,14 +170,14 @@ class SharedPreferences { /// Removes an entry from persistent storage. Future remove(String key) { - final String prefixedKey = '$_prefix$key'; + final prefixedKey = '$_prefix$key'; _preferenceCache.remove(key); return _store.remove(prefixedKey); } Future _setValue(String valueType, String key, Object value) { ArgumentError.checkNotNull(value, 'value'); - final String prefixedKey = '$_prefix$key'; + final prefixedKey = '$_prefix$key'; if (value is List) { // Make a copy of the list so that later mutations won't propagate _preferenceCache[key] = value.toList(); @@ -229,7 +229,7 @@ Either update the implementation to support setPrefix, or do not call setPrefix. } static Future> _getSharedPreferencesMap() async { - final Map fromSystem = {}; + final fromSystem = {}; if (_prefixHasBeenChanged) { try { fromSystem.addAll( @@ -258,7 +258,7 @@ Either update the implementation to support setPrefix, or do not call setPrefix. return fromSystem; } // Strip the prefix from the returned preferences. - final Map preferencesMap = {}; + final preferencesMap = {}; for (final String key in fromSystem.keys) { assert(key.startsWith(_prefix)); preferencesMap[key.substring(_prefix.length)] = fromSystem[key]!; @@ -275,7 +275,7 @@ Either update the implementation to support setPrefix, or do not call setPrefix. String key, Object value, ) { - String newKey = key; + var newKey = key; if (!key.startsWith(_prefix)) { newKey = '$_prefix$key'; } diff --git a/packages/shared_preferences/shared_preferences/lib/util/legacy_to_async_migration_util.dart b/packages/shared_preferences/shared_preferences/lib/util/legacy_to_async_migration_util.dart index 866d0fbf8d9..c920455302f 100644 --- a/packages/shared_preferences/shared_preferences/lib/util/legacy_to_async_migration_util.dart +++ b/packages/shared_preferences/shared_preferences/lib/util/legacy_to_async_migration_util.dart @@ -29,7 +29,7 @@ Future migrateLegacySharedPreferencesToSharedPreferencesAsyncIfNecessary({ required SharedPreferencesOptions sharedPreferencesAsyncOptions, required String migrationCompletedKey, }) async { - final SharedPreferencesAsync sharedPreferencesAsyncInstance = + final sharedPreferencesAsyncInstance = SharedPreferencesAsync(options: sharedPreferencesAsyncOptions); if (await sharedPreferencesAsyncInstance.containsKey(migrationCompletedKey)) { @@ -39,7 +39,7 @@ Future migrateLegacySharedPreferencesToSharedPreferencesAsyncIfNecessary({ await legacySharedPreferencesInstance.reload(); final Set keys = legacySharedPreferencesInstance.getKeys(); - for (final String key in keys) { + for (final key in keys) { final Object? value = legacySharedPreferencesInstance.get(key); switch (value.runtimeType) { case const (bool): diff --git a/packages/shared_preferences/shared_preferences/test/shared_preferences_async_test.dart b/packages/shared_preferences/shared_preferences/test/shared_preferences_async_test.dart index 7798e800781..3eeef53821d 100755 --- a/packages/shared_preferences/shared_preferences/test/shared_preferences_async_test.dart +++ b/packages/shared_preferences/shared_preferences/test/shared_preferences_async_test.dart @@ -10,23 +10,23 @@ import 'package:shared_preferences_platform_interface/shared_preferences_async_p import 'package:shared_preferences_platform_interface/types.dart'; void main() { - const String stringKey = 'testString'; - const String boolKey = 'testBool'; - const String intKey = 'testInt'; - const String doubleKey = 'testDouble'; - const String listKey = 'testList'; - - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; + const stringKey = 'testString'; + const boolKey = 'testBool'; + const intKey = 'testInt'; + const doubleKey = 'testDouble'; + const listKey = 'testList'; + + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; group('Async', () { (SharedPreferencesAsync, FakeSharedPreferencesAsync) getPreferences() { - final FakeSharedPreferencesAsync store = FakeSharedPreferencesAsync(); + final store = FakeSharedPreferencesAsync(); SharedPreferencesAsyncPlatform.instance = store; - final SharedPreferencesAsync preferences = SharedPreferencesAsync(); + final preferences = SharedPreferencesAsync(); return (preferences, store); } @@ -155,7 +155,7 @@ void main() { SharedPreferencesAsync preferences, FakeSharedPreferencesAsync store, ) = getPreferences(); - const String key = 'testKey'; + const key = 'testKey'; await preferences.remove(key); expect( store.log, @@ -208,7 +208,7 @@ void main() { test('containsKey', () async { final (SharedPreferencesAsync preferences, _) = getPreferences(); - const String key = 'testKey'; + const key = 'testKey'; expect(false, await preferences.containsKey(key)); @@ -274,8 +274,8 @@ void main() { ) > getPreferences() async { - final Map cache = {}; - final FakeSharedPreferencesAsync store = FakeSharedPreferencesAsync(); + final cache = {}; + final store = FakeSharedPreferencesAsync(); SharedPreferencesAsyncPlatform.instance = store; final SharedPreferencesWithCache preferences = await SharedPreferencesWithCache.create( @@ -381,7 +381,7 @@ void main() { test('containsKey', () async { final (SharedPreferencesWithCache preferences, _, _) = await getPreferences(); - const String key = 'testKey'; + const key = 'testKey'; expect(false, preferences.containsKey(key)); @@ -416,7 +416,7 @@ void main() { FakeSharedPreferencesAsync store, _, ) = await getPreferences(); - const String key = 'testKey'; + const key = 'testKey'; await preferences.remove(key); expect( store.log, @@ -463,8 +463,8 @@ void main() { ) > getPreferences() async { - final Map cache = {}; - final FakeSharedPreferencesAsync store = FakeSharedPreferencesAsync(); + final cache = {}; + final store = FakeSharedPreferencesAsync(); SharedPreferencesAsyncPlatform.instance = store; final SharedPreferencesWithCache preferences = await SharedPreferencesWithCache.create( @@ -577,7 +577,7 @@ void main() { test('throws ArgumentError if key is not included in filter', () async { final (SharedPreferencesWithCache preferences, _, _) = await getPreferences(); - const String key = 'testKey'; + const key = 'testKey'; expect( () async => preferences.setString(key, 'test'), diff --git a/packages/shared_preferences/shared_preferences/test/shared_preferences_devtools_extension_data_test.dart b/packages/shared_preferences/shared_preferences/test/shared_preferences_devtools_extension_data_test.dart index 61358cd521d..4e9813c7c4d 100644 --- a/packages/shared_preferences/shared_preferences/test/shared_preferences_devtools_extension_data_test.dart +++ b/packages/shared_preferences/shared_preferences/test/shared_preferences_devtools_extension_data_test.dart @@ -62,7 +62,7 @@ void main() { String key, { required Map expectedData, }) async { - const bool legacy = false; + const legacy = false; await extension.requestValue(key, legacy); @@ -74,8 +74,8 @@ void main() { } test('should request bool value from async api', () async { - const String key = 'key'; - const bool expectedValue = true; + const key = 'key'; + const expectedValue = true; await asyncPreferences.setBool(key, expectedValue); await testAsyncApiRequestValue( @@ -88,8 +88,8 @@ void main() { }); test('should request int value from async api', () async { - const String key = 'key'; - const int expectedValue = 42; + const key = 'key'; + const expectedValue = 42; await asyncPreferences.setInt(key, expectedValue); await testAsyncApiRequestValue( @@ -102,8 +102,8 @@ void main() { }); test('should request double value from async api', () async { - const String key = 'key'; - const double expectedValue = 42.2; + const key = 'key'; + const expectedValue = 42.2; await asyncPreferences.setDouble(key, expectedValue); await testAsyncApiRequestValue( @@ -116,8 +116,8 @@ void main() { }); test('should request string value from async api', () async { - const String key = 'key'; - const String expectedValue = 'value'; + const key = 'key'; + const expectedValue = 'value'; await asyncPreferences.setString(key, expectedValue); await testAsyncApiRequestValue( @@ -130,8 +130,8 @@ void main() { }); test('should request string list value from async api', () async { - const String key = 'key'; - const List expectedValue = ['string1', 'string2']; + const key = 'key'; + const expectedValue = ['string1', 'string2']; await asyncPreferences.setStringList(key, expectedValue); await testAsyncApiRequestValue( @@ -147,7 +147,7 @@ void main() { String key, Object expectedValue, ) async { - const bool legacy = false; + const legacy = false; await extension.requestValueChange( key, @@ -164,8 +164,8 @@ void main() { } test('should request int value change on async api', () async { - const String key = 'key'; - const int expectedValue = 42; + const key = 'key'; + const expectedValue = 42; await asyncPreferences.setInt(key, 24); await testAsyncApiValueChange(key, expectedValue); @@ -174,8 +174,8 @@ void main() { }); test('should request bool value change on async api', () async { - const String key = 'key'; - const bool expectedValue = false; + const key = 'key'; + const expectedValue = false; await asyncPreferences.setBool(key, true); await testAsyncApiValueChange(key, expectedValue); @@ -184,8 +184,8 @@ void main() { }); test('should request double value change on async api', () async { - const String key = 'key'; - const double expectedValue = 22.22; + const key = 'key'; + const expectedValue = 22.22; await asyncPreferences.setDouble(key, 11.1); await testAsyncApiValueChange(key, expectedValue); @@ -194,8 +194,8 @@ void main() { }); test('should request string value change on async api', () async { - const String key = 'key'; - const String expectedValue = 'new value'; + const key = 'key'; + const expectedValue = 'new value'; await asyncPreferences.setString(key, 'old value'); await testAsyncApiValueChange(key, expectedValue); @@ -204,8 +204,8 @@ void main() { }); test('should request string list value change on async api', () async { - const String key = 'key'; - const List expectedValue = ['string1', 'string2']; + const key = 'key'; + const expectedValue = ['string1', 'string2']; await asyncPreferences.setStringList(key, ['old1', 'old2']); await testAsyncApiValueChange(key, expectedValue); @@ -222,7 +222,7 @@ void main() { String key, { required Map expectedData, }) async { - const bool legacy = true; + const legacy = true; await extension.requestValue(key, legacy); @@ -234,8 +234,8 @@ void main() { } test('should request bool value from legacy api', () async { - const String key = 'key'; - const bool expectedValue = false; + const key = 'key'; + const expectedValue = false; SharedPreferences.setMockInitialValues({ key: expectedValue, }); @@ -250,8 +250,8 @@ void main() { }); test('should request int value from legacy api', () async { - const String key = 'key'; - const int expectedValue = 42; + const key = 'key'; + const expectedValue = 42; SharedPreferences.setMockInitialValues({ key: expectedValue, }); @@ -266,8 +266,8 @@ void main() { }); test('should request double value from legacy api', () async { - const String key = 'key'; - const double expectedValue = 42.2; + const key = 'key'; + const expectedValue = 42.2; SharedPreferences.setMockInitialValues({ key: expectedValue, }); @@ -282,8 +282,8 @@ void main() { }); test('should request string value from legacy api', () async { - const String key = 'key'; - const String expectedValue = 'value'; + const key = 'key'; + const expectedValue = 'value'; SharedPreferences.setMockInitialValues({ key: expectedValue, }); @@ -298,8 +298,8 @@ void main() { }); test('should request string list value from legacy api', () async { - const String key = 'key'; - const List expectedValue = ['string1', 'string2']; + const key = 'key'; + const expectedValue = ['string1', 'string2']; SharedPreferences.setMockInitialValues({ key: expectedValue, }); @@ -317,7 +317,7 @@ void main() { String key, Object expectedValue, ) async { - const bool legacy = true; + const legacy = true; await extension.requestValueChange( key, @@ -334,8 +334,8 @@ void main() { } test('should request int value change on legacy api', () async { - const String key = 'key'; - const int expectedValue = 42; + const key = 'key'; + const expectedValue = 42; SharedPreferences.setMockInitialValues({key: 24}); await testLegacyApiValueChange(key, expectedValue); @@ -347,8 +347,8 @@ void main() { }); test('should request bool value change on legacy api', () async { - const String key = 'key'; - const bool expectedValue = false; + const key = 'key'; + const expectedValue = false; SharedPreferences.setMockInitialValues({key: true}); await testLegacyApiValueChange(key, expectedValue); @@ -360,8 +360,8 @@ void main() { }); test('should request double value change on legacy api', () async { - const String key = 'key'; - const double expectedValue = 1.11; + const key = 'key'; + const expectedValue = 1.11; SharedPreferences.setMockInitialValues({key: 2.22}); await testLegacyApiValueChange(key, expectedValue); @@ -373,8 +373,8 @@ void main() { }); test('should request string value change on legacy api', () async { - const String key = 'key'; - const String expectedValue = 'new value'; + const key = 'key'; + const expectedValue = 'new value'; SharedPreferences.setMockInitialValues({ key: 'old value', }); @@ -388,8 +388,8 @@ void main() { }); test('should request string list value change on legacy api', () async { - const String key = 'key'; - const List expectedValue = ['string1', 'string2']; + const key = 'key'; + const expectedValue = ['string1', 'string2']; SharedPreferences.setMockInitialValues({ key: ['old1', 'old2'], }); diff --git a/packages/shared_preferences/shared_preferences/test/shared_preferences_test.dart b/packages/shared_preferences/shared_preferences/test/shared_preferences_test.dart index 6e47281469b..28ffdea7550 100755 --- a/packages/shared_preferences/shared_preferences/test/shared_preferences_test.dart +++ b/packages/shared_preferences/shared_preferences/test/shared_preferences_test.dart @@ -11,12 +11,12 @@ import 'package:shared_preferences_platform_interface/types.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; - const Map testValues = { + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; + const testValues = { 'flutter.String': testString, 'flutter.bool': testBool, 'flutter.int': testInt, @@ -24,12 +24,12 @@ void main() { 'flutter.List': testList, }; - const String testString2 = 'goodbye world'; - const bool testBool2 = false; - const int testInt2 = 1337; - const double testDouble2 = 2.71828; - const List testList2 = ['baz', 'qux']; - const Map testValues2 = { + const testString2 = 'goodbye world'; + const testBool2 = false; + const testInt2 = 1337; + const testDouble2 = 2.71828; + const testList2 = ['baz', 'qux']; + const testValues2 = { 'flutter.String': testString2, 'flutter.bool': testBool2, 'flutter.int': testInt2, @@ -102,7 +102,7 @@ void main() { }); test('removing', () async { - const String key = 'testKey'; + const key = 'testKey'; await preferences.remove(key); expect( store.log, @@ -115,7 +115,7 @@ void main() { }); test('containsKey', () async { - const String key = 'testKey'; + const key = 'testKey'; expect(false, preferences.containsKey(key)); @@ -160,8 +160,8 @@ void main() { }); group('mocking', () { - const String key = 'dummy'; - const String prefixedKey = 'flutter.$key'; + const key = 'dummy'; + const prefixedKey = 'flutter.$key'; test('test 1', () async { SharedPreferences.setMockInitialValues({ @@ -183,7 +183,7 @@ void main() { }); test('writing copy of strings list', () async { - final List myList = []; + final myList = []; await preferences.setStringList('myList', myList); myList.add('foobar'); @@ -213,7 +213,7 @@ void main() { }); test('calling setPrefix after getInstance throws', () async { - const String newPrefix = 'newPrefix'; + const newPrefix = 'newPrefix'; await SharedPreferences.getInstance(); Object? err; @@ -226,7 +226,7 @@ void main() { }); test('using setPrefix allows setting and getting', () async { - const String newPrefix = 'newPrefix'; + const newPrefix = 'newPrefix'; SharedPreferences.resetStatic(); SharedPreferences.setPrefix(newPrefix); @@ -248,7 +248,7 @@ void main() { }); test('allowList only gets allowed items', () async { - const Set allowList = {'stringKey', 'boolKey'}; + const allowList = {'stringKey', 'boolKey'}; SharedPreferences.resetStatic(); SharedPreferences.setPrefix('', allowList: allowList); @@ -272,7 +272,7 @@ void main() { }); test('using reload after setPrefix properly reloads the cache', () async { - const String newPrefix = 'newPrefix'; + const newPrefix = 'newPrefix'; SharedPreferences.resetStatic(); SharedPreferences.setPrefix(newPrefix); @@ -290,7 +290,7 @@ void main() { }); test('unimplemented errors in withParameters methods are updated', () async { - final UnimplementedSharedPreferencesStore localStore = + final localStore = UnimplementedSharedPreferencesStore(); SharedPreferencesStorePlatform.instance = localStore; SharedPreferences.resetStatic(); @@ -312,7 +312,7 @@ void main() { test( 'non-Unimplemented errors pass through withParameters methods correctly', () async { - final ThrowingSharedPreferencesStore localStore = + final localStore = ThrowingSharedPreferencesStore(); SharedPreferencesStorePlatform.instance = localStore; SharedPreferences.resetStatic(); diff --git a/packages/shared_preferences/shared_preferences_android/example/integration_test/shared_preferences_test.dart b/packages/shared_preferences/shared_preferences_android/example/integration_test/shared_preferences_test.dart index f264f955742..c4cb2599246 100644 --- a/packages/shared_preferences/shared_preferences_android/example/integration_test/shared_preferences_test.dart +++ b/packages/shared_preferences/shared_preferences_android/example/integration_test/shared_preferences_test.dart @@ -15,7 +15,7 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('SharedPreferencesAndroid', () { - const Map flutterTestValues = { + const flutterTestValues = { 'flutter.String': 'hello world', 'flutter.Bool': true, 'flutter.Int': 42, @@ -23,7 +23,7 @@ void main() { 'flutter.StringList': ['foo', 'bar'], }; - const Map prefixTestValues = { + const prefixTestValues = { 'prefix.String': 'hello world', 'prefix.Bool': true, 'prefix.Int': 42, @@ -31,7 +31,7 @@ void main() { 'prefix.StringList': ['foo', 'bar'], }; - const Map nonPrefixTestValues = { + const nonPrefixTestValues = { 'String': 'hello world', 'Bool': true, 'Int': 42, @@ -39,7 +39,7 @@ void main() { 'StringList': ['foo', 'bar'], }; - final Map allTestValues = {}; + final allTestValues = {}; allTestValues.addAll(flutterTestValues); allTestValues.addAll(prefixTestValues); @@ -532,7 +532,7 @@ void main() { }); testWidgets('remove', (WidgetTester _) async { - const String key = 'testKey'; + const key = 'testKey'; await preferences.setValue( 'String', key, @@ -593,9 +593,9 @@ void main() { }); testWidgets('simultaneous writes', (WidgetTester _) async { - final List> writes = >[]; - const int writeCount = 100; - for (int i = 1; i <= writeCount; i++) { + final writes = >[]; + const writeCount = 100; + for (var i = 1; i <= writeCount; i++) { writes.add(preferences.setValue('Int', 'Int', i)); } final List result = await Future.wait(writes, eagerError: true); @@ -609,21 +609,21 @@ void main() { }); testWidgets('string clash with lists and doubles', (WidgetTester _) async { - const String key = 'aKey'; - const String value = 'a string value'; + const key = 'aKey'; + const value = 'a string value'; await preferences.clearWithParameters( ClearParameters(filter: PreferencesFilter(prefix: '')), ); // Special prefixes used to store datatypes that can't be stored directly // in SharedPreferences as strings instead. - const List specialPrefixes = [ + const specialPrefixes = [ // Prefix for lists: 'VGhpcyBpcyB0aGUgcHJlZml4IGZvciBhIGxpc3Qu', // Prefix for doubles: 'VGhpcyBpcyB0aGUgcHJlZml4IGZvciBEb3VibGUu', ]; - for (final String prefix in specialPrefixes) { + for (final prefix in specialPrefixes) { expect( preferences.setValue('String', key, prefix + value), throwsA(isA()), @@ -677,17 +677,17 @@ void main() { ); }); - const String stringKey = 'testString'; - const String boolKey = 'testBool'; - const String intKey = 'testInt'; - const String doubleKey = 'testDouble'; - const String listKey = 'testList'; + const stringKey = 'testString'; + const boolKey = 'testBool'; + const intKey = 'testInt'; + const doubleKey = 'testDouble'; + const listKey = 'testList'; - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; SharedPreferencesAsyncAndroidOptions getOptions({ required bool useDataStore, @@ -721,7 +721,7 @@ void main() { void runAsyncTests(bool useDataStore) { group('shared_preferences_async', () { - final String backend = useDataStore ? 'DataStore' : 'SharedPreferences'; + final backend = useDataStore ? 'DataStore' : 'SharedPreferences'; testWidgets('set and get String with $backend', (WidgetTester _) async { final SharedPreferencesAsyncAndroidOptions options = getOptions( @@ -998,7 +998,7 @@ void main() { useDataStore: useDataStore, fileName: 'notDefault', ); - final SharedPreferencesAsyncAndroid preferences = + final preferences = getPreferences() as SharedPreferencesAsyncAndroid; await clearPreferences(preferences, options); final SharedPreferencesPigeonOptions pigeonOptions = preferences @@ -1026,7 +1026,7 @@ void main() { useDataStore: useDataStore, fileName: 'notDefault', ); - final SharedPreferencesAsyncAndroid preferences = + final preferences = getPreferences() as SharedPreferencesAsyncAndroid; await clearPreferences(preferences, options); await Future.wait(>[ @@ -1057,7 +1057,7 @@ void main() { useDataStore: useDataStore, fileName: 'notDefault', ); - final SharedPreferencesAsyncAndroid preferences = + final preferences = getPreferences() as SharedPreferencesAsyncAndroid; await clearPreferences(preferences, options); await Future.wait(>[ diff --git a/packages/shared_preferences/shared_preferences_android/lib/src/shared_preferences_async_android.dart b/packages/shared_preferences/shared_preferences_android/lib/src/shared_preferences_async_android.dart index bb67fcaf635..866b33f3d83 100644 --- a/packages/shared_preferences/shared_preferences_android/lib/src/shared_preferences_async_android.dart +++ b/packages/shared_preferences/shared_preferences_android/lib/src/shared_preferences_async_android.dart @@ -142,7 +142,7 @@ base class SharedPreferencesAsyncAndroid final SharedPreferencesPigeonOptions pigeonOptions = convertOptionsToPigeonOptions(options); final SharedPreferencesAsyncApi api = getApiForBackend(pigeonOptions); - final String stringValue = '$jsonListPrefix${jsonEncode(value)}'; + final stringValue = '$jsonListPrefix${jsonEncode(value)}'; return api.setString(key, stringValue, pigeonOptions); } diff --git a/packages/shared_preferences/shared_preferences_android/test/shared_preferences_android_test.dart b/packages/shared_preferences/shared_preferences_android/test/shared_preferences_android_test.dart index 1fe35c407cb..f9e26f08946 100644 --- a/packages/shared_preferences/shared_preferences_android/test/shared_preferences_android_test.dart +++ b/packages/shared_preferences/shared_preferences_android/test/shared_preferences_android_test.dart @@ -17,7 +17,7 @@ void main() { late _FakeSharedPreferencesApi api; late SharedPreferencesAndroid plugin; - const Map flutterTestValues = { + const flutterTestValues = { 'flutter.String': 'hello world', 'flutter.Bool': true, 'flutter.Int': 42, @@ -25,7 +25,7 @@ void main() { 'flutter.StringList': ['foo', 'bar'], }; - const Map prefixTestValues = { + const prefixTestValues = { 'prefix.String': 'hello world', 'prefix.Bool': true, 'prefix.Int': 42, @@ -33,7 +33,7 @@ void main() { 'prefix.StringList': ['foo', 'bar'], }; - const Map nonPrefixTestValues = { + const nonPrefixTestValues = { 'String': 'hello world', 'Bool': true, 'Int': 42, @@ -41,16 +41,16 @@ void main() { 'StringList': ['foo', 'bar'], }; - final Map allTestValuesForComparison = {}; + final allTestValuesForComparison = {}; allTestValuesForComparison.addAll(flutterTestValues); allTestValuesForComparison.addAll(prefixTestValues); allTestValuesForComparison.addAll(nonPrefixTestValues); - final Map allTestValuesForAddingDirectlyToCache = + final allTestValuesForAddingDirectlyToCache = {...allTestValuesForComparison}; - final String encodedListStringValue = + final encodedListStringValue = '$jsonListPrefix${jsonEncode(['foo', 'bar'])}'; allTestValuesForAddingDirectlyToCache['flutter.StringList'] = encodedListStringValue; @@ -266,7 +266,7 @@ class _FakeSharedPreferencesApi implements SharedPreferencesApi { if (allowList != null) { allowSet = Set.from(allowList); } - final Map filteredItems = { + final filteredItems = { for (final String key in items.keys) if (key.startsWith(prefix) && (allowSet == null || allowSet.contains(key))) diff --git a/packages/shared_preferences/shared_preferences_android/test/shared_preferences_async_test.dart b/packages/shared_preferences/shared_preferences_android/test/shared_preferences_async_test.dart index 84392f227e5..f2fcc81f242 100755 --- a/packages/shared_preferences/shared_preferences_android/test/shared_preferences_async_test.dart +++ b/packages/shared_preferences/shared_preferences_android/test/shared_preferences_async_test.dart @@ -16,21 +16,21 @@ import 'package:shared_preferences_platform_interface/types.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - const String stringKey = 'testString'; - const String boolKey = 'testBool'; - const String intKey = 'testInt'; - const String doubleKey = 'testDouble'; - const String listKey = 'testList'; - - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; + const stringKey = 'testString'; + const boolKey = 'testBool'; + const intKey = 'testInt'; + const doubleKey = 'testDouble'; + const listKey = 'testList'; + + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; SharedPreferencesAsyncAndroid getPreferences(bool useDataStore) { - final _FakeSharedPreferencesApi api = _FakeSharedPreferencesApi(); - final SharedPreferencesAsyncAndroid preferences = + final api = _FakeSharedPreferencesApi(); + final preferences = SharedPreferencesAsyncAndroid( dataStoreApi: api, sharedPreferencesApi: api, @@ -40,9 +40,9 @@ void main() { } void runTests(bool useDataStore) { - final String backend = useDataStore ? 'DataStore' : 'SharedPreferences'; + final backend = useDataStore ? 'DataStore' : 'SharedPreferences'; - final SharedPreferencesAsyncAndroidOptions emptyOptions = + final emptyOptions = SharedPreferencesAsyncAndroidOptions( backend: useDataStore ? SharedPreferencesAndroidBackendLibrary.DataStore @@ -276,7 +276,7 @@ class _FakeSharedPreferencesApi implements SharedPreferencesAsyncApi { List? allowList, SharedPreferencesPigeonOptions options, ) async { - final Map filteredItems = {...items}; + final filteredItems = {...items}; if (allowList != null) { filteredItems.removeWhere((String key, _) => !allowList.contains(key)); } diff --git a/packages/shared_preferences/shared_preferences_foundation/example/integration_test/shared_preferences_test.dart b/packages/shared_preferences/shared_preferences_foundation/example/integration_test/shared_preferences_test.dart index 637376ff0eb..0377a5d956c 100644 --- a/packages/shared_preferences/shared_preferences_foundation/example/integration_test/shared_preferences_test.dart +++ b/packages/shared_preferences/shared_preferences_foundation/example/integration_test/shared_preferences_test.dart @@ -13,7 +13,7 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('SharedPreferencesAsyncFoundation', () { - const Map flutterTestValues = { + const flutterTestValues = { 'flutter.String': 'hello world', 'flutter.Bool': true, 'flutter.Int': 42, @@ -21,7 +21,7 @@ void main() { 'flutter.StringList': ['foo', 'bar'], }; - const Map prefixTestValues = { + const prefixTestValues = { 'prefix.String': 'hello world', 'prefix.Bool': true, 'prefix.Int': 42, @@ -29,7 +29,7 @@ void main() { 'prefix.StringList': ['foo', 'bar'], }; - const Map nonPrefixTestValues = { + const nonPrefixTestValues = { 'String': 'hello world', 'Bool': true, 'Int': 42, @@ -37,7 +37,7 @@ void main() { 'StringList': ['foo', 'bar'], }; - final Map allTestValues = {}; + final allTestValues = {}; allTestValues.addAll(flutterTestValues); allTestValues.addAll(prefixTestValues); @@ -566,7 +566,7 @@ void main() { }); testWidgets('remove', (WidgetTester _) async { - const String key = 'testKey'; + const key = 'testKey'; await preferences.setValue( 'String', key, @@ -627,9 +627,9 @@ void main() { }); testWidgets('simultaneous writes', (WidgetTester _) async { - final List> writes = >[]; - const int writeCount = 100; - for (int i = 1; i <= writeCount; i++) { + final writes = >[]; + const writeCount = 100; + for (var i = 1; i <= writeCount; i++) { writes.add(preferences.setValue('Int', 'Int', i)); } final List result = await Future.wait(writes, eagerError: true); @@ -644,24 +644,24 @@ void main() { }); group('shared_preferences_async', () { - final SharedPreferencesAsyncFoundationOptions emptyOptions = + final emptyOptions = SharedPreferencesAsyncFoundationOptions(); - final SharedPreferencesAsyncFoundationOptions optionsWithSuiteName = + final optionsWithSuiteName = SharedPreferencesAsyncFoundationOptions( suiteName: 'group.example.sharedPreferencesFoundation', ); - const String stringKey = 'testString'; - const String boolKey = 'testBool'; - const String intKey = 'testInt'; - const String doubleKey = 'testDouble'; - const String listKey = 'testList'; - - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; + const stringKey = 'testString'; + const boolKey = 'testBool'; + const intKey = 'testInt'; + const doubleKey = 'testDouble'; + const listKey = 'testList'; + + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; Future getPreferences() async { final SharedPreferencesAsyncPlatform preferences = diff --git a/packages/shared_preferences/shared_preferences_foundation/test/shared_preferences_async_foundation_test.dart b/packages/shared_preferences/shared_preferences_foundation/test/shared_preferences_async_foundation_test.dart index d8212efe5c5..d21f3a5dd64 100644 --- a/packages/shared_preferences/shared_preferences_foundation/test/shared_preferences_async_foundation_test.dart +++ b/packages/shared_preferences/shared_preferences_foundation/test/shared_preferences_async_foundation_test.dart @@ -11,24 +11,24 @@ import 'package:shared_preferences_platform_interface/types.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - const String stringKey = 'testString'; - const String boolKey = 'testBool'; - const String intKey = 'testInt'; - const String doubleKey = 'testDouble'; - const String listKey = 'testList'; - - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; - - final SharedPreferencesAsyncFoundationOptions emptyOptions = + const stringKey = 'testString'; + const boolKey = 'testBool'; + const intKey = 'testInt'; + const doubleKey = 'testDouble'; + const listKey = 'testList'; + + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; + + final emptyOptions = SharedPreferencesAsyncFoundationOptions(); SharedPreferencesAsyncFoundation getPreferences() { - final _FakeSharedPreferencesApi api = _FakeSharedPreferencesApi(); - final SharedPreferencesAsyncFoundation preferences = + final api = _FakeSharedPreferencesApi(); + final preferences = SharedPreferencesAsyncFoundation(api: api); return preferences; @@ -224,7 +224,7 @@ class _FakeSharedPreferencesApi implements UserDefaultsApi { List? allowList, SharedPreferencesPigeonOptions options, ) async { - final Map filteredItems = {...items}; + final filteredItems = {...items}; if (allowList != null) { filteredItems.removeWhere((String key, _) => !allowList.contains(key)); } diff --git a/packages/shared_preferences/shared_preferences_foundation/test/shared_preferences_foundation_test.dart b/packages/shared_preferences/shared_preferences_foundation/test/shared_preferences_foundation_test.dart index 6b3945f2ce6..e11211c3b61 100644 --- a/packages/shared_preferences/shared_preferences_foundation/test/shared_preferences_foundation_test.dart +++ b/packages/shared_preferences/shared_preferences_foundation/test/shared_preferences_foundation_test.dart @@ -73,7 +73,7 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); late _MockSharedPreferencesApi api; - const Map flutterTestValues = { + const flutterTestValues = { 'flutter.String': 'hello world', 'flutter.Bool': true, 'flutter.Int': 42, @@ -81,7 +81,7 @@ void main() { 'flutter.StringList': ['foo', 'bar'], }; - const Map prefixTestValues = { + const prefixTestValues = { 'prefix.String': 'hello world', 'prefix.Bool': true, 'prefix.Int': 42, @@ -89,7 +89,7 @@ void main() { 'prefix.StringList': ['foo', 'bar'], }; - const Map nonPrefixTestValues = { + const nonPrefixTestValues = { 'String': 'hello world', 'Bool': true, 'Int': 42, @@ -97,7 +97,7 @@ void main() { 'StringList': ['foo', 'bar'], }; - final Map allTestValues = {}; + final allTestValues = {}; allTestValues.addAll(flutterTestValues); allTestValues.addAll(prefixTestValues); @@ -116,7 +116,7 @@ void main() { }); test('remove', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); api.items['flutter.hi'] = 'world'; @@ -125,7 +125,7 @@ void main() { }); test('clear', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); api.items['flutter.hi'] = 'world'; @@ -134,7 +134,7 @@ void main() { }); test('clearWithPrefix', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); for (final String key in allTestValues.keys) { @@ -151,7 +151,7 @@ void main() { }); test('clearWithParameters', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); for (final String key in allTestValues.keys) { @@ -174,7 +174,7 @@ void main() { }); test('clearWithParameters with allow list', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); for (final String key in allTestValues.keys) { @@ -202,7 +202,7 @@ void main() { }); test('getAll', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); for (final String key in flutterTestValues.keys) { @@ -214,7 +214,7 @@ void main() { }); test('getAllWithPrefix', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); for (final String key in allTestValues.keys) { @@ -226,7 +226,7 @@ void main() { }); test('getAllWithParameters', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); for (final String key in allTestValues.keys) { @@ -240,7 +240,7 @@ void main() { }); test('getAllWithParameters with allow list', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); for (final String key in allTestValues.keys) { @@ -259,7 +259,7 @@ void main() { }); test('setValue', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); expect(await plugin.setValue('Bool', 'flutter.Bool', true), isTrue); @@ -278,7 +278,7 @@ void main() { }); test('setValue with unsupported type', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); expect(() async { @@ -287,7 +287,7 @@ void main() { }); test('getAllWithNoPrefix', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); for (final String key in allTestValues.keys) { @@ -299,7 +299,7 @@ void main() { }); test('clearWithNoPrefix', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); for (final String key in allTestValues.keys) { @@ -314,7 +314,7 @@ void main() { }); test('getAllWithNoPrefix with param', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); for (final String key in allTestValues.keys) { @@ -328,7 +328,7 @@ void main() { }); test('clearWithNoPrefix with param', () async { - final SharedPreferencesFoundation plugin = SharedPreferencesFoundation( + final plugin = SharedPreferencesFoundation( api: api, ); for (final String key in allTestValues.keys) { diff --git a/packages/shared_preferences/shared_preferences_linux/example/integration_test/shared_preferences_test.dart b/packages/shared_preferences/shared_preferences_linux/example/integration_test/shared_preferences_test.dart index 1a541c37528..956b30280bd 100644 --- a/packages/shared_preferences/shared_preferences_linux/example/integration_test/shared_preferences_test.dart +++ b/packages/shared_preferences/shared_preferences_linux/example/integration_test/shared_preferences_test.dart @@ -14,7 +14,7 @@ void main() { group('SharedPreferencesLinux', () { late SharedPreferencesLinux preferences; - const Map flutterTestValues = { + const flutterTestValues = { 'flutter.String': 'hello world', 'flutter.Bool': true, 'flutter.Int': 42, @@ -22,7 +22,7 @@ void main() { 'flutter.StringList': ['foo', 'bar'], }; - const Map prefixTestValues = { + const prefixTestValues = { 'prefix.String': 'hello world', 'prefix.Bool': true, 'prefix.Int': 42, @@ -30,7 +30,7 @@ void main() { 'prefix.StringList': ['foo', 'bar'], }; - const Map nonPrefixTestValues = { + const nonPrefixTestValues = { 'String': 'hello world', 'Bool': true, 'Int': 42, @@ -38,7 +38,7 @@ void main() { 'StringList': ['foo', 'bar'], }; - final Map allTestValues = {}; + final allTestValues = {}; allTestValues.addAll(flutterTestValues); allTestValues.addAll(prefixTestValues); @@ -128,7 +128,7 @@ void main() { group('withPrefix', () { testWidgets('remove', (WidgetTester _) async { - const String key = 'flutter.String'; + const key = 'flutter.String'; await preferences.remove(key); final Map values = await preferences.getAllWithPrefix( '', @@ -217,7 +217,7 @@ void main() { group('withParameters', () { testWidgets('remove', (WidgetTester _) async { - const String key = 'flutter.String'; + const key = 'flutter.String'; await preferences.remove(key); final Map values = await preferences .getAllWithParameters( @@ -366,20 +366,20 @@ void main() { }); group('shared_preferences_async', () { - const SharedPreferencesLinuxOptions emptyOptions = + const emptyOptions = SharedPreferencesLinuxOptions(); - const String stringKey = 'testString'; - const String boolKey = 'testBool'; - const String intKey = 'testInt'; - const String doubleKey = 'testDouble'; - const String listKey = 'testList'; - - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; + const stringKey = 'testString'; + const boolKey = 'testBool'; + const intKey = 'testInt'; + const doubleKey = 'testDouble'; + const listKey = 'testList'; + + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; Future getPreferences({ bool clear = true, diff --git a/packages/shared_preferences/shared_preferences_linux/lib/shared_preferences_linux.dart b/packages/shared_preferences/shared_preferences_linux/lib/shared_preferences_linux.dart index b9765df9620..fee06000c26 100644 --- a/packages/shared_preferences/shared_preferences_linux/lib/shared_preferences_linux.dart +++ b/packages/shared_preferences/shared_preferences_linux/lib/shared_preferences_linux.dart @@ -107,7 +107,7 @@ class SharedPreferencesLinux extends SharedPreferencesStorePlatform { GetAllParameters parameters, ) async { final PreferencesFilter filter = parameters.filter; - final Map withPrefix = Map.from( + final withPrefix = Map.from( await _readPreferences(), ); withPrefix.removeWhere( @@ -294,7 +294,7 @@ base class SharedPreferencesAsyncLinux extends SharedPreferencesAsyncPlatform { ) async { final SharedPreferencesLinuxOptions linuxOptions = SharedPreferencesLinuxOptions.fromSharedPreferencesOptions(options); - final Map prefs = Map.from( + final prefs = Map.from( await _readPreferences(linuxOptions.fileName), ); prefs.removeWhere((String key, _) => !(allowList?.contains(key) ?? true)); @@ -353,7 +353,7 @@ Future> _reload( FileSystem fs = const LocalFileSystem(), PathProviderLinux? pathProvider, }) async { - Map preferences = {}; + var preferences = {}; final File? localDataFile = await _getLocalDataFile( fileName, fs: fs, diff --git a/packages/shared_preferences/shared_preferences_linux/test/legacy_shared_preferences_linux_test.dart b/packages/shared_preferences/shared_preferences_linux/test/legacy_shared_preferences_linux_test.dart index 6aa225d7076..08e303bd371 100644 --- a/packages/shared_preferences/shared_preferences_linux/test/legacy_shared_preferences_linux_test.dart +++ b/packages/shared_preferences/shared_preferences_linux/test/legacy_shared_preferences_linux_test.dart @@ -19,7 +19,7 @@ void main() { SharedPreferencesLinux.registerWith(); - const Map flutterTestValues = { + const flutterTestValues = { 'flutter.String': 'hello world', 'flutter.Bool': true, 'flutter.Int': 42, @@ -27,7 +27,7 @@ void main() { 'flutter.StringList': ['foo', 'bar'], }; - const Map prefixTestValues = { + const prefixTestValues = { 'prefix.String': 'hello world', 'prefix.Bool': true, 'prefix.Int': 42, @@ -35,7 +35,7 @@ void main() { 'prefix.StringList': ['foo', 'bar'], }; - const Map nonPrefixTestValues = { + const nonPrefixTestValues = { 'String': 'hello world', 'Bool': true, 'Int': 42, @@ -43,7 +43,7 @@ void main() { 'StringList': ['foo', 'bar'], }; - final Map allTestValues = {}; + final allTestValues = {}; allTestValues.addAll(flutterTestValues); allTestValues.addAll(prefixTestValues); @@ -70,7 +70,7 @@ void main() { } SharedPreferencesLinux getPreferences() { - final SharedPreferencesLinux prefs = SharedPreferencesLinux(); + final prefs = SharedPreferencesLinux(); prefs.fs = fs; prefs.pathProvider = pathProvider; return prefs; diff --git a/packages/shared_preferences/shared_preferences_linux/test/shared_preferences_linux_async_test.dart b/packages/shared_preferences/shared_preferences_linux/test/shared_preferences_linux_async_test.dart index a99feb230b0..e34c69ca19e 100755 --- a/packages/shared_preferences/shared_preferences_linux/test/shared_preferences_linux_async_test.dart +++ b/packages/shared_preferences/shared_preferences_linux/test/shared_preferences_linux_async_test.dart @@ -16,19 +16,19 @@ void main() { SharedPreferencesAsyncLinux.registerWith(); - const String stringKey = 'testString'; - const String boolKey = 'testBool'; - const String intKey = 'testInt'; - const String doubleKey = 'testDouble'; - const String listKey = 'testList'; - - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; - - const SharedPreferencesLinuxOptions emptyOptions = + const stringKey = 'testString'; + const boolKey = 'testBool'; + const intKey = 'testInt'; + const doubleKey = 'testDouble'; + const listKey = 'testList'; + + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; + + const emptyOptions = SharedPreferencesLinuxOptions(); setUp(() { @@ -37,7 +37,7 @@ void main() { }); SharedPreferencesAsyncLinux getPreferences() { - final SharedPreferencesAsyncLinux prefs = SharedPreferencesAsyncLinux(); + final prefs = SharedPreferencesAsyncLinux(); prefs.fs = fs; prefs.pathProvider = pathProvider; return prefs; diff --git a/packages/shared_preferences/shared_preferences_platform_interface/lib/in_memory_shared_preferences_async.dart b/packages/shared_preferences/shared_preferences_platform_interface/lib/in_memory_shared_preferences_async.dart index 2bc65b3dd0c..54ae0c66331 100644 --- a/packages/shared_preferences/shared_preferences_platform_interface/lib/in_memory_shared_preferences_async.dart +++ b/packages/shared_preferences/shared_preferences_platform_interface/lib/in_memory_shared_preferences_async.dart @@ -41,7 +41,7 @@ base class InMemorySharedPreferencesAsync SharedPreferencesOptions options, ) async { final PreferencesFilters filter = parameters.filter; - final Map preferences = Map.from(_data); + final preferences = Map.from(_data); preferences.removeWhere( (String key, _) => filter.allowList != null && !filter.allowList!.contains(key), @@ -134,7 +134,7 @@ base class InMemorySharedPreferencesAsync String key, SharedPreferencesOptions options, ) async { - final List? data = _data[key] as List?; + final data = _data[key] as List?; return data?.cast(); } diff --git a/packages/shared_preferences/shared_preferences_platform_interface/lib/shared_preferences_platform_interface.dart b/packages/shared_preferences/shared_preferences_platform_interface/lib/shared_preferences_platform_interface.dart index 5b0c4abc351..c5b86042b6f 100644 --- a/packages/shared_preferences/shared_preferences_platform_interface/lib/shared_preferences_platform_interface.dart +++ b/packages/shared_preferences/shared_preferences_platform_interface/lib/shared_preferences_platform_interface.dart @@ -163,7 +163,7 @@ class InMemorySharedPreferencesStore extends SharedPreferencesStorePlatform { GetAllParameters parameters, ) async { final PreferencesFilter filter = parameters.filter; - final Map preferences = Map.from(_data); + final preferences = Map.from(_data); preferences.removeWhere( (String key, _) => !key.startsWith(filter.prefix) || diff --git a/packages/shared_preferences/shared_preferences_platform_interface/test/deprecated_method_channel_shared_preferences_test.dart b/packages/shared_preferences/shared_preferences_platform_interface/test/deprecated_method_channel_shared_preferences_test.dart index 72230f728cb..b119a59aad4 100644 --- a/packages/shared_preferences/shared_preferences_platform_interface/test/deprecated_method_channel_shared_preferences_test.dart +++ b/packages/shared_preferences/shared_preferences_platform_interface/test/deprecated_method_channel_shared_preferences_test.dart @@ -12,11 +12,11 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); group(MethodChannelSharedPreferencesStore, () { - const MethodChannel channel = MethodChannel( + const channel = MethodChannel( 'plugins.flutter.io/shared_preferences', ); - const Map flutterTestValues = { + const flutterTestValues = { 'flutter.String': 'hello world', 'flutter.Bool': true, 'flutter.Int': 42, @@ -24,7 +24,7 @@ void main() { 'flutter.StringList': ['foo', 'bar'], }; - const Map prefixTestValues = { + const prefixTestValues = { 'prefix.String': 'hello world', 'prefix.Bool': true, 'prefix.Int': 42, @@ -32,7 +32,7 @@ void main() { 'prefix.StringList': ['foo', 'bar'], }; - const Map nonPrefixTestValues = { + const nonPrefixTestValues = { 'String': 'hello world', 'Bool': true, 'Int': 42, @@ -40,7 +40,7 @@ void main() { 'StringList': ['foo', 'bar'], }; - final Map allTestValues = {}; + final allTestValues = {}; allTestValues.addAll(flutterTestValues); allTestValues.addAll(prefixTestValues); @@ -48,7 +48,7 @@ void main() { late InMemorySharedPreferencesStore testData; - final List log = []; + final log = []; late MethodChannelSharedPreferencesStore store; setUp(() async { @@ -69,9 +69,9 @@ void main() { final Map arguments = getArgumentDictionary( methodCall, ); - final String prefix = arguments['prefix']! as String; + final prefix = arguments['prefix']! as String; Set? allowSet; - final List? allowList = + final allowList = arguments['allowList'] as List?; if (allowList != null) { allowSet = {}; @@ -92,7 +92,7 @@ void main() { final Map arguments = getArgumentDictionary( methodCall, ); - final String key = arguments['key']! as String; + final key = arguments['key']! as String; return testData.remove(key); } if (methodCall.method == 'clear') { @@ -102,9 +102,9 @@ void main() { final Map arguments = getArgumentDictionary( methodCall, ); - final String prefix = arguments['prefix']! as String; + final prefix = arguments['prefix']! as String; Set? allowSet; - final List? allowList = + final allowList = arguments['allowList'] as List?; if (allowList != null) { allowSet = {}; @@ -121,14 +121,14 @@ void main() { ), ); } - final RegExp setterRegExp = RegExp(r'set(.*)'); + final setterRegExp = RegExp(r'set(.*)'); final Match? match = setterRegExp.matchAsPrefix(methodCall.method); if (match?.groupCount == 1) { final String valueType = match!.group(1)!; final Map arguments = getArgumentDictionary( methodCall, ); - final String key = arguments['key']! as String; + final key = arguments['key']! as String; final Object value = arguments['value']!; return testData.setValue(valueType, key, value); } @@ -185,7 +185,7 @@ void main() { }); expect(log, hasLength(4)); - for (final MethodCall call in log) { + for (final call in log) { expect(call.method, 'remove'); } }); diff --git a/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_state_notifier.dart b/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_state_notifier.dart index 6491d3da088..bc1f166cb4d 100644 --- a/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_state_notifier.dart +++ b/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_state_notifier.dart @@ -41,7 +41,7 @@ class SharedPreferencesStateNotifier _legacyKeys = allKeys.legacyKeys; // Platforms other than Android also add the legacy keys to the async keys // in the pattern `flutter.$key`, so we need to remove them to avoid duplicates. - const String legacyPrefix = 'flutter.'; + const legacyPrefix = 'flutter.'; _asyncKeys = [ for (final String key in allKeys.asyncKeys) if (!(key.startsWith(legacyPrefix) && diff --git a/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_state_provider.dart b/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_state_provider.dart index a02cef21c74..04c76c42f2a 100644 --- a/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_state_provider.dart +++ b/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_state_provider.dart @@ -220,12 +220,12 @@ class _SharedPreferencesStateProviderState void initState() { super.initState(); final VmService service = serviceManager.service!; - final EvalOnDartLibrary extensionEval = EvalOnDartLibrary( + final extensionEval = EvalOnDartLibrary( 'package:shared_preferences/src/shared_preferences_devtools_extension_data.dart', service, serviceManager: serviceManager, ); - final SharedPreferencesToolEval toolEval = SharedPreferencesToolEval( + final toolEval = SharedPreferencesToolEval( service, extensionEval, ); diff --git a/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_tool_eval.dart b/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_tool_eval.dart index 2e47a0c1702..909051ecfb9 100644 --- a/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_tool_eval.dart +++ b/packages/shared_preferences/shared_preferences_tool/lib/src/shared_preferences_tool_eval.dart @@ -58,7 +58,7 @@ class SharedPreferencesToolEval { required String eventKind, Disposable? isAlive, }) async { - final Completer> completer = + final completer = Completer>(); late final StreamSubscription streamSubscription; diff --git a/packages/shared_preferences/shared_preferences_tool/lib/src/ui/keys_panel.dart b/packages/shared_preferences/shared_preferences_tool/lib/src/ui/keys_panel.dart index 361a6f89758..bf9ef5b5b43 100644 --- a/packages/shared_preferences/shared_preferences_tool/lib/src/ui/keys_panel.dart +++ b/packages/shared_preferences/shared_preferences_tool/lib/src/ui/keys_panel.dart @@ -225,7 +225,7 @@ class _KeyItem extends StatelessWidget { Widget build(BuildContext context) { final SelectedSharedPreferencesKey? selectedKey = SharedPreferencesStateProvider.selectedKeyOf(context); - final bool isSelected = selectedKey?.key == keyName; + final isSelected = selectedKey?.key == keyName; final ColorScheme colorScheme = Theme.of(context).colorScheme; final Color? backgroundColor = isSelected ? colorScheme.selectedRowBackgroundColor diff --git a/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_state_notifier_test.dart b/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_state_notifier_test.dart index d89cea2e49c..304e358a545 100644 --- a/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_state_notifier_test.dart +++ b/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_state_notifier_test.dart @@ -36,8 +36,8 @@ void main() { }); test('should fetch all keys', () async { - const List asyncKeys = ['key1', 'key2']; - const List legacyKeys = ['key11', 'key22']; + const asyncKeys = ['key1', 'key2']; + const legacyKeys = ['key11', 'key22']; when( evalMock.fetchAllKeys(), ).thenAnswer((_) async => (asyncKeys: asyncKeys, legacyKeys: legacyKeys)); @@ -48,8 +48,8 @@ void main() { }); test('should filter out keys with "flutter." prefix async keys', () async { - const List asyncKeys = ['flutter.key1', 'key2']; - const List legacyKeys = ['key1', 'key3']; + const asyncKeys = ['flutter.key1', 'key2']; + const legacyKeys = ['key1', 'key3']; when( evalMock.fetchAllKeys(), ).thenAnswer((_) async => (asyncKeys: asyncKeys, legacyKeys: legacyKeys)); @@ -60,8 +60,8 @@ void main() { }); test('should select key', () async { - const List keys = ['key1', 'key2']; - const SharedPreferencesData keyValue = SharedPreferencesData.string( + const keys = ['key1', 'key2']; + const keyValue = SharedPreferencesData.string( value: 'value', ); when(evalMock.fetchAllKeys()).thenAnswer( @@ -86,8 +86,8 @@ void main() { }); test('should select key for legacy api', () async { - const List keys = ['key1', 'key2']; - const SharedPreferencesData keyValue = SharedPreferencesData.string( + const keys = ['key1', 'key2']; + const keyValue = SharedPreferencesData.string( value: 'value', ); when(evalMock.fetchAllKeys()).thenAnswer( @@ -115,8 +115,8 @@ void main() { }); test('should filter keys and clear filter', () async { - const List asyncKeys = ['key1', 'key2']; - const List legacyKeys = ['key11', 'key22']; + const asyncKeys = ['key1', 'key2']; + const legacyKeys = ['key11', 'key22']; when( evalMock.fetchAllKeys(), ).thenAnswer((_) async => (asyncKeys: asyncKeys, legacyKeys: legacyKeys)); @@ -132,8 +132,8 @@ void main() { }); test('should start/stop editing', () async { - const List asyncKeys = ['key1', 'key2']; - const List legacyKeys = ['key11', 'key22']; + const asyncKeys = ['key1', 'key2']; + const legacyKeys = ['key11', 'key22']; when( evalMock.fetchAllKeys(), ).thenAnswer((_) async => (asyncKeys: asyncKeys, legacyKeys: legacyKeys)); @@ -148,12 +148,12 @@ void main() { }); test('should change value', () async { - const List asyncKeys = ['key1', 'key2']; - const List legacyKeys = ['key11', 'key22']; + const asyncKeys = ['key1', 'key2']; + const legacyKeys = ['key11', 'key22']; when( evalMock.fetchAllKeys(), ).thenAnswer((_) async => (asyncKeys: asyncKeys, legacyKeys: legacyKeys)); - const SharedPreferencesData keyValue = SharedPreferencesData.string( + const keyValue = SharedPreferencesData.string( value: 'value', ); when( @@ -168,12 +168,12 @@ void main() { }); test('should change value', () async { - const List asyncKeys = ['key1', 'key2']; - const List legacyKeys = ['key11', 'key22']; + const asyncKeys = ['key1', 'key2']; + const legacyKeys = ['key11', 'key22']; when( evalMock.fetchAllKeys(), ).thenAnswer((_) async => (asyncKeys: asyncKeys, legacyKeys: legacyKeys)); - const SharedPreferencesData keyValue = SharedPreferencesData.string( + const keyValue = SharedPreferencesData.string( value: 'value', ); when( @@ -196,8 +196,8 @@ void main() { }); test('should change select legacy api and async api', () async { - const List asyncKeys = ['key1', 'key2']; - const List legacyKeys = ['key11', 'key22']; + const asyncKeys = ['key1', 'key2']; + const legacyKeys = ['key11', 'key22']; when( evalMock.fetchAllKeys(), ).thenAnswer((_) async => (asyncKeys: asyncKeys, legacyKeys: legacyKeys)); diff --git a/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_state_test.dart b/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_state_test.dart index c57c8ddbeae..389ce712a59 100644 --- a/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_state_test.dart +++ b/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_state_test.dart @@ -9,7 +9,7 @@ import 'package:shared_preferences_tool/src/shared_preferences_state.dart'; void main() { group('SharedPreferencesState', () { test('should be possible to set selected key to null', () { - const SharedPreferencesState state = SharedPreferencesState( + const state = SharedPreferencesState( selectedKey: SelectedSharedPreferencesKey( key: 'key', value: AsyncState.loading(), @@ -25,59 +25,59 @@ void main() { group('SharedPreferencesData', () { test('value as string should return formatted value', () { - const SharedPreferencesData stringData = SharedPreferencesData.string( + const stringData = SharedPreferencesData.string( value: 'value', ); expect(stringData.valueAsString, 'value'); - const SharedPreferencesData intData = SharedPreferencesData.int(value: 1); + const intData = SharedPreferencesData.int(value: 1); expect(intData.valueAsString, '1'); - const SharedPreferencesData doubleData = SharedPreferencesData.double( + const doubleData = SharedPreferencesData.double( value: 1.1, ); expect(doubleData.valueAsString, '1.1'); - const SharedPreferencesData boolData = SharedPreferencesData.bool( + const boolData = SharedPreferencesData.bool( value: true, ); expect(boolData.valueAsString, 'true'); - const SharedPreferencesData stringListData = + const stringListData = SharedPreferencesData.stringList(value: ['value1', 'value2']); expect(stringListData.valueAsString, '\n0 -> value1\n1 -> value2'); }); }); test('should return pretty type', () { - const SharedPreferencesData stringData = SharedPreferencesData.string( + const stringData = SharedPreferencesData.string( value: 'value', ); expect(stringData.kind, 'String'); - const SharedPreferencesData intData = SharedPreferencesData.int(value: 1); + const intData = SharedPreferencesData.int(value: 1); expect(intData.kind, 'int'); - const SharedPreferencesData doubleData = SharedPreferencesData.double( + const doubleData = SharedPreferencesData.double( value: 1.0, ); expect(doubleData.kind, 'double'); - const SharedPreferencesData boolData = SharedPreferencesData.bool( + const boolData = SharedPreferencesData.bool( value: true, ); expect(boolData.kind, 'bool'); - const SharedPreferencesData stringListData = + const stringListData = SharedPreferencesData.stringList(value: ['value1', 'value2']); expect(stringListData.kind, 'List'); }); test('should change value', () { - const SharedPreferencesData stringData = SharedPreferencesData.string( + const stringData = SharedPreferencesData.string( value: 'value', ); - const String newStringValue = 'newValue'; + const newStringValue = 'newValue'; expect( stringData.changeValue(newStringValue), isA().having( @@ -87,8 +87,8 @@ void main() { ), ); - const SharedPreferencesData intData = SharedPreferencesData.int(value: 1); - const String newIntValue = '2'; + const intData = SharedPreferencesData.int(value: 1); + const newIntValue = '2'; expect( intData.changeValue(newIntValue), isA().having( @@ -98,10 +98,10 @@ void main() { ), ); - const SharedPreferencesData doubleData = SharedPreferencesData.double( + const doubleData = SharedPreferencesData.double( value: 1.0, ); - const String newDoubleValue = '2.0'; + const newDoubleValue = '2.0'; expect( doubleData.changeValue(newDoubleValue), isA().having( @@ -111,10 +111,10 @@ void main() { ), ); - const SharedPreferencesData boolData = SharedPreferencesData.bool( + const boolData = SharedPreferencesData.bool( value: true, ); - const String newBoolValue = 'false'; + const newBoolValue = 'false'; expect( boolData.changeValue(newBoolValue), isA().having( @@ -124,9 +124,9 @@ void main() { ), ); - const SharedPreferencesData stringListData = + const stringListData = SharedPreferencesData.stringList(value: ['value1', 'value2']); - const String newStringListValue = '["newValue1", "newValue2"]'; + const newStringListValue = '["newValue1", "newValue2"]'; expect( stringListData.changeValue(newStringListValue), isA().having( diff --git a/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_tool_eval_test.dart b/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_tool_eval_test.dart index 8bbf00223b8..f27d6887d32 100644 --- a/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_tool_eval_test.dart +++ b/packages/shared_preferences/shared_preferences_tool/test/src/shared_preferences_tool_eval_test.dart @@ -57,7 +57,7 @@ void main() { required String method, required Map response, }) { - final StreamController eventStream = StreamController(); + final eventStream = StreamController(); vmService.onExtensionEvent = eventStream.stream; eval.onEval = () async { eventStream.add( @@ -77,8 +77,8 @@ void main() { }); test('should fetch all keys', () async { - final List expectedAsyncKeys = ['key1', 'key2']; - const List expectedLegacyKeys = ['key3', 'key4']; + final expectedAsyncKeys = ['key1', 'key2']; + const expectedLegacyKeys = ['key3', 'key4']; stubEvalMethod( eventKind: 'all_keys', method: 'requestAllKeys()', @@ -95,8 +95,8 @@ void main() { }); test('should fetch int value', () async { - const String key = 'testKey'; - const int expectedValue = 42; + const key = 'testKey'; + const expectedValue = 42; stubEvalMethod( eventKind: 'value', method: "requestValue('$key', false)", @@ -113,8 +113,8 @@ void main() { }); test('should fetch bool value', () async { - const String key = 'testKey'; - const bool expectedValue = true; + const key = 'testKey'; + const expectedValue = true; stubEvalMethod( eventKind: 'value', method: "requestValue('$key', false)", @@ -131,8 +131,8 @@ void main() { }); test('should fetch double value', () async { - const String key = 'testKey'; - const double expectedValue = 11.1; + const key = 'testKey'; + const expectedValue = 11.1; stubEvalMethod( eventKind: 'value', method: "requestValue('$key', false)", @@ -149,8 +149,8 @@ void main() { }); test('should fetch string value', () async { - const String key = 'testKey'; - const String expectedValue = 'value'; + const key = 'testKey'; + const expectedValue = 'value'; stubEvalMethod( eventKind: 'value', method: "requestValue('$key', false)", @@ -167,8 +167,8 @@ void main() { }); test('should fetch string list value', () async { - const String key = 'testKey'; - const List expectedValue = ['value1', 'value2']; + const key = 'testKey'; + const expectedValue = ['value1', 'value2']; stubEvalMethod( eventKind: 'value', method: "requestValue('$key', true)", @@ -188,7 +188,7 @@ void main() { }); test('should throw error on unsupported value', () { - const String key = 'testKey'; + const key = 'testKey'; stubEvalMethod( eventKind: 'value', method: "requestValue('$key', true)", @@ -202,8 +202,8 @@ void main() { }); test('should change value', () async { - const String key = 'testKey'; - const String method = "requestValueChange('$key', 'true', 'bool', false)"; + const key = 'testKey'; + const method = "requestValueChange('$key', 'true', 'bool', false)"; stubEvalMethod( eventKind: 'change_value', method: method, @@ -229,8 +229,8 @@ void main() { }); test('should delete key', () async { - const String key = 'testKey'; - const String method = "requestRemoveKey('$key', false)"; + const key = 'testKey'; + const method = "requestRemoveKey('$key', false)"; stubEvalMethod( eventKind: 'remove', method: method, diff --git a/packages/shared_preferences/shared_preferences_tool/test/src/ui/data_panel_test.dart b/packages/shared_preferences/shared_preferences_tool/test/src/ui/data_panel_test.dart index 8cda3bceddb..57f41dc6888 100644 --- a/packages/shared_preferences/shared_preferences_tool/test/src/ui/data_panel_test.dart +++ b/packages/shared_preferences/shared_preferences_tool/test/src/ui/data_panel_test.dart @@ -45,7 +45,7 @@ void main() { AsyncState? state, { bool editing = false, }) { - const String selectedKey = 'selectedTestKey'; + const selectedKey = 'selectedTestKey'; when(notifierMock.value).thenReturn( SharedPreferencesState( allKeys: const AsyncState>.data([selectedKey]), @@ -91,7 +91,7 @@ void main() { }); testWidgets('should show string value', (WidgetTester tester) async { - const String value = 'testValue'; + const value = 'testValue'; stubDataState(const SharedPreferencesData.string(value: value)); await pumpDataPanel(tester); @@ -100,7 +100,7 @@ void main() { }); testWidgets('should show int value', (WidgetTester tester) async { - const int value = 42; + const value = 42; stubDataState(const SharedPreferencesData.int(value: value)); await pumpDataPanel(tester); @@ -109,7 +109,7 @@ void main() { }); testWidgets('should show double value', (WidgetTester tester) async { - const double value = 42.0; + const value = 42.0; stubDataState(const SharedPreferencesData.double(value: value)); await pumpDataPanel(tester); @@ -118,7 +118,7 @@ void main() { }); testWidgets('should show boolean value', (WidgetTester tester) async { - const bool value = true; + const value = true; stubDataState(const SharedPreferencesData.bool(value: value)); await pumpDataPanel(tester); @@ -175,7 +175,7 @@ void main() { testWidgets('on removed confirmed should remove key', ( WidgetTester tester, ) async { - const SharedPreferencesData value = SharedPreferencesData.string( + const value = SharedPreferencesData.string( value: 'value', ); stubDataState(value); @@ -218,7 +218,7 @@ void main() { testWidgets('should show string editing state', ( WidgetTester tester, ) async { - const String value = 'value'; + const value = 'value'; stubDataState( const SharedPreferencesData.string(value: value), editing: true, @@ -232,7 +232,7 @@ void main() { }); testWidgets('should show int editing state', (WidgetTester tester) async { - const int value = 42; + const value = 42; stubDataState( const SharedPreferencesData.int(value: value), editing: true, @@ -252,7 +252,7 @@ void main() { testWidgets('should show double editing state', ( WidgetTester tester, ) async { - const double value = 42.0; + const value = 42.0; stubDataState( const SharedPreferencesData.double(value: value), editing: true, @@ -272,7 +272,7 @@ void main() { testWidgets('should show boolean editing state', ( WidgetTester tester, ) async { - const bool value = true; + const value = true; stubDataState( const SharedPreferencesData.bool(value: value), editing: true, @@ -334,7 +334,7 @@ void main() { ); await pumpDataPanel(tester); - for (int i = 0; i < 3; i++) { + for (var i = 0; i < 3; i++) { await tester.tap(find.byIcon(Icons.add).at(i)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(i), '$i'); diff --git a/packages/shared_preferences/shared_preferences_tool/test/src/ui/error_panel_test.dart b/packages/shared_preferences/shared_preferences_tool/test/src/ui/error_panel_test.dart index 708c0987e03..2bf2196c8c7 100644 --- a/packages/shared_preferences/shared_preferences_tool/test/src/ui/error_panel_test.dart +++ b/packages/shared_preferences/shared_preferences_tool/test/src/ui/error_panel_test.dart @@ -15,7 +15,7 @@ void main() { testWidgets('should show error and stacktrace', ( WidgetTester tester, ) async { - const String error = 'error'; + const error = 'error'; final StackTrace stackTrace = StackTrace.current; await tester.pumpWidget( diff --git a/packages/shared_preferences/shared_preferences_tool/test/src/ui/keys_panel_test.dart b/packages/shared_preferences/shared_preferences_tool/test/src/ui/keys_panel_test.dart index a3f6365fa8d..f3fd9f75f04 100644 --- a/packages/shared_preferences/shared_preferences_tool/test/src/ui/keys_panel_test.dart +++ b/packages/shared_preferences/shared_preferences_tool/test/src/ui/keys_panel_test.dart @@ -79,12 +79,12 @@ void main() { testWidgets('should show keys list with all keys', ( WidgetTester tester, ) async { - const List allKeys = ['key1', 'key2']; + const allKeys = ['key1', 'key2']; stubDataState(allKeys: const AsyncState>.data(allKeys)); await pumpKeysPanel(tester); - for (final String key in allKeys) { + for (final key in allKeys) { expect(find.text(key), findsOneWidget); } }); @@ -92,8 +92,8 @@ void main() { testWidgets('only selected key should be highlighted', ( WidgetTester tester, ) async { - const String selectedKey = 'selectedKey'; - const List keys = ['key1', selectedKey, 'key2']; + const selectedKey = 'selectedKey'; + const keys = ['key1', selectedKey, 'key2']; stubDataState( allKeys: const AsyncState>.data(keys), @@ -115,7 +115,7 @@ void main() { return container?.color; } - for (final String key in [...keys]..remove(selectedKey)) { + for (final key in [...keys]..remove(selectedKey)) { expect( bgColorFor(key), isNot(equals(colorScheme.selectedRowBackgroundColor)), @@ -181,7 +181,7 @@ void main() { testWidgets('should select key on key clicked', ( WidgetTester tester, ) async { - const String keyToSelect = 'keyToSelect'; + const keyToSelect = 'keyToSelect'; stubDataState( allKeys: const AsyncState>.data([keyToSelect]), ); diff --git a/packages/shared_preferences/shared_preferences_tool/test/src/ui/shared_preferences_body_test.dart b/packages/shared_preferences/shared_preferences_tool/test/src/ui/shared_preferences_body_test.dart index daec2c043e1..20101809c1a 100644 --- a/packages/shared_preferences/shared_preferences_tool/test/src/ui/shared_preferences_body_test.dart +++ b/packages/shared_preferences/shared_preferences_tool/test/src/ui/shared_preferences_body_test.dart @@ -24,7 +24,7 @@ void main() { testWidgets('should show keys and data panels', ( WidgetTester tester, ) async { - final MockSharedPreferencesStateNotifier notifier = + final notifier = MockSharedPreferencesStateNotifier(); when(notifier.value).thenReturn(const SharedPreferencesState()); diff --git a/packages/shared_preferences/shared_preferences_web/example/integration_test/shared_preferences_web_test.dart b/packages/shared_preferences/shared_preferences_web/example/integration_test/shared_preferences_web_test.dart index 3f90791c9fd..ab84f405f4d 100644 --- a/packages/shared_preferences/shared_preferences_web/example/integration_test/shared_preferences_web_test.dart +++ b/packages/shared_preferences/shared_preferences_web/example/integration_test/shared_preferences_web_test.dart @@ -33,7 +33,7 @@ void main() { ); }); - const Map flutterTestValues = { + const flutterTestValues = { 'flutter.String': 'hello world', 'flutter.Bool': true, 'flutter.Int': 42, @@ -41,7 +41,7 @@ void main() { 'flutter.StringList': ['foo', 'bar'], }; - const Map prefixTestValues = { + const prefixTestValues = { 'prefix.String': 'hello world', 'prefix.Bool': true, 'prefix.Int': 42, @@ -49,7 +49,7 @@ void main() { 'prefix.StringList': ['foo', 'bar'], }; - const Map nonPrefixTestValues = { + const nonPrefixTestValues = { 'String': 'hello world', 'Bool': true, 'Int': 42, @@ -57,7 +57,7 @@ void main() { 'StringList': ['foo', 'bar'], }; - final Map allTestValues = {}; + final allTestValues = {}; allTestValues.addAll(flutterTestValues); allTestValues.addAll(prefixTestValues); @@ -168,7 +168,7 @@ void main() { }); testWidgets('remove', (WidgetTester _) async { - const String key = 'flutter.String'; + const key = 'flutter.String'; await preferences.remove(key); final Map values = // ignore: deprecated_member_use @@ -254,7 +254,7 @@ void main() { }); testWidgets('remove', (WidgetTester _) async { - const String key = 'flutter.String'; + const key = 'flutter.String'; await preferences.remove(key); final Map values = await preferences .getAllWithParameters( @@ -392,9 +392,9 @@ void main() { }); testWidgets('simultaneous writes', (WidgetTester _) async { - final List> writes = >[]; - const int writeCount = 100; - for (int i = 1; i <= writeCount; i++) { + final writes = >[]; + const writeCount = 100; + for (var i = 1; i <= writeCount; i++) { writes.add(preferences.setValue('Int', 'Int', i)); } final List result = await Future.wait(writes, eagerError: true); @@ -408,9 +408,9 @@ void main() { }); testWidgets('returns all valid JSON data', (WidgetTester _) async { - const String value = 'value'; - const String invalidJsonDataKey = 'invalidJsonData'; - const String validJsonDataKey = 'validJsonData'; + const value = 'value'; + const invalidJsonDataKey = 'invalidJsonData'; + const validJsonDataKey = 'validJsonData'; html.window.localStorage.setItem(invalidJsonDataKey, value); html.window.localStorage.setItem(validJsonDataKey, '"$value"'); @@ -425,20 +425,20 @@ void main() { }); group('shared_preferences_async', () { - const SharedPreferencesWebOptions emptyOptions = + const emptyOptions = SharedPreferencesWebOptions(); - const String stringKey = 'testString'; - const String boolKey = 'testBool'; - const String intKey = 'testInt'; - const String doubleKey = 'testDouble'; - const String listKey = 'testList'; + const stringKey = 'testString'; + const boolKey = 'testBool'; + const intKey = 'testInt'; + const doubleKey = 'testDouble'; + const listKey = 'testList'; - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; Future getPreferences() async { final SharedPreferencesAsyncPlatform preferences = @@ -500,9 +500,9 @@ void main() { testWidgets('returns null when reading invalid JSON value', ( WidgetTester _, ) async { - const String value = 'value'; - const String invalidJsonDataKey = 'invalidJsonData'; - const String validJsonDataKey = 'validJsonData'; + const value = 'value'; + const invalidJsonDataKey = 'invalidJsonData'; + const validJsonDataKey = 'validJsonData'; final SharedPreferencesAsyncPlatform preferences = await getPreferences(); html.window.localStorage.setItem(invalidJsonDataKey, value); diff --git a/packages/shared_preferences/shared_preferences_web/lib/shared_preferences_web.dart b/packages/shared_preferences/shared_preferences_web/lib/shared_preferences_web.dart index 6bc02a9b250..87446fbf210 100644 --- a/packages/shared_preferences/shared_preferences_web/lib/shared_preferences_web.dart +++ b/packages/shared_preferences/shared_preferences_web/lib/shared_preferences_web.dart @@ -71,7 +71,7 @@ class SharedPreferencesPlugin extends SharedPreferencesStorePlatform { GetAllParameters parameters, ) async { final PreferencesFilter filter = parameters.filter; - final Map allData = {}; + final allData = {}; for (final String key in _getPrefixedKeys( filter.prefix, allowList: filter.allowList, @@ -137,7 +137,7 @@ base class SharedPreferencesAsyncWeb extends SharedPreferencesAsyncPlatform { Set? allowList, SharedPreferencesOptions options, ) async { - final Map allData = {}; + final allData = {}; for (final String key in _getAllowedKeys(allowList: allowList)) { final Object? value = _decodeValue( html.window.localStorage.getItem(key)!, diff --git a/packages/shared_preferences/shared_preferences_windows/example/integration_test/shared_preferences_test.dart b/packages/shared_preferences/shared_preferences_windows/example/integration_test/shared_preferences_test.dart index 76e461ddafe..220a851cc5e 100644 --- a/packages/shared_preferences/shared_preferences_windows/example/integration_test/shared_preferences_test.dart +++ b/packages/shared_preferences/shared_preferences_windows/example/integration_test/shared_preferences_test.dart @@ -14,7 +14,7 @@ void main() { group('SharedPreferencesWindows', () { late SharedPreferencesWindows preferences; - const Map flutterTestValues = { + const flutterTestValues = { 'flutter.String': 'hello world', 'flutter.Bool': true, 'flutter.Int': 42, @@ -22,7 +22,7 @@ void main() { 'flutter.StringList': ['foo', 'bar'], }; - const Map prefixTestValues = { + const prefixTestValues = { 'prefix.String': 'hello world', 'prefix.Bool': true, 'prefix.Int': 42, @@ -30,7 +30,7 @@ void main() { 'prefix.StringList': ['foo', 'bar'], }; - const Map nonPrefixTestValues = { + const nonPrefixTestValues = { 'String': 'hello world', 'Bool': true, 'Int': 42, @@ -38,7 +38,7 @@ void main() { 'StringList': ['foo', 'bar'], }; - final Map allTestValues = {}; + final allTestValues = {}; allTestValues.addAll(flutterTestValues); allTestValues.addAll(prefixTestValues); @@ -128,7 +128,7 @@ void main() { group('withPrefix', () { testWidgets('remove', (WidgetTester _) async { - const String key = 'flutter.String'; + const key = 'flutter.String'; await preferences.remove(key); final Map values = await preferences.getAllWithPrefix( '', @@ -217,7 +217,7 @@ void main() { group('withParameters', () { testWidgets('remove', (WidgetTester _) async { - const String key = 'flutter.String'; + const key = 'flutter.String'; await preferences.remove(key); final Map values = await preferences .getAllWithParameters( @@ -366,20 +366,20 @@ void main() { }); group('shared_preferences_async', () { - const SharedPreferencesWindowsOptions emptyOptions = + const emptyOptions = SharedPreferencesWindowsOptions(); - const String stringKey = 'testString'; - const String boolKey = 'testBool'; - const String intKey = 'testInt'; - const String doubleKey = 'testDouble'; - const String listKey = 'testList'; - - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; + const stringKey = 'testString'; + const boolKey = 'testBool'; + const intKey = 'testInt'; + const doubleKey = 'testDouble'; + const listKey = 'testList'; + + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; Future getPreferences({ bool clear = true, diff --git a/packages/shared_preferences/shared_preferences_windows/lib/shared_preferences_windows.dart b/packages/shared_preferences/shared_preferences_windows/lib/shared_preferences_windows.dart index 53c5e80c92e..b790e79ef7f 100644 --- a/packages/shared_preferences/shared_preferences_windows/lib/shared_preferences_windows.dart +++ b/packages/shared_preferences/shared_preferences_windows/lib/shared_preferences_windows.dart @@ -107,7 +107,7 @@ class SharedPreferencesWindows extends SharedPreferencesStorePlatform { GetAllParameters parameters, ) async { final PreferencesFilter filter = parameters.filter; - final Map withPrefix = Map.from( + final withPrefix = Map.from( await _readPreferences(), ); withPrefix.removeWhere( @@ -295,7 +295,7 @@ base class SharedPreferencesAsyncWindows ) async { final SharedPreferencesWindowsOptions windowsOptions = SharedPreferencesWindowsOptions.fromSharedPreferencesOptions(options); - final Map prefs = Map.from( + final prefs = Map.from( await _readPreferences(windowsOptions.fileName), ); prefs.removeWhere((String key, _) => !(allowList?.contains(key) ?? true)); @@ -354,7 +354,7 @@ Future> _readFromFile( FileSystem fs = const LocalFileSystem(), PathProviderWindows? pathProvider, }) async { - Map preferences = {}; + var preferences = {}; final File? localDataFile = await _getLocalDataFile( fileName, fs: fs, diff --git a/packages/shared_preferences/shared_preferences_windows/test/legacy_shared_preferences_windows_test.dart b/packages/shared_preferences/shared_preferences_windows/test/legacy_shared_preferences_windows_test.dart index 3d920fbc22a..ed14c1864e9 100644 --- a/packages/shared_preferences/shared_preferences_windows/test/legacy_shared_preferences_windows_test.dart +++ b/packages/shared_preferences/shared_preferences_windows/test/legacy_shared_preferences_windows_test.dart @@ -20,7 +20,7 @@ void main() { SharedPreferencesWindows.registerWith(); - const Map flutterTestValues = { + const flutterTestValues = { 'flutter.String': 'hello world', 'flutter.Bool': true, 'flutter.Int': 42, @@ -28,7 +28,7 @@ void main() { 'flutter.StringList': ['foo', 'bar'], }; - const Map prefixTestValues = { + const prefixTestValues = { 'prefix.String': 'hello world', 'prefix.Bool': true, 'prefix.Int': 42, @@ -36,7 +36,7 @@ void main() { 'prefix.StringList': ['foo', 'bar'], }; - const Map nonPrefixTestValues = { + const nonPrefixTestValues = { 'String': 'hello world', 'Bool': true, 'Int': 42, @@ -44,7 +44,7 @@ void main() { 'StringList': ['foo', 'bar'], }; - final Map allTestValues = {}; + final allTestValues = {}; allTestValues.addAll(flutterTestValues); allTestValues.addAll(prefixTestValues); @@ -71,7 +71,7 @@ void main() { } SharedPreferencesWindows getPreferences() { - final SharedPreferencesWindows prefs = SharedPreferencesWindows(); + final prefs = SharedPreferencesWindows(); prefs.fs = fs; prefs.pathProvider = pathProvider; return prefs; diff --git a/packages/shared_preferences/shared_preferences_windows/test/shared_preferences_windows_async_test.dart b/packages/shared_preferences/shared_preferences_windows/test/shared_preferences_windows_async_test.dart index 295c875589c..6b6e5ca164c 100755 --- a/packages/shared_preferences/shared_preferences_windows/test/shared_preferences_windows_async_test.dart +++ b/packages/shared_preferences/shared_preferences_windows/test/shared_preferences_windows_async_test.dart @@ -16,19 +16,19 @@ void main() { SharedPreferencesAsyncWindows.registerWith(); - const String stringKey = 'testString'; - const String boolKey = 'testBool'; - const String intKey = 'testInt'; - const String doubleKey = 'testDouble'; - const String listKey = 'testList'; - - const String testString = 'hello world'; - const bool testBool = true; - const int testInt = 42; - const double testDouble = 3.14159; - const List testList = ['foo', 'bar']; - - const SharedPreferencesWindowsOptions emptyOptions = + const stringKey = 'testString'; + const boolKey = 'testBool'; + const intKey = 'testInt'; + const doubleKey = 'testDouble'; + const listKey = 'testList'; + + const testString = 'hello world'; + const testBool = true; + const testInt = 42; + const testDouble = 3.14159; + const testList = ['foo', 'bar']; + + const emptyOptions = SharedPreferencesWindowsOptions(); setUp(() { @@ -37,7 +37,7 @@ void main() { }); SharedPreferencesAsyncWindows getPreferences() { - final SharedPreferencesAsyncWindows prefs = SharedPreferencesAsyncWindows(); + final prefs = SharedPreferencesAsyncWindows(); prefs.fs = fs; prefs.pathProvider = pathProvider; return prefs; diff --git a/packages/standard_message_codec/lib/src/serialization.dart b/packages/standard_message_codec/lib/src/serialization.dart index 302dc3ad76f..7229ef3c3ff 100644 --- a/packages/standard_message_codec/lib/src/serialization.dart +++ b/packages/standard_message_codec/lib/src/serialization.dart @@ -28,7 +28,7 @@ class WriteBuffer { /// performance. factory WriteBuffer({int startCapacity = 8}) { assert(startCapacity > 0); - final ByteData eightBytes = ByteData(8); + final eightBytes = ByteData(8); final Uint8List eightBytesAsList = eightBytes.buffer.asUint8List(); return WriteBuffer._( Uint8List(startCapacity), @@ -76,7 +76,7 @@ class WriteBuffer { void _resize([int? requiredLength]) { final int doubleLength = _buffer.length * 2; final int newLength = math.max(requiredLength ?? 0, doubleLength); - final Uint8List newBuffer = Uint8List(newLength); + final newBuffer = Uint8List(newLength); newBuffer.setRange(0, _buffer.length, _buffer); _buffer = newBuffer; } diff --git a/packages/standard_message_codec/lib/standard_message_codec.dart b/packages/standard_message_codec/lib/standard_message_codec.dart index 6bd769e766d..271acbbc04a 100644 --- a/packages/standard_message_codec/lib/standard_message_codec.dart +++ b/packages/standard_message_codec/lib/standard_message_codec.dart @@ -160,7 +160,7 @@ class StandardMessageCodec implements MessageCodec { if (message == null) { return null; } - final WriteBuffer buffer = WriteBuffer( + final buffer = WriteBuffer( startCapacity: _writeBufferStartCapacity, ); writeValue(buffer, message); @@ -172,7 +172,7 @@ class StandardMessageCodec implements MessageCodec { if (message == null) { return null; } - final ReadBuffer buffer = ReadBuffer(message); + final buffer = ReadBuffer(message); final Object? result = readValue(buffer); if (buffer.hasRemaining) { throw const FormatException('Message corrupted'); @@ -242,11 +242,11 @@ class StandardMessageCodec implements MessageCodec { } } else if (value is String) { buffer.putUint8(_valueString); - final Uint8List asciiBytes = Uint8List(value.length); + final asciiBytes = Uint8List(value.length); Uint8List? utf8Bytes; - int utf8Offset = 0; + var utf8Offset = 0; // Only do utf8 encoding if we encounter non-ascii characters. - for (int i = 0; i < value.length; i += 1) { + for (var i = 0; i < value.length; i += 1) { final int char = value.codeUnitAt(i); if (char <= 0x7f) { asciiBytes[i] = char; @@ -354,15 +354,15 @@ class StandardMessageCodec implements MessageCodec { return buffer.getFloat64List(length); case _valueList: final int length = readSize(buffer); - final List result = List.filled(length, null); - for (int i = 0; i < length; i++) { + final result = List.filled(length, null); + for (var i = 0; i < length; i++) { result[i] = readValue(buffer); } return result; case _valueMap: final int length = readSize(buffer); - final Map result = {}; - for (int i = 0; i < length; i++) { + final result = {}; + for (var i = 0; i < length; i++) { result[readValue(buffer)] = readValue(buffer); } return result; diff --git a/packages/standard_message_codec/test/standard_message_codec_test.dart b/packages/standard_message_codec/test/standard_message_codec_test.dart index b33a4110e3e..9df3b9392ce 100644 --- a/packages/standard_message_codec/test/standard_message_codec_test.dart +++ b/packages/standard_message_codec/test/standard_message_codec_test.dart @@ -26,85 +26,85 @@ void main() { group('Write and read buffer round-trip', () { test('of empty buffer', () { - final WriteBuffer write = WriteBuffer(); + final write = WriteBuffer(); final ByteData written = write.done(); expect(written.lengthInBytes, 0); }); test('of single byte', () { - final WriteBuffer write = WriteBuffer(); + final write = WriteBuffer(); write.putUint8(201); final ByteData written = write.done(); expect(written.lengthInBytes, equals(1)); - final ReadBuffer read = ReadBuffer(written); + final read = ReadBuffer(written); expect(read.getUint8(), equals(201)); }); test('of 32-bit integer', () { - final WriteBuffer write = WriteBuffer(); + final write = WriteBuffer(); write.putInt32(-9); final ByteData written = write.done(); expect(written.lengthInBytes, equals(4)); - final ReadBuffer read = ReadBuffer(written); + final read = ReadBuffer(written); expect(read.getInt32(), equals(-9)); }); test('of 32-bit integer in big endian', () { - final WriteBuffer write = WriteBuffer(); + final write = WriteBuffer(); write.putInt32(-9, endian: Endian.big); final ByteData written = write.done(); expect(written.lengthInBytes, equals(4)); - final ReadBuffer read = ReadBuffer(written); + final read = ReadBuffer(written); expect(read.getInt32(endian: Endian.big), equals(-9)); }); test('of 64-bit integer', () { - final WriteBuffer write = WriteBuffer(); + final write = WriteBuffer(); write.putInt64(-9000000000000); final ByteData written = write.done(); expect(written.lengthInBytes, equals(8)); - final ReadBuffer read = ReadBuffer(written); + final read = ReadBuffer(written); expect(read.getInt64(), equals(-9000000000000)); }, testOn: 'vm' /* Int64 isn't supported on web */); test( 'of 64-bit integer in big endian', () { - final WriteBuffer write = WriteBuffer(); + final write = WriteBuffer(); write.putInt64(-9000000000000, endian: Endian.big); final ByteData written = write.done(); expect(written.lengthInBytes, equals(8)); - final ReadBuffer read = ReadBuffer(written); + final read = ReadBuffer(written); expect(read.getInt64(endian: Endian.big), equals(-9000000000000)); }, testOn: 'vm' /* Int64 isn't supported on web */, ); test('of double', () { - final WriteBuffer write = WriteBuffer(); + final write = WriteBuffer(); write.putFloat64(3.14); final ByteData written = write.done(); expect(written.lengthInBytes, equals(8)); - final ReadBuffer read = ReadBuffer(written); + final read = ReadBuffer(written); expect(read.getFloat64(), equals(3.14)); }); test('of double in big endian', () { - final WriteBuffer write = WriteBuffer(); + final write = WriteBuffer(); write.putFloat64(3.14, endian: Endian.big); final ByteData written = write.done(); expect(written.lengthInBytes, equals(8)); - final ReadBuffer read = ReadBuffer(written); + final read = ReadBuffer(written); expect(read.getFloat64(endian: Endian.big), equals(3.14)); }); test('of 32-bit int list when unaligned', () { - final Int32List integers = Int32List.fromList([-99, 2, 99]); - final WriteBuffer write = WriteBuffer(); + final integers = Int32List.fromList([-99, 2, 99]); + final write = WriteBuffer(); write.putUint8(9); write.putInt32List(integers); final ByteData written = write.done(); expect(written.lengthInBytes, equals(16)); - final ReadBuffer read = ReadBuffer(written); + final read = ReadBuffer(written); read.getUint8(); expect(read.getInt32List(3), equals(integers)); }); @@ -112,13 +112,13 @@ void main() { test( 'of 64-bit int list when unaligned', () { - final Int64List integers = Int64List.fromList([-99, 2, 99]); - final WriteBuffer write = WriteBuffer(); + final integers = Int64List.fromList([-99, 2, 99]); + final write = WriteBuffer(); write.putUint8(9); write.putInt64List(integers); final ByteData written = write.done(); expect(written.lengthInBytes, equals(32)); - final ReadBuffer read = ReadBuffer(written); + final read = ReadBuffer(written); read.getUint8(); expect(read.getInt64List(3), equals(integers)); }, @@ -126,16 +126,16 @@ void main() { ); test('of float list when unaligned', () { - final Float32List floats = Float32List.fromList([ + final floats = Float32List.fromList([ 3.14, double.nan, ]); - final WriteBuffer write = WriteBuffer(); + final write = WriteBuffer(); write.putUint8(9); write.putFloat32List(floats); final ByteData written = write.done(); expect(written.lengthInBytes, equals(12)); - final ReadBuffer read = ReadBuffer(written); + final read = ReadBuffer(written); read.getUint8(); final Float32List readFloats = read.getFloat32List(2); expect(readFloats[0], closeTo(3.14, 0.0001)); @@ -143,16 +143,16 @@ void main() { }); test('of double list when unaligned', () { - final Float64List doubles = Float64List.fromList([ + final doubles = Float64List.fromList([ 3.14, double.nan, ]); - final WriteBuffer write = WriteBuffer(); + final write = WriteBuffer(); write.putUint8(9); write.putFloat64List(doubles); final ByteData written = write.done(); expect(written.lengthInBytes, equals(24)); - final ReadBuffer read = ReadBuffer(written); + final read = ReadBuffer(written); read.getUint8(); final Float64List readDoubles = read.getFloat64List(2); expect(readDoubles[0], equals(3.14)); @@ -160,7 +160,7 @@ void main() { }); test('done twice', () { - final WriteBuffer write = WriteBuffer(); + final write = WriteBuffer(); write.done(); expect(() => write.done(), throwsStateError); }); diff --git a/packages/two_dimensional_scrollables/example/lib/table_view/merged_table.dart b/packages/two_dimensional_scrollables/example/lib/table_view/merged_table.dart index 4c25dcb8d3a..bbc49839ddf 100644 --- a/packages/two_dimensional_scrollables/example/lib/table_view/merged_table.dart +++ b/packages/two_dimensional_scrollables/example/lib/table_view/merged_table.dart @@ -103,7 +103,7 @@ class _MergedTableExampleState extends State { ThemeData.estimateBrightnessForColor(cell.color) == Brightness.light ? Colors.black : Colors.white; - final TextStyle style = TextStyle( + final style = TextStyle( color: textColor, fontSize: 18.0, fontWeight: vicinity.column == 0 ? FontWeight.bold : null, diff --git a/packages/two_dimensional_scrollables/example/lib/table_view/simple_table.dart b/packages/two_dimensional_scrollables/example/lib/table_view/simple_table.dart index 0ea73b423ad..855d35a17fe 100644 --- a/packages/two_dimensional_scrollables/example/lib/table_view/simple_table.dart +++ b/packages/two_dimensional_scrollables/example/lib/table_view/simple_table.dart @@ -143,7 +143,7 @@ class _TableExampleState extends State { } TableSpan _buildColumnSpan(int index) { - const TableSpanDecoration decoration = TableSpanDecoration( + const decoration = TableSpanDecoration( border: TableSpanBorder(trailing: BorderSide()), ); @@ -195,7 +195,7 @@ class _TableExampleState extends State { } TableSpan _buildRowSpan(int index) { - final TableSpanDecoration decoration = TableSpanDecoration( + final decoration = TableSpanDecoration( color: index.isEven ? Colors.purple[100] : null, border: const TableSpanBorder(trailing: BorderSide(width: 3)), ); diff --git a/packages/two_dimensional_scrollables/example/lib/tree_view/custom_tree.dart b/packages/two_dimensional_scrollables/example/lib/tree_view/custom_tree.dart index bb3cebbbf0d..2754c2eb913 100644 --- a/packages/two_dimensional_scrollables/example/lib/tree_view/custom_tree.dart +++ b/packages/two_dimensional_scrollables/example/lib/tree_view/custom_tree.dart @@ -109,7 +109,7 @@ class CustomTreeExampleState extends State { AnimationStyle toggleAnimationStyle, ) { final bool isParentNode = node.children.isNotEmpty; - final BorderSide border = BorderSide(width: 2, color: Colors.purple[300]!); + final border = BorderSide(width: 2, color: Colors.purple[300]!); // TRY THIS: TreeView.toggleNodeWith can be wrapped around any Widget (even // the whole row) to trigger parent nodes to toggle opened and closed. // Currently, the toggle is triggered in _getTapRecognizer below using the @@ -228,7 +228,7 @@ class CustomTreeExampleState extends State { Widget build(BuildContext context) { // This example is assumes the full screen is available. final Size screenSize = MediaQuery.sizeOf(context); - final List selectedChildren = []; + final selectedChildren = []; if (_selectedNode != null) { selectedChildren.addAll([ const Spacer(), diff --git a/packages/two_dimensional_scrollables/example/test/tree_view/custom_tree_test.dart b/packages/two_dimensional_scrollables/example/test/tree_view/custom_tree_test.dart index 822cedaafcf..946c40165cf 100644 --- a/packages/two_dimensional_scrollables/example/test/tree_view/custom_tree_test.dart +++ b/packages/two_dimensional_scrollables/example/test/tree_view/custom_tree_test.dart @@ -35,7 +35,7 @@ void main() { expect(verticalPosition.maxScrollExtent, 0.0); expect(verticalPosition.pixels, 0.0); - final CustomTreeExampleState state = + final state = tester.state(find.byType(CustomTreeExample)) as CustomTreeExampleState; state.treeController.toggleNode(state.treeController.getNodeFor('lib')!); diff --git a/packages/two_dimensional_scrollables/example/test/tree_view/simple_tree_test.dart b/packages/two_dimensional_scrollables/example/test/tree_view/simple_tree_test.dart index 56d0ca01a7f..b45806df93b 100644 --- a/packages/two_dimensional_scrollables/example/test/tree_view/simple_tree_test.dart +++ b/packages/two_dimensional_scrollables/example/test/tree_view/simple_tree_test.dart @@ -36,7 +36,7 @@ void main() { expect(horizontalPosition.maxScrollExtent, greaterThan(190)); expect(horizontalPosition.pixels, 0.0); - final TreeExampleState state = + final state = tester.state(find.byType(TreeExample)) as TreeExampleState; state.treeController.expandAll(); diff --git a/packages/two_dimensional_scrollables/lib/src/common/span.dart b/packages/two_dimensional_scrollables/lib/src/common/span.dart index 6a072091d2f..27e40b4ae7e 100644 --- a/packages/two_dimensional_scrollables/lib/src/common/span.dart +++ b/packages/two_dimensional_scrollables/lib/src/common/span.dart @@ -383,7 +383,7 @@ class SpanDecoration { /// cells. void paint(SpanDecorationPaintDetails details) { if (color != null) { - final Paint paint = Paint() + final paint = Paint() ..color = color! ..isAntiAlias = borderRadius != null; if (borderRadius == null || borderRadius == BorderRadius.zero) { @@ -441,13 +441,13 @@ class SpanBorder { final AxisDirection axisDirection = details.axisDirection; switch (axisDirectionToAxis(axisDirection)) { case Axis.horizontal: - final Border border = Border( + final border = Border( top: axisDirection == AxisDirection.right ? leading : trailing, bottom: axisDirection == AxisDirection.right ? trailing : leading, ); border.paint(details.canvas, details.rect, borderRadius: borderRadius); case Axis.vertical: - final Border border = Border( + final border = Border( left: axisDirection == AxisDirection.down ? leading : trailing, right: axisDirection == AxisDirection.down ? trailing : leading, ); diff --git a/packages/two_dimensional_scrollables/lib/src/table_view/table.dart b/packages/two_dimensional_scrollables/lib/src/table_view/table.dart index e8f4f4b1cb2..d235d706499 100644 --- a/packages/two_dimensional_scrollables/lib/src/table_view/table.dart +++ b/packages/two_dimensional_scrollables/lib/src/table_view/table.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:collection'; import 'dart:math' as math; import 'package:flutter/foundation.dart'; @@ -479,8 +478,8 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { } return true; }()); - double startOfRegularColumn = 0.0; - double startOfPinnedColumn = 0.0; + var startOfRegularColumn = 0.0; + var startOfPinnedColumn = 0.0; if (appendColumns) { // We are only adding to the metrics we already know, since we are lazily // compiling metrics. This should only be the case when the @@ -521,7 +520,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { while (!reachedColumnEnd()) { final bool isPinned = column < delegate.pinnedColumnCount; - final double leadingOffset = isPinned + final leadingOffset = isPinned ? startOfPinnedColumn : startOfRegularColumn; _Span? span = _columnMetrics.remove(column); @@ -586,8 +585,8 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { } return true; }()); - double startOfRegularRow = 0.0; - double startOfPinnedRow = 0.0; + var startOfRegularRow = 0.0; + var startOfPinnedRow = 0.0; if (appendRows) { // We are only adding to the metrics we already know, since we are lazily // compiling metrics. This should only be the case when the @@ -623,7 +622,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { while (!reachedRowEnd()) { final bool isPinned = row < delegate.pinnedRowCount; - final double leadingOffset = isPinned + final leadingOffset = isPinned ? startOfPinnedRow : startOfRegularRow; _Span? span = _rowMetrics.remove(row); @@ -753,7 +752,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { } _firstNonPinnedColumn = null; _lastNonPinnedColumn = null; - for (int column = 0; column < _columnMetrics.length; column++) { + for (var column = 0; column < _columnMetrics.length; column++) { if (_columnMetrics[column]!.isPinned) { continue; } @@ -789,7 +788,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { } _firstNonPinnedRow = null; _lastNonPinnedRow = null; - for (int row = 0; row < _rowMetrics.length; row++) { + for (var row = 0; row < _rowMetrics.length; row++) { if (_rowMetrics[row]!.isPinned) { continue; } @@ -961,7 +960,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { double? mergedColumnOffset; columnOffset += colSpan.configuration.padding.leading; - final TableVicinity vicinity = TableVicinity(column: column, row: row); + final vicinity = TableVicinity(column: column, row: row); final RenderBox? cell = _mergedVicinities.keys.contains(vicinity) ? null : buildOrObtainChildFor(vicinity); @@ -1095,17 +1094,17 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { _columnMetrics[firstColumn]!.configuration.padding.leading; // Collect all of the vicinities that will not need to be built now. - int currentRow = firstRow; + var currentRow = firstRow; while (currentRow <= lastRow) { if (cellParentData.rowMergeStart != null) { _mergedRows.add(currentRow); } - int currentColumn = firstColumn; + var currentColumn = firstColumn; while (currentColumn <= lastColumn) { if (cellParentData.columnMergeStart != null) { _mergedColumns.add(currentColumn); } - final TableVicinity key = TableVicinity( + final key = TableVicinity( row: currentRow, column: currentColumn, ); @@ -1116,7 +1115,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { } } - final BoxConstraints cellConstraints = BoxConstraints.tightFor( + final cellConstraints = BoxConstraints.tightFor( width: mergedColumnWidth ?? standardColumnWidth, height: mergedRowHeight ?? standardRowHeight, ); @@ -1317,10 +1316,10 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { required Offset offset, }) { // Column decorations - final LinkedHashMap foregroundColumns = - LinkedHashMap(); - final LinkedHashMap backgroundColumns = - LinkedHashMap(); + final foregroundColumns = + {}; + final backgroundColumns = + {}; final TableSpan rowSpan = _rowMetrics[leadingVicinity.row]!.configuration; for ( @@ -1332,7 +1331,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { if (columnSpan.backgroundDecoration != null || columnSpan.foregroundDecoration != null || _mergedColumns.contains(column)) { - final List<({RenderBox leading, RenderBox trailing})> decorationCells = + final decorationCells = <({RenderBox leading, RenderBox trailing})>[]; if (_mergedColumns.isEmpty || !_mergedColumns.contains(column)) { // One decoration across the whole column. @@ -1361,7 +1360,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { late RenderBox trailingCell; int currentRow = leadingVicinity.row; while (currentRow <= trailingVicinity.row) { - TableVicinity vicinity = TableVicinity( + var vicinity = TableVicinity( column: column, row: currentRow, ); @@ -1429,7 +1428,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { ); } - for (final ({RenderBox leading, RenderBox trailing}) cell + for (final cell in decorationCells) { // If this was a merged cell, the decoration is defined by the leading // cell, which may come from a different column. @@ -1460,10 +1459,10 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { } // Row decorations - final LinkedHashMap foregroundRows = - LinkedHashMap(); - final LinkedHashMap backgroundRows = - LinkedHashMap(); + final foregroundRows = + {}; + final backgroundRows = + {}; final TableSpan columnSpan = _columnMetrics[leadingVicinity.column]!.configuration; for (int row = leadingVicinity.row; row <= trailingVicinity.row; row++) { @@ -1471,7 +1470,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { if (rowSpan.backgroundDecoration != null || rowSpan.foregroundDecoration != null || _mergedRows.contains(row)) { - final List<({RenderBox leading, RenderBox trailing})> decorationCells = + final decorationCells = <({RenderBox leading, RenderBox trailing})>[]; if (_mergedRows.isEmpty || !_mergedRows.contains(row)) { // One decoration across the whole row. @@ -1500,7 +1499,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { late RenderBox trailingCell; int currentColumn = leadingVicinity.column; while (currentColumn <= trailingVicinity.column) { - TableVicinity vicinity = TableVicinity( + var vicinity = TableVicinity( column: currentColumn, row: row, ); @@ -1568,7 +1567,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { ); } - for (final ({RenderBox leading, RenderBox trailing}) cell + for (final cell in decorationCells) { // If this was a merged cell, the decoration is defined by the leading // cell, which may come from a different row. @@ -1606,7 +1605,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { // Default, row major order. Rows go first. case Axis.vertical: backgroundRows.forEach((Rect rect, TableSpanDecoration decoration) { - final TableSpanDecorationPaintDetails paintingDetails = + final paintingDetails = TableSpanDecorationPaintDetails( canvas: context.canvas, rect: rect, @@ -1615,7 +1614,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { decoration.paint(paintingDetails); }); backgroundColumns.forEach((Rect rect, TableSpanDecoration decoration) { - final TableSpanDecorationPaintDetails paintingDetails = + final paintingDetails = TableSpanDecorationPaintDetails( canvas: context.canvas, rect: rect, @@ -1626,7 +1625,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { // Column major order. Columns go first. case Axis.horizontal: backgroundColumns.forEach((Rect rect, TableSpanDecoration decoration) { - final TableSpanDecorationPaintDetails paintingDetails = + final paintingDetails = TableSpanDecorationPaintDetails( canvas: context.canvas, rect: rect, @@ -1635,7 +1634,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { decoration.paint(paintingDetails); }); backgroundRows.forEach((Rect rect, TableSpanDecoration decoration) { - final TableSpanDecorationPaintDetails paintingDetails = + final paintingDetails = TableSpanDecorationPaintDetails( canvas: context.canvas, rect: rect, @@ -1652,7 +1651,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { column++ ) { for (int row = leadingVicinity.row; row <= trailingVicinity.row; row++) { - final TableVicinity vicinity = TableVicinity(column: column, row: row); + final vicinity = TableVicinity(column: column, row: row); final RenderBox? cell = getChildFor( vicinity, mapMergedVicinityToCanonicalChild: false, @@ -1680,7 +1679,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { // Default, row major order. Rows go first. case Axis.vertical: foregroundRows.forEach((Rect rect, TableSpanDecoration decoration) { - final TableSpanDecorationPaintDetails paintingDetails = + final paintingDetails = TableSpanDecorationPaintDetails( canvas: context.canvas, rect: rect, @@ -1689,7 +1688,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { decoration.paint(paintingDetails); }); foregroundColumns.forEach((Rect rect, TableSpanDecoration decoration) { - final TableSpanDecorationPaintDetails paintingDetails = + final paintingDetails = TableSpanDecorationPaintDetails( canvas: context.canvas, rect: rect, @@ -1700,7 +1699,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { // Column major order. Columns go first. case Axis.horizontal: foregroundColumns.forEach((Rect rect, TableSpanDecoration decoration) { - final TableSpanDecorationPaintDetails paintingDetails = + final paintingDetails = TableSpanDecorationPaintDetails( canvas: context.canvas, rect: rect, @@ -1709,7 +1708,7 @@ class RenderTableViewport extends RenderTwoDimensionalViewport { decoration.paint(paintingDetails); }); foregroundRows.forEach((Rect rect, TableSpanDecoration decoration) { - final TableSpanDecorationPaintDetails paintingDetails = + final paintingDetails = TableSpanDecorationPaintDetails( canvas: context.canvas, rect: rect, @@ -1791,7 +1790,7 @@ class _Span _disposeRecognizers(); return; } - final Map newRecognizers = + final newRecognizers = {}; for (final Type type in configuration.recognizerFactories.keys) { assert(!newRecognizers.containsKey(type)); diff --git a/packages/two_dimensional_scrollables/lib/src/table_view/table_cell.dart b/packages/two_dimensional_scrollables/lib/src/table_view/table_cell.dart index ae5597f6d8b..66fe6c8814a 100644 --- a/packages/two_dimensional_scrollables/lib/src/table_view/table_cell.dart +++ b/packages/two_dimensional_scrollables/lib/src/table_view/table_cell.dart @@ -74,7 +74,7 @@ class TableViewParentData extends TwoDimensionalViewportParentData { @override String toString() { - String mergeDetails = ''; + var mergeDetails = ''; if (rowMergeStart != null || columnMergeStart != null) { mergeDetails += ', merged'; } @@ -198,9 +198,9 @@ class _TableViewCell extends ParentDataWidget { @override void applyParentData(RenderObject renderObject) { - final TableViewParentData parentData = + final parentData = renderObject.parentData! as TableViewParentData; - bool needsLayout = false; + var needsLayout = false; if (parentData.rowMergeStart != rowMergeStart) { assert(rowMergeStart == null || rowMergeStart! >= 0); parentData.rowMergeStart = rowMergeStart; diff --git a/packages/two_dimensional_scrollables/lib/src/tree_view/render_tree.dart b/packages/two_dimensional_scrollables/lib/src/tree_view/render_tree.dart index 94a1acbd164..256574387fd 100644 --- a/packages/two_dimensional_scrollables/lib/src/tree_view/render_tree.dart +++ b/packages/two_dimensional_scrollables/lib/src/tree_view/render_tree.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:collection' show LinkedHashMap; import 'dart:math' as math; import 'package:flutter/foundation.dart'; @@ -200,11 +199,11 @@ class RenderTreeViewport extends RenderTwoDimensionalViewport { // `position` represents the trailing edge of the parent node that initiated // the animation. assert(_activeAnimations[key] != null); - double currentPosition = position; + var currentPosition = position; final int startingIndex = _activeAnimations[key]!.fromIndex; final int lastIndex = _activeAnimations[key]!.toIndex; - int currentIndex = startingIndex; - double totalAnimatingOffset = 0.0; + var currentIndex = startingIndex; + var totalAnimatingOffset = 0.0; // We animate only a portion of children that would be visible/in the cache // extent, unless all animating children would fit on the screen. while (currentIndex <= lastIndex && currentPosition < _targetRowPixel) { @@ -239,11 +238,11 @@ class RenderTreeViewport extends RenderTwoDimensionalViewport { assert(needsDelegateRebuild || didResize); _firstRow = null; _lastRow = null; - double totalAnimationOffset = 0.0; + var totalAnimationOffset = 0.0; double startOfRow = 0; - final Map newRowMetrics = {}; - for (int row = 0; row < delegate.rowCount; row++) { - final double leadingOffset = startOfRow; + final newRowMetrics = {}; + for (var row = 0; row < delegate.rowCount; row++) { + final leadingOffset = startOfRow; _Span? span = _rowMetrics.remove(row); assert(needsDelegateRebuild || span != null); final TreeRow configuration = needsDelegateRebuild @@ -297,7 +296,7 @@ class RenderTreeViewport extends RenderTwoDimensionalViewport { void _updateFirstAndLastVisibleRow() { _firstRow = null; _lastRow = null; - for (int row = 0; row < _rowMetrics.length; row++) { + for (var row = 0; row < _rowMetrics.length; row++) { final double endOfRow = _rowMetrics[row]!.trailingOffset; if (endOfRow >= verticalOffset.pixels && _firstRow == null) { _firstRow = row; @@ -366,13 +365,13 @@ class RenderTreeViewport extends RenderTwoDimensionalViewport { } rowOffset += rowSpan.configuration.padding.leading; - final TreeVicinity vicinity = TreeVicinity( + final vicinity = TreeVicinity( depth: _rowDepths[row]!, row: row, ); final RenderBox child = buildOrObtainChildFor(vicinity)!; final TwoDimensionalViewportParentData parentData = parentDataOf(child); - final BoxConstraints childConstraints = BoxConstraints( + final childConstraints = BoxConstraints( minHeight: rowHeight, maxHeight: rowHeight, // Width is allowed to be unbounded. @@ -445,7 +444,7 @@ class RenderTreeViewport extends RenderTwoDimensionalViewport { int leadingIndex = _firstRow!; final List animationIndices = _animationLeadingIndices.keys.toList() ..sort(); - final List<_PaintSegment> paintSegments = <_PaintSegment>[]; + final paintSegments = <_PaintSegment>[]; while (animationIndices.isNotEmpty) { final int trailingIndex = animationIndices.removeAt(0); paintSegments.add(( @@ -492,7 +491,7 @@ class RenderTreeViewport extends RenderTwoDimensionalViewport { final double leadingOffset = _rowMetrics[parentIndex]!.trailingOffset; final double trailingOffset = _rowMetrics[segment.trailingIndex]!.trailingOffset; - final Rect rect = Rect.fromPoints( + final rect = Rect.fromPoints( Offset(0.0, leadingOffset - verticalOffset.pixels), Offset( viewportDimension.width, @@ -530,12 +529,12 @@ class RenderTreeViewport extends RenderTwoDimensionalViewport { required int trailingRow, }) { // Row decorations - final LinkedHashMap foregroundRows = - LinkedHashMap(); - final LinkedHashMap backgroundRows = - LinkedHashMap(); + final foregroundRows = + {}; + final backgroundRows = + {}; - int currentRow = leadingRow; + var currentRow = leadingRow; while (currentRow <= trailingRow) { final _Span rowSpan = _rowMetrics[currentRow]!; final TreeRow configuration = rowSpan.configuration; @@ -579,7 +578,7 @@ class RenderTreeViewport extends RenderTwoDimensionalViewport { // Get to painting. // Background decorations first. backgroundRows.forEach((Rect rect, TreeRowDecoration decoration) { - final TreeRowDecorationPaintDetails paintingDetails = + final paintingDetails = TreeRowDecorationPaintDetails( canvas: context.canvas, rect: rect, @@ -588,7 +587,7 @@ class RenderTreeViewport extends RenderTwoDimensionalViewport { decoration.paint(paintingDetails); }); // Child nodes. - for (int row = leadingRow; row <= trailingRow; row++) { + for (var row = leadingRow; row <= trailingRow; row++) { final RenderBox child = getChildFor( TreeVicinity(depth: _rowDepths[row]!, row: row), )!; @@ -601,7 +600,7 @@ class RenderTreeViewport extends RenderTwoDimensionalViewport { } // Foreground decorations. foregroundRows.forEach((Rect rect, TreeRowDecoration decoration) { - final TreeRowDecorationPaintDetails paintingDetails = + final paintingDetails = TreeRowDecorationPaintDetails( canvas: context.canvas, rect: rect, @@ -668,7 +667,7 @@ class _Span _disposeRecognizers(); return; } - final Map newRecognizers = + final newRecognizers = {}; for (final Type type in configuration.recognizerFactories.keys) { assert(!newRecognizers.containsKey(type)); diff --git a/packages/two_dimensional_scrollables/lib/src/tree_view/tree.dart b/packages/two_dimensional_scrollables/lib/src/tree_view/tree.dart index b026767d6c0..3c5fa67bf13 100644 --- a/packages/two_dimensional_scrollables/lib/src/tree_view/tree.dart +++ b/packages/two_dimensional_scrollables/lib/src/tree_view/tree.dart @@ -774,8 +774,8 @@ class _TreeViewState extends State> @override TreeViewNode? getNodeFor(T content) => _getNode(content, widget.tree); TreeViewNode? _getNode(T content, List> tree) { - final List> nextDepth = >[]; - for (final TreeViewNode node in tree) { + final nextDepth = >[]; + for (final node in tree) { if (node.content == content) { return node; } @@ -799,7 +799,7 @@ class _TreeViewState extends State> @override void expandAll() { - final List> activeNodesToExpand = >[]; + final activeNodesToExpand = >[]; _expandAll(widget.tree, activeNodesToExpand); activeNodesToExpand.reversed.forEach(toggleNode); } @@ -808,7 +808,7 @@ class _TreeViewState extends State> List> tree, List> activeNodesToExpand, ) { - for (final TreeViewNode node in tree) { + for (final node in tree) { if (node.children.isNotEmpty) { // This is a parent node. // Expand all the children, and their children. @@ -831,7 +831,7 @@ class _TreeViewState extends State> @override void collapseAll() { - final List> activeNodesToCollapse = >[]; + final activeNodesToCollapse = >[]; _collapseAll(widget.tree, activeNodesToCollapse); activeNodesToCollapse.reversed.forEach(toggleNode); } @@ -840,7 +840,7 @@ class _TreeViewState extends State> List> tree, List> activeNodesToCollapse, ) { - for (final TreeViewNode node in tree) { + for (final node in tree) { if (node.children.isNotEmpty) { // This is a parent node. // Collapse all the children, and their children. @@ -942,7 +942,7 @@ class _TreeViewState extends State> case AnimationStatus.completed: } - final CurvedAnimation newAnimation = CurvedAnimation( + final newAnimation = CurvedAnimation( parent: controller, curve: widget.toggleAnimationStyle?.curve ?? diff --git a/packages/two_dimensional_scrollables/lib/src/tree_view/tree_span.dart b/packages/two_dimensional_scrollables/lib/src/tree_view/tree_span.dart index bc7e6a896b2..f0211f9799c 100644 --- a/packages/two_dimensional_scrollables/lib/src/tree_view/tree_span.dart +++ b/packages/two_dimensional_scrollables/lib/src/tree_view/tree_span.dart @@ -103,7 +103,7 @@ class TreeRowBorder extends SpanBorder { @override void paint(SpanDecorationPaintDetails details, BorderRadius? borderRadius) { - final Border border = Border( + final border = Border( top: top, bottom: bottom, left: left, diff --git a/packages/two_dimensional_scrollables/test/common/span_test.dart b/packages/two_dimensional_scrollables/test/common/span_test.dart index d7f9611dbbe..c1a39454fd3 100644 --- a/packages/two_dimensional_scrollables/test/common/span_test.dart +++ b/packages/two_dimensional_scrollables/test/common/span_test.dart @@ -10,7 +10,7 @@ import 'package:two_dimensional_scrollables/two_dimensional_scrollables.dart'; void main() { group('SpanExtent', () { test('FixedSpanExtent', () { - FixedSpanExtent extent = const FixedSpanExtent(150); + var extent = const FixedSpanExtent(150); expect( extent.calculateExtent( const SpanExtentDelegate(precedingExtent: 0, viewportExtent: 0), @@ -39,7 +39,7 @@ void main() { }); test('FractionalSpanExtent', () { - FractionalSpanExtent extent = const FractionalSpanExtent(0.5); + var extent = const FractionalSpanExtent(0.5); expect( extent.calculateExtent( const SpanExtentDelegate(precedingExtent: 0, viewportExtent: 0), @@ -68,7 +68,7 @@ void main() { }); test('RemainingSpanExtent', () { - const RemainingSpanExtent extent = RemainingSpanExtent(); + const extent = RemainingSpanExtent(); expect( extent.calculateExtent( const SpanExtentDelegate(precedingExtent: 0, viewportExtent: 0), @@ -84,7 +84,7 @@ void main() { }); test('CombiningSpanExtent', () { - final CombiningSpanExtent extent = CombiningSpanExtent( + final extent = CombiningSpanExtent( const FixedSpanExtent(100), const RemainingSpanExtent(), (double a, double b) { @@ -106,7 +106,7 @@ void main() { }); test('MaxSpanExtent', () { - const MaxSpanExtent extent = MaxSpanExtent( + const extent = MaxSpanExtent( FixedSpanExtent(100), RemainingSpanExtent(), ); @@ -125,7 +125,7 @@ void main() { }); test('MinSpanExtent', () { - const MinSpanExtent extent = MinSpanExtent( + const extent = MinSpanExtent( FixedSpanExtent(100), RemainingSpanExtent(), ); @@ -145,20 +145,20 @@ void main() { }); test('SpanDecoration', () { - SpanDecoration decoration = const SpanDecoration(color: Color(0xffff0000)); - final TestCanvas canvas = TestCanvas(); - const Rect rect = Rect.fromLTWH(0, 0, 10, 10); - final SpanDecorationPaintDetails details = SpanDecorationPaintDetails( + var decoration = const SpanDecoration(color: Color(0xffff0000)); + final canvas = TestCanvas(); + const rect = Rect.fromLTWH(0, 0, 10, 10); + final details = SpanDecorationPaintDetails( canvas: canvas, rect: rect, axisDirection: AxisDirection.down, ); - final BorderRadius radius = BorderRadius.circular(10.0); + final radius = BorderRadius.circular(10.0); decoration.paint(details); expect(canvas.rect, rect); expect(canvas.paint.color, const Color(0xffff0000)); expect(canvas.paint.isAntiAlias, isFalse); - final TestSpanBorder border = TestSpanBorder(leading: const BorderSide()); + final border = TestSpanBorder(leading: const BorderSide()); decoration = SpanDecoration(border: border, borderRadius: radius); decoration.paint(details); expect(border.details, details); diff --git a/packages/two_dimensional_scrollables/test/table_view/table_cell_test.dart b/packages/two_dimensional_scrollables/test/table_view/table_cell_test.dart index be7482776b1..b9815c175ab 100644 --- a/packages/two_dimensional_scrollables/test/table_view/table_cell_test.dart +++ b/packages/two_dimensional_scrollables/test/table_view/table_cell_test.dart @@ -11,7 +11,7 @@ const TableSpan span = TableSpan(extent: FixedTableSpanExtent(100)); void main() { test('TableVicinity converts ChildVicinity', () { - const TableVicinity vicinity = TableVicinity(column: 5, row: 10); + const vicinity = TableVicinity(column: 5, row: 10); expect(vicinity.xIndex, 5); expect(vicinity.yIndex, 10); expect(vicinity.row, 10); @@ -177,7 +177,7 @@ void main() { ) async { // Merge span start is greater than given index, ex: column 10 has merge // start at 20. - final List exceptions = []; + final exceptions = []; final FlutterExceptionHandler? oldHandler = FlutterError.onError; FlutterError.onError = (FlutterErrorDetails details) { exceptions.add(details.exception); @@ -194,7 +194,7 @@ void main() { // | | // +---------+ // This cell should only be built for (0, 1) and (0, 2), not (0,0). - TableViewCell cell = const TableViewCell( + var cell = const TableViewCell( rowMergeStart: 1, rowMergeSpan: 2, child: SizedBox.shrink(), @@ -253,13 +253,13 @@ void main() { ) async { // Merge exceeds table content, ex: at column 10, cell spans 4 columns, // but table only has 12 columns. - final List exceptions = []; + final exceptions = []; final FlutterExceptionHandler? oldHandler = FlutterError.onError; FlutterError.onError = (FlutterErrorDetails details) { exceptions.add(details.exception); }; // Row - TableViewCell cell = const TableViewCell( + var cell = const TableViewCell( rowMergeStart: 0, rowMergeSpan: 10, // Exceeds the number of rows child: SizedBox.shrink(), @@ -313,13 +313,13 @@ void main() { ) async { // Merge spans pinned and unpinned cells, ex: column 0 is pinned, 0-2 // expected merge. - final List exceptions = []; + final exceptions = []; final FlutterExceptionHandler? oldHandler = FlutterError.onError; FlutterError.onError = (FlutterErrorDetails details) { exceptions.add(details.exception); }; // Row - TableViewCell cell = const TableViewCell( + var cell = const TableViewCell( rowMergeStart: 0, rowMergeSpan: 3, child: SizedBox.shrink(), @@ -397,7 +397,7 @@ void main() { // | | | // +---------+--------+--------+ // ... ... ... - final Map mergedColumns = + final mergedColumns = { const TableVicinity(row: 0, column: 1): (1, 2), // M(0, 1) const TableVicinity(row: 0, column: 2): (1, 2), // M(0, 1) @@ -406,7 +406,7 @@ void main() { const TableVicinity(row: 2, column: 1): (1, 2), // M(1, 1) const TableVicinity(row: 2, column: 2): (1, 2), // M(1, 1) }; - final Map mergedRows = + final mergedRows = { TableVicinity.zero: (0, 2), // M(0, 0) TableVicinity.zero.copyWith(row: 1): (0, 2), // M(0,0) diff --git a/packages/two_dimensional_scrollables/test/table_view/table_delegate_test.dart b/packages/two_dimensional_scrollables/test/table_view/table_delegate_test.dart index 69a0ef23004..d2ccb460c8a 100644 --- a/packages/two_dimensional_scrollables/test/table_view/table_delegate_test.dart +++ b/packages/two_dimensional_scrollables/test/table_view/table_delegate_test.dart @@ -12,7 +12,7 @@ const TableViewCell cell = TableViewCell(child: SizedBox.shrink()); void main() { group('TableCellBuilderDelegate', () { test('exposes addAutomaticKeepAlives from super class', () { - final TableCellBuilderDelegate delegate = TableCellBuilderDelegate( + final delegate = TableCellBuilderDelegate( cellBuilder: (_, __) => cell, columnBuilder: (_) => span, rowBuilder: (_) => span, @@ -147,7 +147,7 @@ void main() { }); test('sets max x and y index of super class', () { - final TableCellBuilderDelegate delegate = TableCellBuilderDelegate( + final delegate = TableCellBuilderDelegate( cellBuilder: (_, __) => cell, columnBuilder: (_) => span, rowBuilder: (_) => span, @@ -159,7 +159,7 @@ void main() { }); test('Respects super class default for addRepaintBoundaries', () { - final TableCellBuilderDelegate delegate = TableCellBuilderDelegate( + final delegate = TableCellBuilderDelegate( cellBuilder: (_, __) => cell, columnBuilder: (_) => span, rowBuilder: (_) => span, @@ -171,14 +171,14 @@ void main() { }); test('Notifies listeners & rebuilds', () { - int notified = 0; + var notified = 0; TableCellBuilderDelegate oldDelegate; TableSpan spanBuilder(int index) => span; TableViewCell cellBuilder(BuildContext context, TableVicinity vicinity) { return cell; } - final TableCellBuilderDelegate delegate = TableCellBuilderDelegate( + final delegate = TableCellBuilderDelegate( cellBuilder: cellBuilder, columnBuilder: spanBuilder, rowBuilder: spanBuilder, @@ -222,7 +222,7 @@ void main() { group('TableCellListDelegate', () { test('exposes addAutomaticKeepAlives from super class', () { - final TableCellListDelegate delegate = TableCellListDelegate( + final delegate = TableCellListDelegate( cells: >[[]], columnBuilder: (_) => span, rowBuilder: (_) => span, @@ -337,10 +337,10 @@ void main() { }); test('Notifies listeners & rebuilds', () { - int notified = 0; + var notified = 0; TableCellListDelegate oldDelegate; TableSpan spanBuilder(int index) => span; - TableCellListDelegate delegate = TableCellListDelegate( + var delegate = TableCellListDelegate( cells: >[ [cell, cell], [cell, cell], @@ -457,7 +457,7 @@ void main() { }); test('Changing pinned row and column counts asserts valid values', () { - final TableCellListDelegate delegate = TableCellListDelegate( + final delegate = TableCellListDelegate( cells: >[ [cell, cell, cell], [cell, cell, cell], diff --git a/packages/two_dimensional_scrollables/test/table_view/table_span_test.dart b/packages/two_dimensional_scrollables/test/table_view/table_span_test.dart index d0a8010bf04..3b3ca73fe06 100644 --- a/packages/two_dimensional_scrollables/test/table_view/table_span_test.dart +++ b/packages/two_dimensional_scrollables/test/table_view/table_span_test.dart @@ -10,7 +10,7 @@ import 'package:two_dimensional_scrollables/two_dimensional_scrollables.dart'; void main() { group('TableSpanExtent', () { test('FixedTableSpanExtent', () { - FixedTableSpanExtent extent = const FixedTableSpanExtent(150); + var extent = const FixedTableSpanExtent(150); expect( extent.calculateExtent( const TableSpanExtentDelegate(precedingExtent: 0, viewportExtent: 0), @@ -42,7 +42,7 @@ void main() { }); test('FractionalTableSpanExtent', () { - FractionalTableSpanExtent extent = const FractionalTableSpanExtent(0.5); + var extent = const FractionalTableSpanExtent(0.5); expect( extent.calculateExtent( const TableSpanExtentDelegate(precedingExtent: 0, viewportExtent: 0), @@ -74,7 +74,7 @@ void main() { }); test('RemainingTableSpanExtent', () { - const RemainingTableSpanExtent extent = RemainingTableSpanExtent(); + const extent = RemainingTableSpanExtent(); expect( extent.calculateExtent( const TableSpanExtentDelegate(precedingExtent: 0, viewportExtent: 0), @@ -93,7 +93,7 @@ void main() { }); test('CombiningTableSpanExtent', () { - final CombiningTableSpanExtent extent = CombiningTableSpanExtent( + final extent = CombiningTableSpanExtent( const FixedTableSpanExtent(100), const RemainingTableSpanExtent(), (double a, double b) { @@ -118,7 +118,7 @@ void main() { }); test('MaxTableSpanExtent', () { - const MaxTableSpanExtent extent = MaxTableSpanExtent( + const extent = MaxTableSpanExtent( FixedTableSpanExtent(100), RemainingTableSpanExtent(), ); @@ -140,7 +140,7 @@ void main() { }); test('MinTableSpanExtent', () { - const MinTableSpanExtent extent = MinTableSpanExtent( + const extent = MinTableSpanExtent( FixedTableSpanExtent(100), RemainingTableSpanExtent(), ); @@ -163,23 +163,23 @@ void main() { }); test('TableSpanDecoration', () { - TableSpanDecoration decoration = const TableSpanDecoration( + var decoration = const TableSpanDecoration( color: Color(0xffff0000), ); - final TestCanvas canvas = TestCanvas(); - const Rect rect = Rect.fromLTWH(0, 0, 10, 10); - final TableSpanDecorationPaintDetails details = + final canvas = TestCanvas(); + const rect = Rect.fromLTWH(0, 0, 10, 10); + final details = TableSpanDecorationPaintDetails( canvas: canvas, rect: rect, axisDirection: AxisDirection.down, ); - final BorderRadius radius = BorderRadius.circular(10.0); + final radius = BorderRadius.circular(10.0); decoration.paint(details); expect(canvas.rect, rect); expect(canvas.paint.color, const Color(0xffff0000)); expect(canvas.paint.isAntiAlias, isFalse); - final TestTableSpanBorder border = TestTableSpanBorder( + final border = TestTableSpanBorder( leading: const BorderSide(), ); decoration = TableSpanDecoration(border: border, borderRadius: radius); @@ -218,7 +218,7 @@ void main() { testWidgets('Vertical main axis, vertical reversed', ( WidgetTester tester, ) async { - final TableView table = TableView.builder( + final table = TableView.builder( verticalDetails: ScrollableDetails.vertical( controller: verticalController, reverse: true, @@ -324,7 +324,7 @@ void main() { testWidgets('Vertical main axis, horizontal reversed', ( WidgetTester tester, ) async { - final TableView table = TableView.builder( + final table = TableView.builder( verticalDetails: ScrollableDetails.vertical( controller: verticalController, ), @@ -430,7 +430,7 @@ void main() { testWidgets('Vertical main axis, both reversed', ( WidgetTester tester, ) async { - final TableView table = TableView.builder( + final table = TableView.builder( verticalDetails: ScrollableDetails.vertical( controller: verticalController, reverse: true, @@ -537,7 +537,7 @@ void main() { testWidgets('Horizontal main axis, vertical reversed', ( WidgetTester tester, ) async { - final TableView table = TableView.builder( + final table = TableView.builder( mainAxis: Axis.horizontal, verticalDetails: ScrollableDetails.vertical( controller: verticalController, @@ -644,7 +644,7 @@ void main() { testWidgets('Horizontal main axis, horizontal reversed', ( WidgetTester tester, ) async { - final TableView table = TableView.builder( + final table = TableView.builder( mainAxis: Axis.horizontal, verticalDetails: ScrollableDetails.vertical( controller: verticalController, @@ -751,7 +751,7 @@ void main() { testWidgets('Horizontal main axis, both reversed', ( WidgetTester tester, ) async { - final TableView table = TableView.builder( + final table = TableView.builder( mainAxis: Axis.horizontal, verticalDetails: ScrollableDetails.vertical( controller: verticalController, @@ -884,7 +884,7 @@ void main() { // |*********|********| | // |*********|********| | // +---------+--------+--------+ - final Map scenario1MergedRows = + final scenario1MergedRows = { TableVicinity.zero: (0, 2), TableVicinity.zero.copyWith(row: 1): (0, 2), @@ -947,7 +947,7 @@ void main() { // |////////| |M(2,2)***********| // |////////| |*****************| // +--------+--------+--------+--------+ - final Map scenario2MergedColumns = + final scenario2MergedColumns = { TableVicinity.zero: (0, 2), TableVicinity.zero.copyWith(column: 1): (0, 2), @@ -1013,7 +1013,7 @@ void main() { // |////////| | | // |////////| | | // +--------+--------+--------+--------+ - final Map scenario3MergedRows = + final scenario3MergedRows = { TableVicinity.zero: (0, 2), const TableVicinity(row: 1, column: 0): (0, 2), @@ -1024,7 +1024,7 @@ void main() { const TableVicinity(row: 1, column: 3): (1, 2), const TableVicinity(row: 2, column: 3): (1, 2), }; - final Map scenario3MergedColumns = + final scenario3MergedColumns = { TableVicinity.zero: (0, 2), const TableVicinity(row: 1, column: 0): (0, 2), diff --git a/packages/two_dimensional_scrollables/test/table_view/table_test.dart b/packages/two_dimensional_scrollables/test/table_view/table_test.dart index 8893edef189..5eab50e2b61 100644 --- a/packages/two_dimensional_scrollables/test/table_view/table_test.dart +++ b/packages/two_dimensional_scrollables/test/table_view/table_test.dart @@ -42,14 +42,14 @@ TableSpan getMouseTrackingSpan( void main() { group('TableView.builder', () { test('creates correct delegate', () { - final TableView tableView = TableView.builder( + final tableView = TableView.builder( columnCount: 3, rowCount: 2, rowBuilder: (_) => span, columnBuilder: (_) => span, cellBuilder: (_, __) => cell, ); - final TableCellBuilderDelegate delegate = + final delegate = tableView.delegate as TableCellBuilderDelegate; expect(delegate.pinnedRowCount, 0); expect(delegate.pinnedRowCount, 0); @@ -180,7 +180,7 @@ void main() { group('Infinite spans - ', () { late ScrollController verticalController; late ScrollController horizontalController; - const TableSpan largeSpan = TableSpan(extent: FixedTableSpanExtent(200)); + const largeSpan = TableSpan(extent: FixedTableSpanExtent(200)); setUp(() { verticalController = ScrollController(); @@ -838,7 +838,7 @@ void main() { WidgetTester tester, ) async { // Nothing pinned --- - bool calledOutOfBounds = false; + var calledOutOfBounds = false; await tester.pumpWidget( MaterialApp( home: getTableView( @@ -1371,7 +1371,7 @@ void main() { WidgetTester tester, ) async { // Nothing pinned --- - bool calledOutOfBounds = false; + var calledOutOfBounds = false; await tester.pumpWidget( MaterialApp( home: getTableView( @@ -1640,8 +1640,8 @@ void main() { WidgetTester tester, ) async { // Nothing pinned --- - bool calledRowOutOfBounds = false; - bool calledColumnOutOfBounds = false; + var calledRowOutOfBounds = false; + var calledColumnOutOfBounds = false; await tester.pumpWidget( MaterialApp( home: getTableView( @@ -1978,12 +1978,12 @@ void main() { // cell if it extends into an area we have not computed the layout for // yet. const ({int start, int span}) rowConfig = (start: 0, span: 10); - final List mergedRows = List.generate( + final mergedRows = List.generate( 10, (int index) => index, ); const ({int start, int span}) columnConfig = (start: 1, span: 10); - final List mergedColumns = List.generate( + final mergedColumns = List.generate( 10, (int index) => index + 1, ); @@ -2040,13 +2040,13 @@ void main() { testWidgets('merged column that exceeds metrics will assert', ( WidgetTester tester, ) async { - final List exceptions = []; + final exceptions = []; final FlutterExceptionHandler? oldHandler = FlutterError.onError; FlutterError.onError = (FlutterErrorDetails details) { exceptions.add(details.exception); }; const ({int start, int span}) columnConfig = (start: 1, span: 10); - final List mergedColumns = List.generate( + final mergedColumns = List.generate( 10, (int index) => index + 1, ); @@ -2094,13 +2094,13 @@ void main() { testWidgets('merged row that exceeds metrics will assert', ( WidgetTester tester, ) async { - final List exceptions = []; + final exceptions = []; final FlutterExceptionHandler? oldHandler = FlutterError.onError; FlutterError.onError = (FlutterErrorDetails details) { exceptions.add(details.exception); }; const ({int start, int span}) rowConfig = (start: 0, span: 10); - final List mergedRows = List.generate( + final mergedRows = List.generate( 10, (int index) => index, ); @@ -2148,7 +2148,7 @@ void main() { group('TableView.list', () { test('creates correct delegate', () { - final TableView tableView = TableView.list( + final tableView = TableView.list( rowBuilder: (_) => span, columnBuilder: (_) => span, cells: const >[ @@ -2156,7 +2156,7 @@ void main() { [cell, cell, cell], ], ); - final TableCellListDelegate delegate = + final delegate = tableView.delegate as TableCellListDelegate; expect(delegate.pinnedRowCount, 0); expect(delegate.pinnedRowCount, 0); @@ -2215,10 +2215,10 @@ void main() { testWidgets('parent data and table vicinities', ( WidgetTester tester, ) async { - final Map childKeys = + final childKeys = {}; - const TableSpan span = TableSpan(extent: FixedTableSpanExtent(200)); - final TableView tableView = TableView.builder( + const span = TableSpan(extent: FixedTableSpanExtent(200)); + final tableView = TableView.builder( rowCount: 5, columnCount: 5, columnBuilder: (_) => span, @@ -2274,17 +2274,17 @@ void main() { }); testWidgets('TableSpanPadding', (WidgetTester tester) async { - final Map childKeys = + final childKeys = {}; - const TableSpan columnSpan = TableSpan( + const columnSpan = TableSpan( extent: FixedTableSpanExtent(200), padding: TableSpanPadding(leading: 10.0, trailing: 20.0), ); - const TableSpan rowSpan = TableSpan( + const rowSpan = TableSpan( extent: FixedTableSpanExtent(200), padding: TableSpanPadding(leading: 30.0, trailing: 40.0), ); - TableView tableView = TableView.builder( + var tableView = TableView.builder( rowCount: 2, columnCount: 2, columnBuilder: (_) => columnSpan, @@ -2382,9 +2382,9 @@ void main() { }); testWidgets('TableSpan gesture hit testing', (WidgetTester tester) async { - int tapCounter = 0; + var tapCounter = 0; // Rows - TableView tableView = TableView.builder( + var tableView = TableView.builder( rowCount: 50, columnCount: 50, columnBuilder: (_) => span, @@ -2467,8 +2467,8 @@ void main() { expect(tapCounter, 8); // Intersecting - main axis sets precedence - int rowTapCounter = 0; - int columnTapCounter = 0; + var rowTapCounter = 0; + var columnTapCounter = 0; tableView = TableView.builder( rowCount: 50, columnCount: 50, @@ -2556,11 +2556,11 @@ void main() { testWidgets('provides correct details in TableSpanExtentDelegate', ( WidgetTester tester, ) async { - final TestTableSpanExtent columnExtent = TestTableSpanExtent(); - final TestTableSpanExtent rowExtent = TestTableSpanExtent(); - final ScrollController verticalController = ScrollController(); - final ScrollController horizontalController = ScrollController(); - final TableView tableView = TableView.builder( + final columnExtent = TestTableSpanExtent(); + final rowExtent = TestTableSpanExtent(); + final verticalController = ScrollController(); + final horizontalController = ScrollController(); + final tableView = TableView.builder( rowCount: 10, columnCount: 10, columnBuilder: (_) => TableSpan(extent: columnExtent), @@ -2612,7 +2612,7 @@ void main() { ) async { // Huge padding, first span layout // Column-wise - TableView tableView = TableView.builder( + var tableView = TableView.builder( rowCount: 50, columnCount: 50, columnBuilder: (_) => const TableSpan( @@ -2683,7 +2683,7 @@ void main() { ) async { // Check with gradually accrued paddings // Column-wise - TableView tableView = TableView.builder( + var tableView = TableView.builder( rowCount: 50, columnCount: 50, columnBuilder: (_) => @@ -2803,9 +2803,9 @@ void main() { }); testWidgets('regular layout - no pinning', (WidgetTester tester) async { - final ScrollController verticalController = ScrollController(); - final ScrollController horizontalController = ScrollController(); - final TableView tableView = TableView.builder( + final verticalController = ScrollController(); + final horizontalController = ScrollController(); + final tableView = TableView.builder( rowCount: 50, columnCount: 50, columnBuilder: (_) => span, @@ -2882,9 +2882,9 @@ void main() { testWidgets('pinned rows and columns', (WidgetTester tester) async { // Just pinned rows - final ScrollController verticalController = ScrollController(); - final ScrollController horizontalController = ScrollController(); - TableView tableView = TableView.builder( + final verticalController = ScrollController(); + final horizontalController = ScrollController(); + var tableView = TableView.builder( rowCount: 50, pinnedRowCount: 1, columnCount: 50, @@ -3124,9 +3124,9 @@ void main() { }); testWidgets('only paints visible cells', (WidgetTester tester) async { - final ScrollController verticalController = ScrollController(); - final ScrollController horizontalController = ScrollController(); - final TableView tableView = TableView.builder( + final verticalController = ScrollController(); + final horizontalController = ScrollController(); + final tableView = TableView.builder( rowCount: 50, columnCount: 50, columnBuilder: (_) => span, @@ -3193,7 +3193,7 @@ void main() { testWidgets('paints decorations in correct order', ( WidgetTester tester, ) async { - TableView tableView = TableView.builder( + var tableView = TableView.builder( rowCount: 2, columnCount: 2, columnBuilder: (int index) => TableSpan( @@ -3470,7 +3470,7 @@ void main() { WidgetTester tester, ) async { // Both reversed - Regression test for https://github.com/flutter/flutter/issues/135386 - TableView tableView = TableView.builder( + var tableView = TableView.builder( verticalDetails: const ScrollableDetails.vertical(reverse: true), horizontalDetails: const ScrollableDetails.horizontal(reverse: true), rowCount: 2, @@ -3563,9 +3563,9 @@ void main() { }); testWidgets('mouse handling', (WidgetTester tester) async { - int enterCounter = 0; - int exitCounter = 0; - final TableView tableView = TableView.builder( + var enterCounter = 0; + var exitCounter = 0; + final tableView = TableView.builder( rowCount: 50, columnCount: 50, columnBuilder: (_) => span, @@ -3623,7 +3623,7 @@ void main() { // Regression tests for https://github.com/flutter/flutter/issues/143526 // These tests all use the same collection of merged pinned cells in a // variety of combinations. - final Map bothMerged = + final bothMerged = { TableVicinity.zero: (start: 0, span: 2), const TableVicinity(row: 1, column: 0): (start: 0, span: 2), @@ -3631,7 +3631,7 @@ void main() { const TableVicinity(row: 1, column: 1): (start: 0, span: 2), }; - final Map rowMerged = + final rowMerged = { const TableVicinity(row: 2, column: 0): (start: 2, span: 2), const TableVicinity(row: 3, column: 0): (start: 2, span: 2), @@ -3640,7 +3640,7 @@ void main() { const TableVicinity(row: 6, column: 1): (start: 4, span: 3), }; - final Map columnMerged = + final columnMerged = { const TableVicinity(row: 0, column: 2): (start: 2, span: 2), const TableVicinity(row: 0, column: 3): (start: 2, span: 2), @@ -3648,12 +3648,12 @@ void main() { const TableVicinity(row: 1, column: 5): (start: 4, span: 3), const TableVicinity(row: 1, column: 6): (start: 4, span: 3), }; - const TableSpan span = TableSpan(extent: FixedTableSpanExtent(75)); + const span = TableSpan(extent: FixedTableSpanExtent(75)); testWidgets('Normal axes', (WidgetTester tester) async { - final ScrollController verticalController = ScrollController(); - final ScrollController horizontalController = ScrollController(); - final TableView tableView = TableView.builder( + final verticalController = ScrollController(); + final horizontalController = ScrollController(); + final tableView = TableView.builder( verticalDetails: ScrollableDetails.vertical( controller: verticalController, ), @@ -3761,9 +3761,9 @@ void main() { }); testWidgets('Vertical reversed', (WidgetTester tester) async { - final ScrollController verticalController = ScrollController(); - final ScrollController horizontalController = ScrollController(); - final TableView tableView = TableView.builder( + final verticalController = ScrollController(); + final horizontalController = ScrollController(); + final tableView = TableView.builder( verticalDetails: ScrollableDetails.vertical( reverse: true, controller: verticalController, @@ -3872,9 +3872,9 @@ void main() { }); testWidgets('Horizontal reversed', (WidgetTester tester) async { - final ScrollController verticalController = ScrollController(); - final ScrollController horizontalController = ScrollController(); - final TableView tableView = TableView.builder( + final verticalController = ScrollController(); + final horizontalController = ScrollController(); + final tableView = TableView.builder( verticalDetails: ScrollableDetails.vertical( controller: verticalController, ), @@ -3983,9 +3983,9 @@ void main() { }); testWidgets('Both reversed', (WidgetTester tester) async { - final ScrollController verticalController = ScrollController(); - final ScrollController horizontalController = ScrollController(); - final TableView tableView = TableView.builder( + final verticalController = ScrollController(); + final horizontalController = ScrollController(); + final tableView = TableView.builder( verticalDetails: ScrollableDetails.vertical( reverse: true, controller: verticalController, @@ -4099,15 +4099,15 @@ void main() { testWidgets( 'Merged unpinned cells following pinned cells are laid out correctly', (WidgetTester tester) async { - final ScrollController verticalController = ScrollController(); - final ScrollController horizontalController = ScrollController(); - final Set mergedCell = { + final verticalController = ScrollController(); + final horizontalController = ScrollController(); + final mergedCell = { const TableVicinity(row: 2, column: 2), const TableVicinity(row: 3, column: 2), const TableVicinity(row: 2, column: 3), const TableVicinity(row: 3, column: 3), }; - final TableView tableView = TableView.builder( + final tableView = TableView.builder( columnCount: 10, rowCount: 10, columnBuilder: (_) => diff --git a/packages/two_dimensional_scrollables/test/tree_view/render_tree_test.dart b/packages/two_dimensional_scrollables/test/tree_view/render_tree_test.dart index f3f4b9ba204..99f0267f780 100644 --- a/packages/two_dimensional_scrollables/test/tree_view/render_tree_test.dart +++ b/packages/two_dimensional_scrollables/test/tree_view/render_tree_test.dart @@ -135,9 +135,9 @@ void main() { }); testWidgets('TreeRow gesture hit testing', (WidgetTester tester) async { - int tapCounter = 0; - final List log = []; - final TreeView treeView = TreeView( + var tapCounter = 0; + final log = []; + final treeView = TreeView( tree: treeNodes, treeRowBuilder: (TreeViewNode node) { if (node.depth! == 0) { @@ -165,9 +165,9 @@ void main() { }); testWidgets('mouse handling', (WidgetTester tester) async { - int enterCounter = 0; - int exitCounter = 0; - final TreeView treeView = TreeView( + var enterCounter = 0; + var exitCounter = 0; + final treeView = TreeView( tree: treeNodes, treeRowBuilder: (TreeViewNode node) { if (node.depth! == 0) { @@ -216,12 +216,12 @@ void main() { testWidgets('Scrolls when there is enough content', ( WidgetTester tester, ) async { - final ScrollController verticalController = ScrollController(); - final ScrollController horizontalController = ScrollController(); - final TreeViewController treeController = TreeViewController(); + final verticalController = ScrollController(); + final horizontalController = ScrollController(); + final treeController = TreeViewController(); addTearDown(verticalController.dispose); addTearDown(horizontalController.dispose); - final TreeView treeView = TreeView( + final treeView = TreeView( controller: treeController, verticalDetails: ScrollableDetails.vertical( controller: verticalController, @@ -266,7 +266,7 @@ void main() { testWidgets('Basic', (WidgetTester tester) async { // Default layout, custom indentation values, row extents. - TreeView treeView = TreeView(tree: treeNodes); + var treeView = TreeView(tree: treeNodes); await tester.pumpWidget(MaterialApp(home: treeView)); await tester.pump(); expect(find.text('First'), findsOneWidget); @@ -439,7 +439,7 @@ void main() { }); testWidgets('Animating node segment', (WidgetTester tester) async { - TreeView treeView = TreeView(tree: treeNodes); + var treeView = TreeView(tree: treeNodes); await tester.pumpWidget(MaterialApp(home: treeView)); await tester.pump(); expect(find.text('alpha'), findsNothing); @@ -559,7 +559,7 @@ void main() { testWidgets('Multiple animating node segments', ( WidgetTester tester, ) async { - final TreeViewController controller = TreeViewController(); + final controller = TreeViewController(); await tester.pumpWidget( MaterialApp( home: TreeView(tree: treeNodes, controller: controller), @@ -669,9 +669,9 @@ void main() { }); testWidgets('only paints visible rows', (WidgetTester tester) async { - final ScrollController verticalController = ScrollController(); + final verticalController = ScrollController(); addTearDown(verticalController.dispose); - final TreeView treeView = TreeView( + final treeView = TreeView( treeRowBuilder: (_) => const TreeRow(extent: FixedTreeRowExtent(400)), tree: treeNodes, verticalDetails: ScrollableDetails.vertical( @@ -695,23 +695,23 @@ void main() { }); testWidgets('paints decorations correctly', (WidgetTester tester) async { - final ScrollController verticalController = ScrollController(); - final ScrollController horizontalController = ScrollController(); + final verticalController = ScrollController(); + final horizontalController = ScrollController(); addTearDown(verticalController.dispose); addTearDown(horizontalController.dispose); - const TreeRowDecoration rootForegroundDecoration = TreeRowDecoration( + const rootForegroundDecoration = TreeRowDecoration( color: Colors.red, ); - const TreeRowDecoration rootBackgroundDecoration = TreeRowDecoration( + const rootBackgroundDecoration = TreeRowDecoration( color: Colors.blue, ); - const TreeRowDecoration foregroundDecoration = TreeRowDecoration( + const foregroundDecoration = TreeRowDecoration( color: Colors.orange, ); - const TreeRowDecoration backgroundDecoration = TreeRowDecoration( + const backgroundDecoration = TreeRowDecoration( color: Colors.green, ); - final TreeView treeView = TreeView( + final treeView = TreeView( verticalDetails: ScrollableDetails.vertical( controller: verticalController, ), diff --git a/packages/two_dimensional_scrollables/test/tree_view/tree_delegate_test.dart b/packages/two_dimensional_scrollables/test/tree_view/tree_delegate_test.dart index d4d9fbc41bf..5ffdc74f1be 100644 --- a/packages/two_dimensional_scrollables/test/tree_view/tree_delegate_test.dart +++ b/packages/two_dimensional_scrollables/test/tree_view/tree_delegate_test.dart @@ -10,7 +10,7 @@ const TreeRow span = TreeRow(extent: FixedTreeRowExtent(50)); void main() { test('TreeVicinity converts ChildVicinity', () { - const TreeVicinity vicinity = TreeVicinity(depth: 5, row: 10); + const vicinity = TreeVicinity(depth: 5, row: 10); expect(vicinity.xIndex, 5); expect(vicinity.yIndex, 10); expect(vicinity.row, 10); @@ -20,7 +20,7 @@ void main() { group('TreeRowBuilderDelegate', () { test('exposes addAutomaticKeepAlives from super class', () { - final TreeRowBuilderDelegate delegate = TreeRowBuilderDelegate( + final delegate = TreeRowBuilderDelegate( nodeBuilder: (_, __) => const SizedBox(), rowBuilder: (_) => span, rowCount: 6, @@ -52,7 +52,7 @@ void main() { }); test('sets max y index (not x) of super class', () { - final TreeRowBuilderDelegate delegate = TreeRowBuilderDelegate( + final delegate = TreeRowBuilderDelegate( nodeBuilder: (_, __) => const SizedBox(), rowBuilder: (_) => span, rowCount: 6, @@ -62,10 +62,10 @@ void main() { }); test('Notifies listeners & rebuilds', () { - bool notified = false; + var notified = false; TreeRowBuilderDelegate oldDelegate; - final TreeRowBuilderDelegate delegate = TreeRowBuilderDelegate( + final delegate = TreeRowBuilderDelegate( nodeBuilder: (_, __) => const SizedBox(), rowBuilder: (_) => span, rowCount: 6, diff --git a/packages/two_dimensional_scrollables/test/tree_view/tree_span_test.dart b/packages/two_dimensional_scrollables/test/tree_view/tree_span_test.dart index c51bd29e68d..96e481befec 100644 --- a/packages/two_dimensional_scrollables/test/tree_view/tree_span_test.dart +++ b/packages/two_dimensional_scrollables/test/tree_view/tree_span_test.dart @@ -10,7 +10,7 @@ import 'package:two_dimensional_scrollables/two_dimensional_scrollables.dart'; void main() { group('TreeRowExtent', () { test('FixedTreeRowExtent', () { - FixedTreeRowExtent extent = const FixedTreeRowExtent(150); + var extent = const FixedTreeRowExtent(150); expect( extent.calculateExtent( const TreeRowExtentDelegate(precedingExtent: 0, viewportExtent: 0), @@ -42,7 +42,7 @@ void main() { }); test('FractionalTreeRowExtent', () { - FractionalTreeRowExtent extent = const FractionalTreeRowExtent(0.5); + var extent = const FractionalTreeRowExtent(0.5); expect( extent.calculateExtent( const TreeRowExtentDelegate(precedingExtent: 0, viewportExtent: 0), @@ -74,7 +74,7 @@ void main() { }); test('RemainingTreeRowExtent', () { - const RemainingTreeRowExtent extent = RemainingTreeRowExtent(); + const extent = RemainingTreeRowExtent(); expect( extent.calculateExtent( const TreeRowExtentDelegate(precedingExtent: 0, viewportExtent: 0), @@ -93,7 +93,7 @@ void main() { }); test('CombiningTreeRowExtent', () { - final CombiningTreeRowExtent extent = CombiningTreeRowExtent( + final extent = CombiningTreeRowExtent( const FixedTreeRowExtent(100), const RemainingTreeRowExtent(), (double a, double b) { @@ -118,7 +118,7 @@ void main() { }); test('MaxTreeRowExtent', () { - const MaxTreeRowExtent extent = MaxTreeRowExtent( + const extent = MaxTreeRowExtent( FixedTreeRowExtent(100), RemainingTreeRowExtent(), ); @@ -140,7 +140,7 @@ void main() { }); test('MinTreeRowExtent', () { - const MinTreeRowExtent extent = MinTreeRowExtent( + const extent = MinTreeRowExtent( FixedTreeRowExtent(100), RemainingTreeRowExtent(), ); @@ -163,22 +163,22 @@ void main() { }); test('TreeRowDecoration', () { - TreeRowDecoration decoration = const TreeRowDecoration( + var decoration = const TreeRowDecoration( color: Color(0xffff0000), ); - final TestCanvas canvas = TestCanvas(); - const Rect rect = Rect.fromLTWH(0, 0, 10, 10); - final TreeRowDecorationPaintDetails details = TreeRowDecorationPaintDetails( + final canvas = TestCanvas(); + const rect = Rect.fromLTWH(0, 0, 10, 10); + final details = TreeRowDecorationPaintDetails( canvas: canvas, rect: rect, axisDirection: AxisDirection.down, ); - final BorderRadius radius = BorderRadius.circular(10.0); + final radius = BorderRadius.circular(10.0); decoration.paint(details); expect(canvas.rect, rect); expect(canvas.paint.color, const Color(0xffff0000)); expect(canvas.paint.isAntiAlias, isFalse); - final TestTreeRowBorder border = TestTreeRowBorder(top: const BorderSide()); + final border = TestTreeRowBorder(top: const BorderSide()); decoration = TreeRowDecoration(border: border, borderRadius: radius); decoration.paint(details); expect(border.details, details); diff --git a/packages/two_dimensional_scrollables/test/tree_view/tree_test.dart b/packages/two_dimensional_scrollables/test/tree_view/tree_test.dart index 0bc08e8ed3b..5c44ca700d6 100644 --- a/packages/two_dimensional_scrollables/test/tree_view/tree_test.dart +++ b/packages/two_dimensional_scrollables/test/tree_view/tree_test.dart @@ -30,10 +30,10 @@ List> simpleNodeSet = >[ void main() { group('TreeViewNode', () { test('getters, toString', () { - final List> children = >[ + final children = >[ TreeViewNode('child'), ]; - final TreeViewNode node = TreeViewNode( + final node = TreeViewNode( 'parent', children: children, expanded: true, @@ -63,10 +63,10 @@ void main() { testWidgets('TreeView sets ups parent and depth properties', ( WidgetTester tester, ) async { - final List> children = >[ + final children = >[ TreeViewNode('child'), ]; - final TreeViewNode node = TreeViewNode( + final node = TreeViewNode( 'parent', children: children, expanded: true, @@ -121,7 +121,7 @@ void main() { ]; }); testWidgets('Can set controller on TreeView', (WidgetTester tester) async { - final TreeViewController controller = TreeViewController(); + final controller = TreeViewController(); TreeViewController? returnedController; await tester.pumpWidget( MaterialApp( @@ -177,7 +177,7 @@ void main() { testWidgets('Can get node for TreeViewNode.content', ( WidgetTester tester, ) async { - final TreeViewController controller = TreeViewController(); + final controller = TreeViewController(); await tester.pumpWidget( MaterialApp( home: TreeView(tree: simpleNodeSet, controller: controller), @@ -188,7 +188,7 @@ void main() { }); testWidgets('Can get isExpanded for a node', (WidgetTester tester) async { - final TreeViewController controller = TreeViewController(); + final controller = TreeViewController(); await tester.pumpWidget( MaterialApp( home: TreeView(tree: simpleNodeSet, controller: controller), @@ -199,7 +199,7 @@ void main() { }); testWidgets('Can get isActive for a node', (WidgetTester tester) async { - final TreeViewController controller = TreeViewController(); + final controller = TreeViewController(); await tester.pumpWidget( MaterialApp( home: TreeView(tree: simpleNodeSet, controller: controller), @@ -215,7 +215,7 @@ void main() { testWidgets('Can toggleNode, to collapse or expand', ( WidgetTester tester, ) async { - final TreeViewController controller = TreeViewController(); + final controller = TreeViewController(); await tester.pumpWidget( MaterialApp( home: TreeView(tree: simpleNodeSet, controller: controller), @@ -248,7 +248,7 @@ void main() { testWidgets('Can expandNode, then collapseAll', ( WidgetTester tester, ) async { - final TreeViewController controller = TreeViewController(); + final controller = TreeViewController(); await tester.pumpWidget( MaterialApp( home: TreeView(tree: simpleNodeSet, controller: controller), @@ -281,7 +281,7 @@ void main() { testWidgets('Can collapseNode, then expandAll', ( WidgetTester tester, ) async { - final TreeViewController controller = TreeViewController(); + final controller = TreeViewController(); await tester.pumpWidget( MaterialApp( home: TreeView(tree: simpleNodeSet, controller: controller), @@ -376,9 +376,9 @@ void main() { }); testWidgets('.toggleNodeWith, onNodeToggle', (WidgetTester tester) async { - final TreeViewController controller = TreeViewController(); + final controller = TreeViewController(); // The default node builder wraps the leading icon with toggleNodeWith. - bool toggled = false; + var toggled = false; TreeViewNode? toggledNode; await tester.pumpWidget( MaterialApp( @@ -550,7 +550,7 @@ void main() { testWidgets('Adding more root TreeViewNodes are reflected in the tree', ( WidgetTester tester, ) async { - final TreeViewController controller = TreeViewController(); + final controller = TreeViewController(); await tester.pumpWidget( MaterialApp( home: StatefulBuilder( @@ -602,7 +602,7 @@ void main() { testWidgets( 'Adding more TreeViewNodes below the root are reflected in the tree', (WidgetTester tester) async { - final TreeViewController controller = TreeViewController(); + final controller = TreeViewController(); await tester.pumpWidget( MaterialApp( home: StatefulBuilder( @@ -655,7 +655,7 @@ void main() { ); test('should use the generic type for callbacks and builders', () { - final TreeView treeView = TreeView( + final treeView = TreeView( tree: simpleNodeSet, treeNodeBuilder: ( @@ -684,8 +684,8 @@ void main() { 'TreeViewNode should expand/collapse correctly when the animation duration is set to zero.', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/154292 - final TreeViewController controller = TreeViewController(); - final List> tree = >[ + final controller = TreeViewController(); + final tree = >[ TreeViewNode('First'), TreeViewNode( 'Second', @@ -784,8 +784,8 @@ void main() { testWidgets( 'TreeViewNode should close all child nodes when collapsed, once the animation is completed', (WidgetTester tester) async { - final TreeViewController controller = TreeViewController(); - final List> tree = >[ + final controller = TreeViewController(); + final tree = >[ TreeViewNode( 'First', expanded: true, @@ -857,11 +857,11 @@ void main() { testWidgets('Expand then collapse with offscreen nodes (top)', ( WidgetTester tester, ) async { - final ScrollController verticalController = ScrollController(); - final TreeViewController controller = TreeViewController(); + final verticalController = ScrollController(); + final controller = TreeViewController(); addTearDown(verticalController.dispose); - final List> tree = >[ + final tree = >[ TreeViewNode( 'alpha', children: >[ diff --git a/packages/url_launcher/url_launcher/example/lib/encoding.dart b/packages/url_launcher/url_launcher/example/lib/encoding.dart index 4e0b558d429..a2f541ebb45 100644 --- a/packages/url_launcher/url_launcher/example/lib/encoding.dart +++ b/packages/url_launcher/url_launcher/example/lib/encoding.dart @@ -41,7 +41,7 @@ void main() => runApp( void _composeMail() { // #docregion encode-query-parameters - final Uri emailLaunchUri = Uri( + final emailLaunchUri = Uri( scheme: 'mailto', path: 'smith@example.com', query: encodeQueryParameters({ diff --git a/packages/url_launcher/url_launcher/example/lib/files.dart b/packages/url_launcher/url_launcher/example/lib/files.dart index 76f3b9d80ab..676c0a3cf87 100644 --- a/packages/url_launcher/url_launcher/example/lib/files.dart +++ b/packages/url_launcher/url_launcher/example/lib/files.dart @@ -28,11 +28,11 @@ Future _openFile() async { ...p.split(Directory.systemTemp.path), 'flutter_url_launcher_example.txt', ]); - final File testFile = File(tempFilePath); + final testFile = File(tempFilePath); await testFile.writeAsString('Hello, world!'); // #docregion file final String filePath = testFile.absolute.path; - final Uri uri = Uri.file(filePath); + final uri = Uri.file(filePath); if (!File(uri.toFilePath()).existsSync()) { throw Exception('$uri does not exist!'); diff --git a/packages/url_launcher/url_launcher/example/lib/main.dart b/packages/url_launcher/url_launcher/example/lib/main.dart index 61f17104b55..3d5e01c3545 100644 --- a/packages/url_launcher/url_launcher/example/lib/main.dart +++ b/packages/url_launcher/url_launcher/example/lib/main.dart @@ -130,7 +130,7 @@ class _MyHomePageState extends State { } Future _makePhoneCall(String phoneNumber) async { - final Uri launchUri = Uri(scheme: 'tel', path: phoneNumber); + final launchUri = Uri(scheme: 'tel', path: phoneNumber); await launchUrl(launchUri); } @@ -138,7 +138,7 @@ class _MyHomePageState extends State { Widget build(BuildContext context) { // onPressed calls using this URL are not gated on a 'canLaunch' check // because the assumption is that every device can launch a web URL. - final Uri toLaunch = Uri( + final toLaunch = Uri( scheme: 'https', host: 'www.cylog.org', path: 'headers/', diff --git a/packages/url_launcher/url_launcher/lib/src/legacy_api.dart b/packages/url_launcher/url_launcher/lib/src/legacy_api.dart index 60727c35162..a7adefb58e7 100644 --- a/packages/url_launcher/url_launcher/lib/src/legacy_api.dart +++ b/packages/url_launcher/url_launcher/lib/src/legacy_api.dart @@ -88,7 +88,7 @@ Future launch( } /// [true] so that ui is automatically computed if [statusBarBrightness] is set. - bool previousAutomaticSystemUiAdjustment = true; + var previousAutomaticSystemUiAdjustment = true; final RenderView? renderViewToAdjust = statusBarBrightness != null && defaultTargetPlatform == TargetPlatform.iOS ? _findImplicitRenderView() diff --git a/packages/url_launcher/url_launcher/lib/src/link.dart b/packages/url_launcher/url_launcher/lib/src/link.dart index 95f315beb39..79c7351d3a6 100644 --- a/packages/url_launcher/url_launcher/lib/src/link.dart +++ b/packages/url_launcher/url_launcher/lib/src/link.dart @@ -114,7 +114,7 @@ class DefaultLinkDelegate extends StatelessWidget { // A uri that doesn't have a scheme is an internal route name. In this // case, we push it via Flutter's navigation system instead of letting the // browser handle it. - final String routeName = link.uri.toString(); + final routeName = link.uri.toString(); await pushRouteToFrameworkFunction(context, routeName); return; } diff --git a/packages/url_launcher/url_launcher/test/link_test.dart b/packages/url_launcher/url_launcher/test/link_test.dart index ad89cac7139..d8094b968fe 100644 --- a/packages/url_launcher/url_launcher/test/link_test.dart +++ b/packages/url_launcher/url_launcher/test/link_test.dart @@ -21,10 +21,10 @@ void main() { group('Link', () { testWidgets('handles null uri correctly', (WidgetTester tester) async { - bool isBuilt = false; + var isBuilt = false; FollowLink? followLink; - final Link link = Link( + final link = Link( uri: null, builder: (BuildContext context, FollowLink? followLink2) { isBuilt = true; @@ -130,7 +130,7 @@ void main() { ), ); - bool frameworkCalled = false; + var frameworkCalled = false; final Future Function(Object?, String) originalPushFunction = pushRouteToFrameworkFunction; pushRouteToFrameworkFunction = (Object? _, String __) { diff --git a/packages/url_launcher/url_launcher/test/src/legacy_api_test.dart b/packages/url_launcher/url_launcher/test/src/legacy_api_test.dart index 3223b8fff39..49057b706e3 100644 --- a/packages/url_launcher/url_launcher/test/src/legacy_api_test.dart +++ b/packages/url_launcher/url_launcher/test/src/legacy_api_test.dart @@ -12,7 +12,7 @@ import 'package:url_launcher_platform_interface/url_launcher_platform_interface. import '../mocks/mock_url_launcher_platform.dart'; void main() { - final MockUrlLauncher mock = MockUrlLauncher(); + final mock = MockUrlLauncher(); UrlLauncherPlatform.instance = mock; test('closeWebView default behavior', () async { @@ -284,7 +284,7 @@ void main() { final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized(); debugDefaultTargetPlatformOverride = TargetPlatform.iOS; - final RenderView renderView = RenderView( + final renderView = RenderView( view: binding.platformDispatcher.implicitView!, ); binding.addRenderView(renderView); @@ -320,7 +320,7 @@ void main() { final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized(); debugDefaultTargetPlatformOverride = TargetPlatform.android; - final RenderView renderView = RenderView( + final renderView = RenderView( view: binding.platformDispatcher.implicitView!, ); binding.addRenderView(renderView); diff --git a/packages/url_launcher/url_launcher/test/src/url_launcher_string_test.dart b/packages/url_launcher/url_launcher/test/src/url_launcher_string_test.dart index 87316572325..0fdd19d7f3a 100644 --- a/packages/url_launcher/url_launcher/test/src/url_launcher_string_test.dart +++ b/packages/url_launcher/url_launcher/test/src/url_launcher_string_test.dart @@ -10,12 +10,12 @@ import 'package:url_launcher_platform_interface/url_launcher_platform_interface. import '../mocks/mock_url_launcher_platform.dart'; void main() { - final MockUrlLauncher mock = MockUrlLauncher(); + final mock = MockUrlLauncher(); UrlLauncherPlatform.instance = mock; group('canLaunchUrlString', () { test('handles returning true', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setCanLaunchExpectations(urlString) ..setResponse(true); @@ -26,7 +26,7 @@ void main() { }); test('handles returning false', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setCanLaunchExpectations(urlString) ..setResponse(false); @@ -39,7 +39,7 @@ void main() { group('launchUrlString', () { test('default behavior with web URL', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setLaunchExpectations( url: urlString, @@ -56,7 +56,7 @@ void main() { }); test('default behavior with non-web URL', () async { - const String urlString = 'customscheme:foo'; + const urlString = 'customscheme:foo'; mock ..setLaunchExpectations( url: urlString, @@ -73,7 +73,7 @@ void main() { }); test('explicit default launch mode with web URL', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setLaunchExpectations( url: urlString, @@ -90,7 +90,7 @@ void main() { }); test('explicit default launch mode with non-web URL', () async { - const String urlString = 'customscheme:foo'; + const urlString = 'customscheme:foo'; mock ..setLaunchExpectations( url: urlString, @@ -107,7 +107,7 @@ void main() { }); test('in-app webview', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setLaunchExpectations( url: urlString, @@ -127,7 +127,7 @@ void main() { }); test('external browser', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setLaunchExpectations( url: urlString, @@ -147,7 +147,7 @@ void main() { }); test('in-app browser', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setLaunchExpectations( url: urlString, @@ -167,7 +167,7 @@ void main() { }); test('in-app browser with title', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setLaunchExpectations( url: urlString, @@ -191,7 +191,7 @@ void main() { }); test('external non-browser only', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setLaunchExpectations( url: urlString, @@ -214,7 +214,7 @@ void main() { }); test('in-app webview without javascript', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setLaunchExpectations( url: urlString, @@ -240,7 +240,7 @@ void main() { }); test('in-app webview without DOM storage', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setLaunchExpectations( url: urlString, @@ -266,7 +266,7 @@ void main() { }); test('in-app webview with headers', () async { - const String urlString = 'https://flutter.dev'; + const urlString = 'https://flutter.dev'; mock ..setLaunchExpectations( url: urlString, @@ -300,7 +300,7 @@ void main() { }); test('non-web URL with default options', () async { - const String emailLaunchUrlString = + const emailLaunchUrlString = 'mailto:smith@example.com?subject=Hello'; mock ..setLaunchExpectations( @@ -319,7 +319,7 @@ void main() { test('allows non-parsable url', () async { // Not a valid Dart [Uri], but a valid URL on at least some platforms. - const String urlString = + const urlString = 'rdp://full%20address=s:mypc:3389&audiomode=i:2&disable%20themes=i:1'; mock ..setLaunchExpectations( diff --git a/packages/url_launcher/url_launcher/test/src/url_launcher_uri_test.dart b/packages/url_launcher/url_launcher/test/src/url_launcher_uri_test.dart index 0d4ad505715..c2949a5b9cd 100644 --- a/packages/url_launcher/url_launcher/test/src/url_launcher_uri_test.dart +++ b/packages/url_launcher/url_launcher/test/src/url_launcher_uri_test.dart @@ -10,7 +10,7 @@ import 'package:url_launcher_platform_interface/url_launcher_platform_interface. import '../mocks/mock_url_launcher_platform.dart'; void main() { - final MockUrlLauncher mock = MockUrlLauncher(); + final mock = MockUrlLauncher(); UrlLauncherPlatform.instance = mock; test('closeInAppWebView', () async { @@ -281,7 +281,7 @@ void main() { }); test('non-web URL with default options', () async { - final Uri emailLaunchUrl = Uri( + final emailLaunchUrl = Uri( scheme: 'mailto', path: 'smith@example.com', queryParameters: {'subject': 'Hello'}, diff --git a/packages/url_launcher/url_launcher_android/example/integration_test/url_launcher_test.dart b/packages/url_launcher/url_launcher_android/example/integration_test/url_launcher_test.dart index 0321d82c33e..5b129af9645 100644 --- a/packages/url_launcher/url_launcher_android/example/integration_test/url_launcher_test.dart +++ b/packages/url_launcher/url_launcher_android/example/integration_test/url_launcher_test.dart @@ -40,8 +40,8 @@ void main() { }), ); // Https to avoid cleartext warning on android. - final String prefixUrl = 'https://${server.address.address}:${server.port}'; - final String primaryUrl = '$prefixUrl/hello.txt'; + final prefixUrl = 'https://${server.address.address}:${server.port}'; + final primaryUrl = '$prefixUrl/hello.txt'; // Launch a url then close. expect( diff --git a/packages/url_launcher/url_launcher_android/example/lib/main.dart b/packages/url_launcher/url_launcher_android/example/lib/main.dart index 04502c916f1..71c4e5fbfac 100644 --- a/packages/url_launcher/url_launcher_android/example/lib/main.dart +++ b/packages/url_launcher/url_launcher_android/example/lib/main.dart @@ -151,7 +151,7 @@ class _MyHomePageState extends State { Future _makePhoneCall(String phoneNumber) async { // Use `Uri` to ensure that `phoneNumber` is properly URL-encoded. // Just using 'tel:$phoneNumber' would create invalid URLs in some cases. - final Uri launchUri = Uri(scheme: 'tel', path: phoneNumber); + final launchUri = Uri(scheme: 'tel', path: phoneNumber); await launcher.launchUrl(launchUri.toString(), const LaunchOptions()); } @@ -159,7 +159,7 @@ class _MyHomePageState extends State { Widget build(BuildContext context) { // onPressed calls using this URL are not gated on a 'canLaunch' check // because the assumption is that every device can launch a web URL. - const String toLaunch = 'https://www.cylog.org/headers/'; + const toLaunch = 'https://www.cylog.org/headers/'; return Scaffold( appBar: AppBar(title: Text(widget.title)), body: ListView( diff --git a/packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart b/packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart index 2d3c3da6050..dbe301f799f 100644 --- a/packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart +++ b/packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart @@ -77,7 +77,7 @@ class UrlLauncherAndroid extends UrlLauncherPlatform { @override Future launchUrl(String url, LaunchOptions options) async { final bool inApp; - bool requireNonBrowser = false; + var requireNonBrowser = false; switch (options.mode) { case PreferredLaunchMode.inAppWebView: case PreferredLaunchMode.inAppBrowserView: diff --git a/packages/url_launcher/url_launcher_android/test/url_launcher_android_test.dart b/packages/url_launcher/url_launcher_android/test/url_launcher_android_test.dart index c8678d927a9..5a561679a2e 100644 --- a/packages/url_launcher/url_launcher_android/test/url_launcher_android_test.dart +++ b/packages/url_launcher/url_launcher_android/test/url_launcher_android_test.dart @@ -22,21 +22,21 @@ void main() { group('canLaunch', () { test('returns true', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool canLaunch = await launcher.canLaunch('http://example.com/'); expect(canLaunch, true); }); test('returns false', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool canLaunch = await launcher.canLaunch('unknown://scheme'); expect(canLaunch, false); }); test('checks a generic URL if an http URL returns false', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool canLaunch = await launcher.canLaunch( 'http://${_FakeUrlLauncherApi.specialHandlerDomain}', ); @@ -45,7 +45,7 @@ void main() { }); test('checks a generic URL if an https URL returns false', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool canLaunch = await launcher.canLaunch( 'https://${_FakeUrlLauncherApi.specialHandlerDomain}', ); @@ -56,7 +56,7 @@ void main() { group('legacy launch without webview', () { test('calls through', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool launched = await launcher.launch( 'http://example.com/', useSafariVC: true, @@ -73,7 +73,7 @@ void main() { }); test('passes headers', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await launcher.launch( 'http://example.com/', useSafariVC: true, @@ -88,7 +88,7 @@ void main() { }); test('passes through no-activity exception', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await expectLater( launcher.launch( 'https://noactivity', @@ -104,7 +104,7 @@ void main() { }); test('throws if there is no handling activity', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await expectLater( launcher.launch( 'unknown://scheme', @@ -128,7 +128,7 @@ void main() { group('legacy launch with webview', () { test('calls through', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool launched = await launcher.launch( 'http://example.com/', useSafariVC: true, @@ -147,7 +147,7 @@ void main() { }); test('passes enableJavaScript to webview', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await launcher.launch( 'http://example.com/', useSafariVC: true, @@ -162,7 +162,7 @@ void main() { }); test('passes enableDomStorage to webview', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await launcher.launch( 'http://example.com/', useSafariVC: true, @@ -177,7 +177,7 @@ void main() { }); test('passes showTitle to webview', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await launcher.launchUrl( 'http://example.com/', const LaunchOptions( @@ -189,7 +189,7 @@ void main() { }); test('passes through no-activity exception', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await expectLater( launcher.launch( 'https://noactivity', @@ -205,7 +205,7 @@ void main() { }); test('throws if there is no handling activity', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await expectLater( launcher.launch( 'unknown://scheme', @@ -229,7 +229,7 @@ void main() { group('launch without webview', () { test('calls through', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool launched = await launcher.launchUrl( 'http://example.com/', const LaunchOptions(mode: PreferredLaunchMode.externalApplication), @@ -241,7 +241,7 @@ void main() { }); test('passes headers', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await launcher.launchUrl( 'http://example.com/', const LaunchOptions( @@ -256,7 +256,7 @@ void main() { }); test('passes non-browser flag', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool launched = await launcher.launchUrl( 'http://example.com/', const LaunchOptions( @@ -269,7 +269,7 @@ void main() { }); test('passes through no-activity exception', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await expectLater( launcher.launchUrl('https://noactivity', const LaunchOptions()), throwsA(isA()), @@ -277,7 +277,7 @@ void main() { }); test('throws if there is no handling activity', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await expectLater( launcher.launchUrl('unknown://scheme', const LaunchOptions()), throwsA( @@ -293,7 +293,7 @@ void main() { group('launch with webview', () { test('calls through', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool launched = await launcher.launchUrl( 'http://example.com/', const LaunchOptions(mode: PreferredLaunchMode.inAppWebView), @@ -307,7 +307,7 @@ void main() { }); test('passes enableJavaScript to webview', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await launcher.launchUrl( 'http://example.com/', const LaunchOptions( @@ -322,7 +322,7 @@ void main() { }); test('passes enableDomStorage to webview', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await launcher.launchUrl( 'http://example.com/', const LaunchOptions( @@ -337,7 +337,7 @@ void main() { }); test('passes through no-activity exception', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await expectLater( launcher.launchUrl( 'https://noactivity', @@ -348,7 +348,7 @@ void main() { }); test('throws if there is no handling activity', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); await expectLater( launcher.launchUrl( 'unknown://scheme', @@ -367,7 +367,7 @@ void main() { group('launch with custom tab', () { test('calls through', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool launched = await launcher.launchUrl( 'http://example.com/', const LaunchOptions(mode: PreferredLaunchMode.inAppBrowserView), @@ -380,7 +380,7 @@ void main() { group('launch with platform default', () { test('uses custom tabs for http', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool launched = await launcher.launchUrl( 'http://example.com/', const LaunchOptions(), @@ -391,7 +391,7 @@ void main() { }); test('uses custom tabs for https', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool launched = await launcher.launchUrl( 'https://example.com/', const LaunchOptions(), @@ -402,7 +402,7 @@ void main() { }); test('uses external for other schemes', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); final bool launched = await launcher.launchUrl( 'supportedcustomscheme://example.com/', const LaunchOptions(), @@ -414,7 +414,7 @@ void main() { group('supportsMode', () { test('returns true for platformDefault', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); expect( await launcher.supportsMode(PreferredLaunchMode.platformDefault), true, @@ -422,7 +422,7 @@ void main() { }); test('returns true for external application', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); expect( await launcher.supportsMode(PreferredLaunchMode.externalApplication), true, @@ -430,7 +430,7 @@ void main() { }); test('returns true for in app web view', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); expect( await launcher.supportsMode(PreferredLaunchMode.inAppWebView), true, @@ -438,7 +438,7 @@ void main() { }); test('returns true for in app browser view when available', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); api.hasCustomTabSupport = true; expect( await launcher.supportsMode(PreferredLaunchMode.inAppBrowserView), @@ -447,7 +447,7 @@ void main() { }); test('returns false for in app browser view when not available', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); api.hasCustomTabSupport = false; expect( await launcher.supportsMode(PreferredLaunchMode.inAppBrowserView), @@ -458,7 +458,7 @@ void main() { group('supportsCloseForMode', () { test('returns true for in app web view', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); expect( await launcher.supportsCloseForMode(PreferredLaunchMode.inAppWebView), true, @@ -466,7 +466,7 @@ void main() { }); test('returns false for other modes', () async { - final UrlLauncherAndroid launcher = UrlLauncherAndroid(api: api); + final launcher = UrlLauncherAndroid(api: api); expect( await launcher.supportsCloseForMode( PreferredLaunchMode.externalApplication, diff --git a/packages/url_launcher/url_launcher_ios/example/lib/main.dart b/packages/url_launcher/url_launcher_ios/example/lib/main.dart index ee0a12bf56e..1739c00fa8f 100644 --- a/packages/url_launcher/url_launcher_ios/example/lib/main.dart +++ b/packages/url_launcher/url_launcher_ios/example/lib/main.dart @@ -159,7 +159,7 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { - const String toLaunch = 'https://www.cylog.org/headers/'; + const toLaunch = 'https://www.cylog.org/headers/'; return Scaffold( appBar: AppBar(title: Text(widget.title)), body: ListView( diff --git a/packages/url_launcher/url_launcher_ios/test/url_launcher_ios_test.dart b/packages/url_launcher/url_launcher_ios/test/url_launcher_ios_test.dart index 2acf776aa91..37cb6f32222 100644 --- a/packages/url_launcher/url_launcher_ios/test/url_launcher_ios_test.dart +++ b/packages/url_launcher/url_launcher_ios/test/url_launcher_ios_test.dart @@ -33,7 +33,7 @@ void main() { when( api.canLaunchUrl(_webUrl), ).thenAnswer((_) async => LaunchResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect(await launcher.canLaunch(_webUrl), true); }); @@ -41,7 +41,7 @@ void main() { when( api.canLaunchUrl(_webUrl), ).thenAnswer((_) async => LaunchResult.failure); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect(await launcher.canLaunch(_webUrl), false); }); @@ -49,7 +49,7 @@ void main() { when( api.canLaunchUrl(_webUrl), ).thenAnswer((_) async => LaunchResult.invalidUrl); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); await expectLater( launcher.canLaunch(_webUrl), throwsA( @@ -68,7 +68,7 @@ void main() { when( api.launchUrl(_webUrl, any), ).thenAnswer((_) async => LaunchResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.launch( _webUrl, @@ -88,7 +88,7 @@ void main() { when( api.launchUrl(_webUrl, any), ).thenAnswer((_) async => LaunchResult.failure); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.launch( _webUrl, @@ -108,7 +108,7 @@ void main() { when( api.launchUrl(_webUrl, any), ).thenAnswer((_) async => LaunchResult.invalidUrl); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); await expectLater( launcher.launch( _webUrl, @@ -133,7 +133,7 @@ void main() { when( api.openUrlInSafariViewController(_webUrl), ).thenAnswer((_) async => InAppLoadResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.launch( _webUrl, @@ -153,7 +153,7 @@ void main() { when( api.launchUrl(_webUrl, any), ).thenAnswer((_) async => LaunchResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.launch( _webUrl, @@ -173,7 +173,7 @@ void main() { when( api.launchUrl(_webUrl, any), ).thenAnswer((_) async => LaunchResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.launch( _webUrl, @@ -191,7 +191,7 @@ void main() { }); test('closeWebView calls through', () async { - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); await launcher.closeWebView(); verify(api.closeSafariViewController()).called(1); }); @@ -201,7 +201,7 @@ void main() { when( api.launchUrl(_webUrl, any), ).thenAnswer((_) async => LaunchResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); final bool launched = await launcher.launchUrl( _webUrl, const LaunchOptions(mode: PreferredLaunchMode.externalApplication), @@ -214,7 +214,7 @@ void main() { when( api.launchUrl(_webUrl, any), ).thenAnswer((_) async => LaunchResult.invalidUrl); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); await expectLater( launcher.launchUrl( _webUrl, @@ -236,7 +236,7 @@ void main() { when( api.openUrlInSafariViewController(_webUrl), ).thenAnswer((_) async => InAppLoadResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); final bool launched = await launcher.launchUrl( _webUrl, const LaunchOptions(mode: PreferredLaunchMode.inAppWebView), @@ -249,7 +249,7 @@ void main() { when( api.openUrlInSafariViewController(_webUrl), ).thenAnswer((_) async => InAppLoadResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); final bool launched = await launcher.launchUrl( _webUrl, const LaunchOptions(mode: PreferredLaunchMode.inAppBrowserView), @@ -262,7 +262,7 @@ void main() { when( api.openUrlInSafariViewController(_webUrl), ).thenAnswer((_) async => InAppLoadResult.invalidUrl); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); await expectLater( launcher.launchUrl( _webUrl, @@ -282,7 +282,7 @@ void main() { when( api.openUrlInSafariViewController(_webUrl), ).thenAnswer((_) async => InAppLoadResult.failedToLoad); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); await expectLater( launcher.launchUrl( _webUrl, @@ -304,7 +304,7 @@ void main() { when( api.launchUrl(_webUrl, any), ).thenAnswer((_) async => LaunchResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); final bool launched = await launcher.launchUrl( _webUrl, const LaunchOptions( @@ -319,7 +319,7 @@ void main() { when( api.launchUrl(_webUrl, any), ).thenAnswer((_) async => LaunchResult.invalidUrl); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); await expectLater( launcher.launchUrl( _webUrl, @@ -340,11 +340,11 @@ void main() { group('launch with platform default', () { test('uses Safari view controller for http', () async { - const String httpUrl = 'http://example.com/'; + const httpUrl = 'http://example.com/'; when( api.openUrlInSafariViewController(httpUrl), ).thenAnswer((_) async => InAppLoadResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); final bool launched = await launcher.launchUrl( httpUrl, const LaunchOptions(), @@ -354,11 +354,11 @@ void main() { }); test('uses Safari view controller for https', () async { - const String httpsUrl = 'https://example.com/'; + const httpsUrl = 'https://example.com/'; when( api.openUrlInSafariViewController(httpsUrl), ).thenAnswer((_) async => InAppLoadResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); final bool launched = await launcher.launchUrl( httpsUrl, const LaunchOptions(), @@ -368,11 +368,11 @@ void main() { }); test('uses standard external for other schemes', () async { - const String nonWebUrl = 'supportedcustomscheme://example.com/'; + const nonWebUrl = 'supportedcustomscheme://example.com/'; when( api.launchUrl(nonWebUrl, any), ).thenAnswer((_) async => LaunchResult.success); - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); final bool launched = await launcher.launchUrl( nonWebUrl, const LaunchOptions(), @@ -384,7 +384,7 @@ void main() { group('supportsMode', () { test('returns true for platformDefault', () async { - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.supportsMode(PreferredLaunchMode.platformDefault), true, @@ -392,7 +392,7 @@ void main() { }); test('returns true for external application', () async { - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.supportsMode(PreferredLaunchMode.externalApplication), true, @@ -400,7 +400,7 @@ void main() { }); test('returns true for external non-browser application', () async { - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.supportsMode( PreferredLaunchMode.externalNonBrowserApplication, @@ -410,7 +410,7 @@ void main() { }); test('returns true for in app web view', () async { - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.supportsMode(PreferredLaunchMode.inAppWebView), true, @@ -418,7 +418,7 @@ void main() { }); test('returns true for in app browser view', () async { - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.supportsMode(PreferredLaunchMode.inAppBrowserView), true, @@ -428,7 +428,7 @@ void main() { group('supportsCloseForMode', () { test('returns true for in app web view', () async { - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.supportsCloseForMode(PreferredLaunchMode.inAppWebView), true, @@ -436,7 +436,7 @@ void main() { }); test('returns true for in app browser view', () async { - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.supportsCloseForMode( PreferredLaunchMode.inAppBrowserView, @@ -446,7 +446,7 @@ void main() { }); test('returns false for other modes', () async { - final UrlLauncherIOS launcher = UrlLauncherIOS(api: api); + final launcher = UrlLauncherIOS(api: api); expect( await launcher.supportsCloseForMode( PreferredLaunchMode.externalApplication, diff --git a/packages/url_launcher/url_launcher_linux/example/lib/main.dart b/packages/url_launcher/url_launcher_linux/example/lib/main.dart index e8d91be181d..8ca238f3f51 100644 --- a/packages/url_launcher/url_launcher_linux/example/lib/main.dart +++ b/packages/url_launcher/url_launcher_linux/example/lib/main.dart @@ -62,7 +62,7 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { - const String toLaunch = 'https://www.cylog.org/headers/'; + const toLaunch = 'https://www.cylog.org/headers/'; return Scaffold( appBar: AppBar(title: Text(widget.title)), body: ListView( diff --git a/packages/url_launcher/url_launcher_linux/test/url_launcher_linux_test.dart b/packages/url_launcher/url_launcher_linux/test/url_launcher_linux_test.dart index cc7a17b70dc..8b6ee6e2728 100644 --- a/packages/url_launcher/url_launcher_linux/test/url_launcher_linux_test.dart +++ b/packages/url_launcher/url_launcher_linux/test/url_launcher_linux_test.dart @@ -16,8 +16,8 @@ void main() { }); test('canLaunch passes true', () async { - final _FakeUrlLauncherApi api = _FakeUrlLauncherApi(); - final UrlLauncherLinux launcher = UrlLauncherLinux(api: api); + final api = _FakeUrlLauncherApi(); + final launcher = UrlLauncherLinux(api: api); final bool canLaunch = await launcher.canLaunch('http://example.com/'); @@ -25,8 +25,8 @@ void main() { }); test('canLaunch passes false', () async { - final _FakeUrlLauncherApi api = _FakeUrlLauncherApi(canLaunch: false); - final UrlLauncherLinux launcher = UrlLauncherLinux(api: api); + final api = _FakeUrlLauncherApi(canLaunch: false); + final launcher = UrlLauncherLinux(api: api); final bool canLaunch = await launcher.canLaunch('http://example.com/'); @@ -34,9 +34,9 @@ void main() { }); test('launch', () async { - final _FakeUrlLauncherApi api = _FakeUrlLauncherApi(); - final UrlLauncherLinux launcher = UrlLauncherLinux(api: api); - const String url = 'http://example.com/'; + final api = _FakeUrlLauncherApi(); + final launcher = UrlLauncherLinux(api: api); + const url = 'http://example.com/'; final bool launched = await launcher.launch( url, @@ -53,8 +53,8 @@ void main() { }); test('launch should throw if platform returns an error', () async { - final _FakeUrlLauncherApi api = _FakeUrlLauncherApi(error: 'An error'); - final UrlLauncherLinux launcher = UrlLauncherLinux(api: api); + final api = _FakeUrlLauncherApi(error: 'An error'); + final launcher = UrlLauncherLinux(api: api); await expectLater( launcher.launch( @@ -80,9 +80,9 @@ void main() { group('launchUrl', () { test('passes URL', () async { - final _FakeUrlLauncherApi api = _FakeUrlLauncherApi(); - final UrlLauncherLinux launcher = UrlLauncherLinux(api: api); - const String url = 'http://example.com/'; + final api = _FakeUrlLauncherApi(); + final launcher = UrlLauncherLinux(api: api); + const url = 'http://example.com/'; final bool launched = await launcher.launchUrl( url, @@ -94,8 +94,8 @@ void main() { }); test('throws if platform returns an error', () async { - final _FakeUrlLauncherApi api = _FakeUrlLauncherApi(error: 'An error'); - final UrlLauncherLinux launcher = UrlLauncherLinux(api: api); + final api = _FakeUrlLauncherApi(error: 'An error'); + final launcher = UrlLauncherLinux(api: api); await expectLater( launcher.launchUrl('http://example.com/', const LaunchOptions()), @@ -114,7 +114,7 @@ void main() { group('supportsMode', () { test('returns true for platformDefault', () async { - final UrlLauncherLinux launcher = UrlLauncherLinux(); + final launcher = UrlLauncherLinux(); expect( await launcher.supportsMode(PreferredLaunchMode.platformDefault), true, @@ -122,7 +122,7 @@ void main() { }); test('returns true for external application', () async { - final UrlLauncherLinux launcher = UrlLauncherLinux(); + final launcher = UrlLauncherLinux(); expect( await launcher.supportsMode(PreferredLaunchMode.externalApplication), true, @@ -130,7 +130,7 @@ void main() { }); test('returns false for other modes', () async { - final UrlLauncherLinux launcher = UrlLauncherLinux(); + final launcher = UrlLauncherLinux(); expect( await launcher.supportsMode( PreferredLaunchMode.externalNonBrowserApplication, @@ -149,7 +149,7 @@ void main() { }); test('supportsCloseForMode returns false', () async { - final UrlLauncherLinux launcher = UrlLauncherLinux(); + final launcher = UrlLauncherLinux(); expect( await launcher.supportsCloseForMode( PreferredLaunchMode.platformDefault, diff --git a/packages/url_launcher/url_launcher_macos/example/lib/main.dart b/packages/url_launcher/url_launcher_macos/example/lib/main.dart index e8d91be181d..8ca238f3f51 100644 --- a/packages/url_launcher/url_launcher_macos/example/lib/main.dart +++ b/packages/url_launcher/url_launcher_macos/example/lib/main.dart @@ -62,7 +62,7 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { - const String toLaunch = 'https://www.cylog.org/headers/'; + const toLaunch = 'https://www.cylog.org/headers/'; return Scaffold( appBar: AppBar(title: Text(widget.title)), body: ListView( diff --git a/packages/url_launcher/url_launcher_macos/test/url_launcher_macos_test.dart b/packages/url_launcher/url_launcher_macos/test/url_launcher_macos_test.dart index 2a81a6f9364..d1fb014975a 100644 --- a/packages/url_launcher/url_launcher_macos/test/url_launcher_macos_test.dart +++ b/packages/url_launcher/url_launcher_macos/test/url_launcher_macos_test.dart @@ -23,17 +23,17 @@ void main() { group('canLaunch', () { test('success', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); expect(await launcher.canLaunch('http://example.com/'), true); }); test('failure', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); expect(await launcher.canLaunch('unknown://scheme'), false); }); test('invalid URL returns a PlatformException', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); await expectLater( launcher.canLaunch('invalid://u r l'), throwsA(isA()), @@ -41,7 +41,7 @@ void main() { }); test('passes unexpected PlatformExceptions through', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); await expectLater( launcher.canLaunch('unexpectedthrow://someexception'), throwsA(isA()), @@ -51,7 +51,7 @@ void main() { group('launch', () { test('success', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); expect( await launcher.launch( 'http://example.com/', @@ -67,7 +67,7 @@ void main() { }); test('failure', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); expect( await launcher.launch( 'unknown://scheme', @@ -83,7 +83,7 @@ void main() { }); test('invalid URL returns a PlatformException', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); await expectLater( launcher.launch( 'invalid://u r l', @@ -99,7 +99,7 @@ void main() { }); test('passes unexpected PlatformExceptions through', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); await expectLater( launcher.launch( 'unexpectedthrow://someexception', @@ -117,7 +117,7 @@ void main() { group('supportsMode', () { test('returns true for platformDefault', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); expect( await launcher.supportsMode(PreferredLaunchMode.platformDefault), true, @@ -125,7 +125,7 @@ void main() { }); test('returns true for external application', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); expect( await launcher.supportsMode(PreferredLaunchMode.externalApplication), true, @@ -133,7 +133,7 @@ void main() { }); test('returns false for other modes', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); expect( await launcher.supportsMode( PreferredLaunchMode.externalNonBrowserApplication, @@ -152,7 +152,7 @@ void main() { }); test('supportsCloseForMode returns false', () async { - final UrlLauncherMacOS launcher = UrlLauncherMacOS(api: api); + final launcher = UrlLauncherMacOS(api: api); expect( await launcher.supportsCloseForMode( PreferredLaunchMode.platformDefault, diff --git a/packages/url_launcher/url_launcher_platform_interface/lib/link.dart b/packages/url_launcher/url_launcher_platform_interface/lib/link.dart index 421304e65e2..028a7b1e7a4 100644 --- a/packages/url_launcher/url_launcher_platform_interface/lib/link.dart +++ b/packages/url_launcher/url_launcher_platform_interface/lib/link.dart @@ -84,7 +84,7 @@ abstract class LinkInfo { /// Returns the raw data returned by the framework. // TODO(ianh): Remove the first argument. Future pushRouteNameToFramework(Object? _, String routeName) { - final Completer completer = Completer(); + final completer = Completer(); SystemNavigator.routeInformationUpdated(uri: Uri.parse(routeName)); ui.channelBuffers.push( 'flutter/navigation', diff --git a/packages/url_launcher/url_launcher_platform_interface/test/launch_options_test.dart b/packages/url_launcher/url_launcher_platform_interface/test/launch_options_test.dart index 546de38e17e..7d80b9ef0c4 100644 --- a/packages/url_launcher/url_launcher_platform_interface/test/launch_options_test.dart +++ b/packages/url_launcher/url_launcher_platform_interface/test/launch_options_test.dart @@ -19,10 +19,10 @@ void main() { test( 'passing non-default InAppBrowserConfiguration to LaunchOptions works', () { - const InAppBrowserConfiguration browserConfiguration = + const browserConfiguration = InAppBrowserConfiguration(showTitle: true); - const LaunchOptions launchOptions = LaunchOptions( + const launchOptions = LaunchOptions( browserConfiguration: browserConfiguration, ); diff --git a/packages/url_launcher/url_launcher_platform_interface/test/method_channel_url_launcher_test.dart b/packages/url_launcher/url_launcher_platform_interface/test/method_channel_url_launcher_test.dart index 0b405e8e02a..8e27fbad5d4 100644 --- a/packages/url_launcher/url_launcher_platform_interface/test/method_channel_url_launcher_test.dart +++ b/packages/url_launcher/url_launcher_platform_interface/test/method_channel_url_launcher_test.dart @@ -35,7 +35,7 @@ void main() { }); test('Can be mocked with `implements`', () { - final UrlLauncherPlatformMock mock = UrlLauncherPlatformMock(); + final mock = UrlLauncherPlatformMock(); UrlLauncherPlatform.instance = mock; }); @@ -45,10 +45,10 @@ void main() { }); group('$MethodChannelUrlLauncher', () { - const MethodChannel channel = MethodChannel( + const channel = MethodChannel( 'plugins.flutter.io/url_launcher', ); - final List log = []; + final log = []; TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler(channel, (MethodCall methodCall) async { log.add(methodCall); @@ -58,7 +58,7 @@ void main() { return null; }); - final MethodChannelUrlLauncher launcher = MethodChannelUrlLauncher(); + final launcher = MethodChannelUrlLauncher(); tearDown(() { log.clear(); diff --git a/packages/url_launcher/url_launcher_platform_interface/test/url_launcher_platform_test.dart b/packages/url_launcher/url_launcher_platform_interface/test/url_launcher_platform_test.dart index 7032ee21b2f..9aa4a8bc896 100644 --- a/packages/url_launcher/url_launcher_platform_interface/test/url_launcher_platform_test.dart +++ b/packages/url_launcher/url_launcher_platform_interface/test/url_launcher_platform_test.dart @@ -47,7 +47,7 @@ void main() { test( 'launchUrl calls through to launch with default options for web URL', () async { - final CapturingUrlLauncher launcher = CapturingUrlLauncher(); + final launcher = CapturingUrlLauncher(); await launcher.launchUrl('https://flutter.dev', const LaunchOptions()); @@ -65,7 +65,7 @@ void main() { test( 'launchUrl calls through to launch with default options for non-web URL', () async { - final CapturingUrlLauncher launcher = CapturingUrlLauncher(); + final launcher = CapturingUrlLauncher(); await launcher.launchUrl('tel:123456789', const LaunchOptions()); @@ -81,7 +81,7 @@ void main() { ); test('launchUrl calls through to launch with universal links', () async { - final CapturingUrlLauncher launcher = CapturingUrlLauncher(); + final launcher = CapturingUrlLauncher(); await launcher.launchUrl( 'https://flutter.dev', @@ -103,7 +103,7 @@ void main() { test( 'launchUrl calls through to launch with all non-default options', () async { - final CapturingUrlLauncher launcher = CapturingUrlLauncher(); + final launcher = CapturingUrlLauncher(); await launcher.launchUrl( 'https://flutter.dev', diff --git a/packages/url_launcher/url_launcher_web/example/integration_test/link_widget_test.dart b/packages/url_launcher/url_launcher_web/example/integration_test/link_widget_test.dart index d50ec191e71..3958e085345 100644 --- a/packages/url_launcher/url_launcher_web/example/integration_test/link_widget_test.dart +++ b/packages/url_launcher/url_launcher_web/example/integration_test/link_widget_test.dart @@ -19,7 +19,7 @@ import 'package:web/web.dart' as html; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - final List pushedRouteNames = []; + final pushedRouteNames = []; late Future Function(String) originalPushFunction; setUp(() { @@ -176,7 +176,7 @@ void main() { testWidgets('can be created and disposed', (WidgetTester tester) async { final Uri uri = Uri.parse('http://foobar'); - const int itemCount = 500; + const itemCount = 500; await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -1308,10 +1308,10 @@ void main() { } List _findAllAnchors() { - final List foundAnchors = []; + final foundAnchors = []; final html.NodeList anchors = html.document.querySelectorAll('a'); - for (int i = 0; i < anchors.length; i++) { - final html.Element anchor = anchors.item(i)! as html.Element; + for (var i = 0; i < anchors.length; i++) { + final anchor = anchors.item(i)! as html.Element; if (anchor.hasProperty(linkViewIdProperty.toJS).toDart) { foundAnchors.add(anchor); } @@ -1331,7 +1331,7 @@ html.MouseEvent _simulateClick(html.Element target, {bool metaKey = false}) { // (html.Event e) { // e.preventDefault(); // }.toJS); - final html.MouseEvent mouseEvent = html.MouseEvent( + final mouseEvent = html.MouseEvent( 'click', html.MouseEventInit(bubbles: true, cancelable: true, metaKey: metaKey), ); @@ -1343,7 +1343,7 @@ html.KeyboardEvent _simulateKeydown( html.Element target, { bool metaKey = false, }) { - final html.KeyboardEvent keydownEvent = html.KeyboardEvent( + final keydownEvent = html.KeyboardEvent( 'keydown', html.KeyboardEventInit( bubbles: true, diff --git a/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.dart b/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.dart index ef887d61a68..9c1200eb2bc 100644 --- a/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.dart +++ b/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.dart @@ -41,7 +41,7 @@ void main() { mockNavigator = MockNavigator(); jsMockWindow = createJSInteropWrapper(mockWindow) as html.Window; - final html.Navigator jsMockNavigator = + final jsMockNavigator = createJSInteropWrapper(mockNavigator) as html.Navigator; when(mockWindow.navigator).thenReturn(jsMockNavigator); 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 502157c0d4d..f42c20bcc6f 100644 --- a/packages/url_launcher/url_launcher_web/lib/src/link.dart +++ b/packages/url_launcher/url_launcher_web/lib/src/link.dart @@ -346,7 +346,7 @@ class LinkViewController extends PlatformViewController { String semanticsIdentifier, ) { final int viewId = params.id; - final LinkViewController controller = LinkViewController( + final controller = LinkViewController( viewId, semanticsIdentifier, ); @@ -523,7 +523,7 @@ class LinkViewController extends PlatformViewController { _element.setAttribute('aria-hidden', 'true'); _element.setAttribute('tabIndex', '-1'); - final Map args = { + final args = { 'id': viewId, 'viewType': linkViewType, }; @@ -560,7 +560,7 @@ class LinkViewController extends PlatformViewController { // Internal links are pushed through Flutter's navigation system instead of // letting the browser handle it. mouseEvent?.preventDefault(); - final String routeName = controller._uri.toString(); + final routeName = controller._uri.toString(); pushRouteToFrameworkFunction(routeName); } diff --git a/packages/url_launcher/url_launcher_windows/example/lib/main.dart b/packages/url_launcher/url_launcher_windows/example/lib/main.dart index e8d91be181d..8ca238f3f51 100644 --- a/packages/url_launcher/url_launcher_windows/example/lib/main.dart +++ b/packages/url_launcher/url_launcher_windows/example/lib/main.dart @@ -62,7 +62,7 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { - const String toLaunch = 'https://www.cylog.org/headers/'; + const toLaunch = 'https://www.cylog.org/headers/'; return Scaffold( appBar: AppBar(title: Text(widget.title)), body: ListView( diff --git a/packages/url_launcher/url_launcher_windows/test/url_launcher_windows_test.dart b/packages/url_launcher/url_launcher_windows/test/url_launcher_windows_test.dart index c8bd5a97a25..1140cb25214 100644 --- a/packages/url_launcher/url_launcher_windows/test/url_launcher_windows_test.dart +++ b/packages/url_launcher/url_launcher_windows/test/url_launcher_windows_test.dart @@ -100,7 +100,7 @@ void main() { group('supportsMode', () { test('returns true for platformDefault', () async { - final UrlLauncherWindows launcher = UrlLauncherWindows(api: api); + final launcher = UrlLauncherWindows(api: api); expect( await launcher.supportsMode(PreferredLaunchMode.platformDefault), true, @@ -108,7 +108,7 @@ void main() { }); test('returns true for external application', () async { - final UrlLauncherWindows launcher = UrlLauncherWindows(api: api); + final launcher = UrlLauncherWindows(api: api); expect( await launcher.supportsMode(PreferredLaunchMode.externalApplication), true, @@ -116,7 +116,7 @@ void main() { }); test('returns false for other modes', () async { - final UrlLauncherWindows launcher = UrlLauncherWindows(api: api); + final launcher = UrlLauncherWindows(api: api); expect( await launcher.supportsMode( PreferredLaunchMode.externalNonBrowserApplication, @@ -135,7 +135,7 @@ void main() { }); test('supportsCloseForMode returns false', () async { - final UrlLauncherWindows launcher = UrlLauncherWindows(api: api); + final launcher = UrlLauncherWindows(api: api); expect( await launcher.supportsCloseForMode(PreferredLaunchMode.platformDefault), false, diff --git a/packages/vector_graphics/example/lib/main.dart b/packages/vector_graphics/example/lib/main.dart index e204fa92483..6e147a9da47 100644 --- a/packages/vector_graphics/example/lib/main.dart +++ b/packages/vector_graphics/example/lib/main.dart @@ -50,7 +50,7 @@ class NetworkSvgLoader extends BytesLoader { return compute( (String svgUrl) async { final http.Response request = await http.get(Uri.parse(svgUrl)); - final TimelineTask task = TimelineTask()..start('encodeSvg'); + final task = TimelineTask()..start('encodeSvg'); final Uint8List compiledBytes = encodeSvg( xml: request.body, debugName: svgUrl, diff --git a/packages/vector_graphics/lib/src/listener.dart b/packages/vector_graphics/lib/src/listener.dart index eb32775386d..7ab2d232a32 100644 --- a/packages/vector_graphics/lib/src/listener.dart +++ b/packages/vector_graphics/lib/src/listener.dart @@ -68,7 +68,7 @@ Future decodeVectorGraphics( // real async work gets scheduled in the root zone so that it will not get // blocked by microtasks in the fake async zone, but do not unnecessarily // create zones outside of tests. - bool useZone = false; + var useZone = false; assert(() { _debugLastTextDirection = textDirection; _debugLastLocale = locale; @@ -80,7 +80,7 @@ Future decodeVectorGraphics( @pragma('vm:prefer-inline') Future process() { - final FlutterVectorGraphicsListener listener = + final listener = FlutterVectorGraphicsListener( id: loader.hashCode, locale: locale, @@ -326,7 +326,7 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener { if (paintId != null) { paint!.shader = _patterns[patternId]!.shader; } else { - final Paint newPaint = Paint(); + final newPaint = Paint(); newPaint.shader = _patterns[patternId]!.shader; paint = newPaint; } @@ -343,7 +343,7 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener { @override void onDrawVertices(Float32List vertices, Uint16List? indices, int? paintId) { - final Vertices vertexData = Vertices.raw( + final vertexData = Vertices.raw( VertexMode.triangles, vertices, indices: indices, @@ -369,7 +369,7 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener { required int? shaderId, }) { assert(_paints.length == id, 'Expect ID to be ${_paints.length}'); - final Paint paint = Paint()..color = Color(color); + final paint = Paint()..color = Color(color); if (blendMode != 0) { paint.blendMode = BlendMode.values[blendMode]; } @@ -434,7 +434,7 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener { assert(_currentPath == null); assert(_paths.length == id, 'Expected Id to be $id'); - final Path path = Path(); + final path = Path(); path.fillType = PathFillType.values[fillType]; _paths.add(path); _currentPath = path; @@ -498,7 +498,7 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener { PictureRecorder? patternRecorder, Canvas canvas, ) { - final FlutterVectorGraphicsListener patternListener = + final patternListener = FlutterVectorGraphicsListener._( 0, _pictureFactory, @@ -521,7 +521,7 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener { currentPattern._height.round(), ); - final ImageShader pattern = ImageShader( + final pattern = ImageShader( image, TileMode.repeated, TileMode.repeated, @@ -545,12 +545,12 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener { ) { assert(_shaders.length == id); - final Offset from = Offset(fromX, fromY); - final Offset to = Offset(toX, toY); - final List colorValues = [ + final from = Offset(fromX, fromY); + final to = Offset(toX, toY); + final colorValues = [ for (int i = 0; i < colors.length; i++) Color(colors[i]), ]; - final Gradient gradient = Gradient.linear( + final gradient = Gradient.linear( from, to, colorValues, @@ -575,13 +575,13 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener { ) { assert(_shaders.length == id); - final Offset center = Offset(centerX, centerY); + final center = Offset(centerX, centerY); final Offset? focal = focalX == null ? null : Offset(focalX, focalY!); - final List colorValues = [ + final colorValues = [ for (int i = 0; i < colors.length; i++) Color(colors[i]), ]; final bool hasFocal = focal != center && focal != null; - final Gradient gradient = Gradient.radial( + final gradient = Gradient.radial( center, radius, colorValues, @@ -613,7 +613,7 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener { int decorationColor, int id, ) { - final List decorations = []; + final decorations = []; if (decoration & kUnderlineMask != 0) { decorations.add(TextDecoration.underline); } @@ -694,7 +694,7 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener { if (patternId != null) { paint.shader = _patterns[patternId]!.shader; } - final ParagraphBuilder builder = ParagraphBuilder( + final builder = ParagraphBuilder( ParagraphStyle(textDirection: _textDirection), ); builder.pushStyle( @@ -753,7 +753,7 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener { Uint8List data, { VectorGraphicsErrorListener? onError, }) { - final Completer completer = Completer(); + final completer = Completer(); _pendingImages.add(completer.future); final ImageStreamCompleter? cacheCompleter = imageCache.putIfAbsent( _createImageKey(imageId, format), diff --git a/packages/vector_graphics/lib/src/render_object_selection.dart b/packages/vector_graphics/lib/src/render_object_selection.dart index f500027d74f..b32c5052462 100644 --- a/packages/vector_graphics/lib/src/render_object_selection.dart +++ b/packages/vector_graphics/lib/src/render_object_selection.dart @@ -20,7 +20,7 @@ bool useHtmlRenderObject() { return _cachedUseHtmlRenderObject!; } - final ui.PictureRecorder recorder = ui.PictureRecorder(); + final recorder = ui.PictureRecorder(); ui.Canvas(recorder); final ui.Picture picture = recorder.endRecording(); ui.Image? image; diff --git a/packages/vector_graphics/lib/src/render_vector_graphic.dart b/packages/vector_graphics/lib/src/render_vector_graphic.dart index 78e8bd6c621..8da311cd6dc 100644 --- a/packages/vector_graphics/lib/src/render_vector_graphic.dart +++ b/packages/vector_graphics/lib/src/render_vector_graphic.dart @@ -207,8 +207,8 @@ class RenderVectorGraphic extends RenderBox { // arguments of Picture.toImage do not control the resolution that the // picture is rendered at, instead it controls how much of the picture to // capture in a raster. - final ui.PictureRecorder recorder = ui.PictureRecorder(); - final ui.Canvas canvas = ui.Canvas(recorder); + final recorder = ui.PictureRecorder(); + final canvas = ui.Canvas(recorder); canvas.scale(scaleFactor); canvas.drawPicture(info.picture); @@ -240,7 +240,7 @@ class RenderVectorGraphic extends RenderBox { .round(); final int scaledHeight = (pictureInfo.size.height * devicePixelRatio / scale).round(); - final RasterKey key = RasterKey(assetKey, scaledWidth, scaledHeight); + final key = RasterKey(assetKey, scaledWidth, scaledHeight); // First check if the raster is available synchronously. This also handles // a no-op change that would resolve to an identical picture. @@ -313,18 +313,18 @@ class RenderVectorGraphic extends RenderBox { // Use `FilterQuality.low` to scale the image, which corresponds to // bilinear interpolation. - final Paint colorPaint = Paint()..filterQuality = ui.FilterQuality.low; + final colorPaint = Paint()..filterQuality = ui.FilterQuality.low; if (colorFilter != null) { colorPaint.colorFilter = colorFilter; } colorPaint.color = Color.fromRGBO(0, 0, 0, _opacityValue); - final Rect src = ui.Rect.fromLTWH( + final src = ui.Rect.fromLTWH( 0, 0, width.toDouble(), height.toDouble(), ); - final Rect dst = ui.Rect.fromLTWH( + final dst = ui.Rect.fromLTWH( offset.dx, offset.dy, pictureInfo.size.width, @@ -433,7 +433,7 @@ class RenderPictureVectorGraphic extends RenderBox { return; } - final Paint colorPaint = Paint(); + final colorPaint = Paint(); if (colorFilter != null) { colorPaint.colorFilter = colorFilter; } diff --git a/packages/vector_graphics/lib/src/vector_graphics.dart b/packages/vector_graphics/lib/src/vector_graphics.dart index c5ae25d7ce3..c5a550a6959 100644 --- a/packages/vector_graphics/lib/src/vector_graphics.dart +++ b/packages/vector_graphics/lib/src/vector_graphics.dart @@ -397,7 +397,7 @@ class _VectorGraphicWidgetState extends State { Future _loadAssetBytes() async { // First check if we have an avilable picture and use this immediately. final Object loaderKey = widget.loader.cacheKey(context); - final _PictureKey key = _PictureKey( + final key = _PictureKey( loaderKey, locale, textDirection, @@ -465,7 +465,7 @@ class _VectorGraphicWidgetState extends State { assert(width != null && height != null); - double scale = 1.0; + var scale = 1.0; scale = math.min( pictureInfo.size.width / width!, pictureInfo.size.height / height!, diff --git a/packages/vector_graphics/test/caching_test.dart b/packages/vector_graphics/test/caching_test.dart index cd6ef083b43..aeab1a56f8a 100644 --- a/packages/vector_graphics/test/caching_test.dart +++ b/packages/vector_graphics/test/caching_test.dart @@ -21,7 +21,7 @@ void main() { testWidgets( 'Does not reload identical bytes when forced to re-create state object', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); final GlobalKey key = GlobalKey(); await tester.pumpWidget( @@ -55,7 +55,7 @@ void main() { testWidgets('Only loads bytes once for a repeated vg', ( WidgetTester tester, ) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); await tester.pumpWidget( DefaultAssetBundle( @@ -113,8 +113,8 @@ void main() { testWidgets('Does not cache bytes that come from different asset bundles', ( WidgetTester tester, ) async { - final TestAssetBundle testBundleA = TestAssetBundle(); - final TestAssetBundle testBundleB = TestAssetBundle(); + final testBundleA = TestAssetBundle(); + final testBundleB = TestAssetBundle(); final GlobalKey key = GlobalKey(); await tester.pumpWidget( @@ -147,7 +147,7 @@ void main() { }); testWidgets('reload bytes when locale changes', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); final GlobalKey key = GlobalKey(); await tester.pumpWidget( @@ -194,7 +194,7 @@ void main() { testWidgets('reload bytes when text direction changes', ( WidgetTester tester, ) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); final GlobalKey key = GlobalKey(); await tester.pumpWidget( @@ -231,7 +231,7 @@ void main() { testWidgets( 'Cache is purged immediately after last VectorGraphic removed from tree', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); final GlobalKey key = GlobalKey(); await tester.pumpWidget( @@ -269,9 +269,9 @@ void main() { testWidgets('Bytes loading that becomes stale does not populate the cache', ( WidgetTester tester, ) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); final GlobalKey key = GlobalKey(); - final ControlledAssetBytesLoader loader = ControlledAssetBytesLoader( + final loader = ControlledAssetBytesLoader( 'foo.svg', ); @@ -323,7 +323,7 @@ class TestAssetBundle extends Fake implements AssetBundle { @override Future load(String key) async { loadKeys.add(key); - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); codec.writeSize(buffer, 100, 200); return buffer.done(); } diff --git a/packages/vector_graphics/test/listener_test.dart b/packages/vector_graphics/test/listener_test.dart index dfc7943fa26..20b88df5e79 100644 --- a/packages/vector_graphics/test/listener_test.dart +++ b/packages/vector_graphics/test/listener_test.dart @@ -15,13 +15,13 @@ import 'package:vector_graphics_compiler/vector_graphics_compiler.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); - const String svgString = ''' + const svgString = ''' '''; - const String bluePngPixel = + const bluePngPixel = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg=='; late ByteData vectorGraphicBuffer; @@ -73,8 +73,8 @@ void main() { }, skip: kIsWeb); test('Scales image correctly', () async { - final TestPictureFactory factory = TestPictureFactory(); - final FlutterVectorGraphicsListener listener = + final factory = TestPictureFactory(); + final listener = FlutterVectorGraphicsListener(pictureFactory: factory); listener.onImage(0, 0, base64.decode(bluePngPixel)); await listener.waitForImageDecode(); @@ -90,8 +90,8 @@ void main() { }); test('Pattern start clips the new canvas', () async { - final TestPictureFactory factory = TestPictureFactory(); - final FlutterVectorGraphicsListener listener = + final factory = TestPictureFactory(); + final listener = FlutterVectorGraphicsListener(pictureFactory: factory); listener.onPatternStart(0, 0, 0, 100, 100, Matrix4.identity().storage); final Invocation clipRect = factory.fakeCanvases.last.invocations.single; @@ -104,8 +104,8 @@ void main() { }); test('Text position is respected', () async { - final TestPictureFactory factory = TestPictureFactory(); - final FlutterVectorGraphicsListener listener = + final factory = TestPictureFactory(); + final listener = FlutterVectorGraphicsListener(pictureFactory: factory); listener.onPaintObject( color: const ui.Color(0xff000000).toARGB32(), @@ -137,8 +137,8 @@ void main() { }); test('should assert when imageId is invalid', () async { - final TestPictureFactory factory = TestPictureFactory(); - final FlutterVectorGraphicsListener listener = + final factory = TestPictureFactory(); + final listener = FlutterVectorGraphicsListener(pictureFactory: factory); listener.onImage(0, 0, base64.decode(bluePngPixel)); await listener.waitForImageDecode(); diff --git a/packages/vector_graphics/test/render_vector_graphics_test.dart b/packages/vector_graphics/test/render_vector_graphics_test.dart index 7c2479ece27..2523f2a7641 100644 --- a/packages/vector_graphics/test/render_vector_graphics_test.dart +++ b/packages/vector_graphics/test/render_vector_graphics_test.dart @@ -27,7 +27,7 @@ void main() { }); setUpAll(() async { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); const VectorGraphicsCodec().writeSize(buffer, 50, 50); pictureInfo = await decodeVectorGraphics( @@ -40,7 +40,7 @@ void main() { }); test('Rasterizes a picture to a draw image call', () async { - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -49,7 +49,7 @@ void main() { 1.0, ); renderVectorGraphic.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); renderVectorGraphic.paint(context, Offset.zero); // When the rasterization is finished, it marks self as needing paint. @@ -61,7 +61,7 @@ void main() { }); test('Multiple render objects with the same scale share a raster', () async { - final RenderVectorGraphic renderVectorGraphicA = RenderVectorGraphic( + final renderVectorGraphicA = RenderVectorGraphic( pictureInfo, 'test', null, @@ -69,7 +69,7 @@ void main() { null, 1.0, ); - final RenderVectorGraphic renderVectorGraphicB = RenderVectorGraphic( + final renderVectorGraphicB = RenderVectorGraphic( pictureInfo, 'test', null, @@ -79,7 +79,7 @@ void main() { ); renderVectorGraphicA.layout(BoxConstraints.tight(const Size(50, 50))); renderVectorGraphicB.layout(BoxConstraints.tight(const Size(50, 50))); - final FakeHistoryPaintingContext context = FakeHistoryPaintingContext(); + final context = FakeHistoryPaintingContext(); renderVectorGraphicA.paint(context, Offset.zero); renderVectorGraphicB.paint(context, Offset.zero); @@ -90,7 +90,7 @@ void main() { }); test('disposing render object release raster', () async { - final RenderVectorGraphic renderVectorGraphicA = RenderVectorGraphic( + final renderVectorGraphicA = RenderVectorGraphic( pictureInfo, 'test', null, @@ -98,7 +98,7 @@ void main() { null, 1.0, ); - final RenderVectorGraphic renderVectorGraphicB = RenderVectorGraphic( + final renderVectorGraphicB = RenderVectorGraphic( pictureInfo, 'test', null, @@ -107,7 +107,7 @@ void main() { 1.0, ); renderVectorGraphicA.layout(BoxConstraints.tight(const Size(50, 50))); - final FakeHistoryPaintingContext context = FakeHistoryPaintingContext(); + final context = FakeHistoryPaintingContext(); renderVectorGraphicA.paint(context, Offset.zero); @@ -127,7 +127,7 @@ void main() { test( 'Multiple render objects with the same scale share a raster, different load order', () async { - final RenderVectorGraphic renderVectorGraphicA = RenderVectorGraphic( + final renderVectorGraphicA = RenderVectorGraphic( pictureInfo, 'test', null, @@ -135,7 +135,7 @@ void main() { null, 1.0, ); - final RenderVectorGraphic renderVectorGraphicB = RenderVectorGraphic( + final renderVectorGraphicB = RenderVectorGraphic( pictureInfo, 'test', null, @@ -144,7 +144,7 @@ void main() { 1.0, ); renderVectorGraphicA.layout(BoxConstraints.tight(const Size(50, 50))); - final FakeHistoryPaintingContext context = FakeHistoryPaintingContext(); + final context = FakeHistoryPaintingContext(); renderVectorGraphicA.paint(context, Offset.zero); @@ -163,7 +163,7 @@ void main() { ); test('Changing color filter does not re-rasterize', () async { - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -172,7 +172,7 @@ void main() { 1.0, ); renderVectorGraphic.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); renderVectorGraphic.paint(context, Offset.zero); final ui.Image firstImage = context.canvas.lastImage!; @@ -193,7 +193,7 @@ void main() { test( 'Changing device pixel ratio does re-rasterize and dispose old raster', () async { - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -202,7 +202,7 @@ void main() { 1.0, ); renderVectorGraphic.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); renderVectorGraphic.paint(context, Offset.zero); final ui.Image firstImage = context.canvas.lastImage!; @@ -219,7 +219,7 @@ void main() { ); test('Changing scale does re-rasterize and dispose old raster', () async { - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -228,7 +228,7 @@ void main() { 1.0, ); renderVectorGraphic.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); renderVectorGraphic.paint(context, Offset.zero); final ui.Image firstImage = context.canvas.lastImage!; @@ -244,7 +244,7 @@ void main() { }); test('The raster size is increased by the inverse picture scale', () async { - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -253,7 +253,7 @@ void main() { 0.5, // twice as many pixels ); renderVectorGraphic.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); renderVectorGraphic.paint(context, Offset.zero); // Dst rect is always size of RO. @@ -265,7 +265,7 @@ void main() { }); test('The raster size is increased by the device pixel ratio', () async { - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -274,7 +274,7 @@ void main() { 1.0, ); renderVectorGraphic.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); renderVectorGraphic.paint(context, Offset.zero); // Dst rect is always size of RO. @@ -285,7 +285,7 @@ void main() { test( 'The raster size is increased by the device pixel ratio and ratio', () async { - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -294,7 +294,7 @@ void main() { 0.5, ); renderVectorGraphic.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); renderVectorGraphic.paint(context, Offset.zero); // Dst rect is always size of RO. @@ -306,7 +306,7 @@ void main() { test( 'Changing size asserts if it is different from the picture size', () async { - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -315,7 +315,7 @@ void main() { 1.0, ); renderVectorGraphic.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); renderVectorGraphic.paint(context, Offset.zero); // change size. @@ -329,8 +329,8 @@ void main() { ); test('Does not rasterize a picture when fully transparent', () async { - final FixedOpacityAnimation opacity = FixedOpacityAnimation(0.0); - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final opacity = FixedOpacityAnimation(0.0); + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -339,7 +339,7 @@ void main() { 1.0, ); renderVectorGraphic.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); renderVectorGraphic.paint(context, Offset.zero); opacity.value = 1.0; @@ -355,8 +355,8 @@ void main() { }); test('paints partially opaque picture', () async { - final FixedOpacityAnimation opacity = FixedOpacityAnimation(0.5); - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final opacity = FixedOpacityAnimation(0.5); + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -365,14 +365,14 @@ void main() { 1.0, ); renderVectorGraphic.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); renderVectorGraphic.paint(context, Offset.zero); expect(context.canvas.lastPaint?.color, const Color.fromRGBO(0, 0, 0, 0.5)); }); test('Disposing render object disposes picture', () async { - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -381,7 +381,7 @@ void main() { 1.0, ); renderVectorGraphic.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); renderVectorGraphic.paint(context, Offset.zero); final ui.Image lastImage = context.canvas.lastImage!; @@ -392,8 +392,8 @@ void main() { }); test('Removes listeners on detach, dispose, adds then on attach', () async { - final FixedOpacityAnimation opacity = FixedOpacityAnimation(0.5); - final RenderVectorGraphic renderVectorGraphic = RenderVectorGraphic( + final opacity = FixedOpacityAnimation(0.5); + final renderVectorGraphic = RenderVectorGraphic( pictureInfo, 'test', null, @@ -401,7 +401,7 @@ void main() { opacity, 1.0, ); - final PipelineOwner pipelineOwner = PipelineOwner(); + final pipelineOwner = PipelineOwner(); expect(opacity._listeners, hasLength(1)); renderVectorGraphic.attach(pipelineOwner); @@ -418,10 +418,10 @@ void main() { }); test('RasterData.dispose is safe to call multiple times', () async { - final ui.PictureRecorder recorder = ui.PictureRecorder(); + final recorder = ui.PictureRecorder(); ui.Canvas(recorder); final ui.Image image = await recorder.endRecording().toImage(1, 1); - final RasterData data = RasterData(image, 1, const RasterKey('test', 1, 1)); + final data = RasterData(image, 1, const RasterKey('test', 1, 1)); data.dispose(); @@ -429,13 +429,13 @@ void main() { }); test('Color filter applies clip', () async { - final RenderPictureVectorGraphic render = RenderPictureVectorGraphic( + final render = RenderPictureVectorGraphic( pictureInfo, const ui.ColorFilter.mode(Colors.green, ui.BlendMode.difference), null, ); render.layout(BoxConstraints.tight(const Size(50, 50))); - final FakePaintingContext context = FakePaintingContext(); + final context = FakePaintingContext(); render.paint(context, Offset.zero); expect( diff --git a/packages/vector_graphics/test/vector_graphics_test.dart b/packages/vector_graphics/test/vector_graphics_test.dart index 1590897775f..7fadb38521c 100644 --- a/packages/vector_graphics/test/vector_graphics_test.dart +++ b/packages/vector_graphics/test/vector_graphics_test.dart @@ -22,8 +22,8 @@ void main() { }); test('Can decode a message without a stroke and vertices', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final FlutterVectorGraphicsListener listener = + final buffer = VectorGraphicsBuffer(); + final listener = FlutterVectorGraphicsListener(); final int paintId = codec.writeStroke(buffer, 44, 1, 2, 3, 4.0, 6.0); codec.writeDrawVertices( @@ -39,8 +39,8 @@ void main() { }); test('Can decode a message with a fill and path', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final FlutterVectorGraphicsListener listener = + final buffer = VectorGraphicsBuffer(); + final listener = FlutterVectorGraphicsListener(); final int paintId = codec.writeFill(buffer, 23, 0); final int pathId = codec.writePath( @@ -61,7 +61,7 @@ void main() { }); test('Asserts if toPicture is called more than once', () { - final FlutterVectorGraphicsListener listener = + final listener = FlutterVectorGraphicsListener(); listener.toPicture(); @@ -71,7 +71,7 @@ void main() { testWidgets( 'Creates layout widgets when VectorGraphic is sized (0x0 graphic)', (WidgetTester tester) async { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); await tester.pumpWidget( VectorGraphic( loader: TestBytesLoader(buffer.done()), @@ -83,7 +83,7 @@ void main() { expect(find.byType(SizedBox), findsNWidgets(2)); - final SizedBox sizedBox = + final sizedBox = find.byType(SizedBox).evaluate().first.widget as SizedBox; expect(sizedBox.width, 100); @@ -94,7 +94,7 @@ void main() { testWidgets( 'Creates layout widgets when VectorGraphic is sized (1:1 ratio)', (WidgetTester tester) async { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); const VectorGraphicsCodec().writeSize(buffer, 50, 50); await tester.pumpWidget( VectorGraphic( @@ -107,7 +107,7 @@ void main() { expect(find.byType(SizedBox), findsNWidgets(2)); - final SizedBox sizedBox = + final sizedBox = find.byType(SizedBox).evaluate().first.widget as SizedBox; expect(sizedBox.width, 100); @@ -118,7 +118,7 @@ void main() { testWidgets( 'Creates layout widgets when VectorGraphic is sized (3:5 ratio)', (WidgetTester tester) async { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); const VectorGraphicsCodec().writeSize(buffer, 30, 50); await tester.pumpWidget( VectorGraphic( @@ -131,7 +131,7 @@ void main() { expect(find.byType(SizedBox), findsNWidgets(2)); - final SizedBox sizedBox = + final sizedBox = find.byType(SizedBox).evaluate().first.widget as SizedBox; expect(sizedBox.width, 60); @@ -142,7 +142,7 @@ void main() { testWidgets('Creates alignment widgets when VectorGraphic is aligned', ( WidgetTester tester, ) async { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); await tester.pumpWidget( VectorGraphic( loader: TestBytesLoader(buffer.done()), @@ -154,7 +154,7 @@ void main() { expect(find.byType(FittedBox), findsOneWidget); - final FittedBox fittedBox = + final fittedBox = find.byType(FittedBox).evaluate().first.widget as FittedBox; expect(fittedBox.fit, BoxFit.fitHeight); @@ -166,7 +166,7 @@ void main() { testWidgets('Sets clipBehavior to hardEdge if not provided', ( WidgetTester tester, ) async { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); await tester.pumpWidget( VectorGraphic(loader: TestBytesLoader(buffer.done())), ); @@ -174,7 +174,7 @@ void main() { expect(find.byType(FittedBox), findsOneWidget); - final FittedBox fittedBox = + final fittedBox = find.byType(FittedBox).evaluate().first.widget as FittedBox; expect(fittedBox.clipBehavior, Clip.hardEdge); @@ -183,7 +183,7 @@ void main() { testWidgets('Passes clipBehavior to FittedBox if provided', ( WidgetTester tester, ) async { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); await tester.pumpWidget( VectorGraphic( loader: TestBytesLoader(buffer.done()), @@ -194,7 +194,7 @@ void main() { expect(find.byType(FittedBox), findsOneWidget); - final FittedBox fittedBox = + final fittedBox = find.byType(FittedBox).evaluate().first.widget as FittedBox; expect(fittedBox.clipBehavior, Clip.none); @@ -204,7 +204,7 @@ void main() { testWidgets('Sizes VectorGraphic based on encoded viewbox information', ( WidgetTester tester, ) async { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); codec.writeSize(buffer, 100, 200); await tester.pumpWidget( @@ -214,7 +214,7 @@ void main() { expect(find.byType(SizedBox), findsNWidgets(2)); - final SizedBox sizedBox = + final sizedBox = find.byType(SizedBox).evaluate().last.widget as SizedBox; expect(sizedBox.width, 100); @@ -224,7 +224,7 @@ void main() { testWidgets('Reloads bytes when configuration changes', ( WidgetTester tester, ) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); final GlobalKey key = GlobalKey(); await tester.pumpWidget( @@ -253,7 +253,7 @@ void main() { }); testWidgets('Can update SVG picture', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); await tester.pumpWidget( DefaultAssetBundle( @@ -277,7 +277,7 @@ void main() { }); testWidgets('Can set locale and text direction', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); await tester.pumpWidget( Localizations( delegates: const >[ @@ -322,8 +322,8 @@ void main() { testWidgets('Test animated switch between placeholder and image', ( WidgetTester tester, ) async { - final TestAssetBundle testBundle = TestAssetBundle(); - const Text placeholderWidget = Text('Placeholder'); + final testBundle = TestAssetBundle(); + const placeholderWidget = Text('Placeholder'); await tester.pumpWidget( DefaultAssetBundle( @@ -349,7 +349,7 @@ void main() { }); testWidgets('Can exclude from semantics', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); await tester.pumpWidget( DefaultAssetBundle( @@ -367,7 +367,7 @@ void main() { }); testWidgets('Can add semantic label', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); await tester.pumpWidget( DefaultAssetBundle( @@ -390,7 +390,7 @@ void main() { }); testWidgets('Default placeholder builder', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); await tester.pumpWidget( DefaultAssetBundle( @@ -409,7 +409,7 @@ void main() { }); testWidgets('Custom placeholder builder', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); await tester.pumpWidget( DefaultAssetBundle( @@ -433,9 +433,9 @@ void main() { testWidgets('Does not call setState after unmounting', ( WidgetTester tester, ) async { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); codec.writeSize(buffer, 100, 200); - final Completer completer = Completer(); + final completer = Completer(); await tester.pumpWidget( Directionality( @@ -448,8 +448,8 @@ void main() { }); testWidgets('Loads a picture with loadPicture', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); - final Completer completer = Completer(); + final testBundle = TestAssetBundle(); + final completer = Completer(); await tester.pumpWidget( Localizations( delegates: const >[ @@ -482,8 +482,8 @@ void main() { testWidgets('Loads a picture with loadPicture and null build context', ( WidgetTester tester, ) async { - final TestAssetBundle testBundle = TestAssetBundle(); - final Completer completer = Completer(); + final testBundle = TestAssetBundle(); + final completer = Completer(); await tester.pumpWidget( Localizations( delegates: const >[ @@ -519,8 +519,8 @@ void main() { testWidgets('Throws a helpful exception if decoding fails', ( WidgetTester tester, ) async { - final Uint8List data = Uint8List(256); - final TestBytesLoader loader = TestBytesLoader( + final data = Uint8List(256); + final loader = TestBytesLoader( data.buffer.asByteData(), '/foo/bar/whatever.vec', ); @@ -542,7 +542,7 @@ void main() { testWidgets( 'Construct vector graphic with drawPicture strategy', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); await tester.pumpWidget( DefaultAssetBundle( @@ -568,11 +568,11 @@ void main() { ); // picture rasterization works differently on HTML due to saveLayer bugs in HTML backend testWidgets('Can render VG with image', (WidgetTester tester) async { - const String bluePngPixel = + const bluePngPixel = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg=='; - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - const VectorGraphicsCodec codec = VectorGraphicsCodec(); + final buffer = VectorGraphicsBuffer(); + const codec = VectorGraphicsCodec(); codec.writeSize(buffer, 100, 100); codec.writeDrawImage( @@ -584,8 +584,8 @@ void main() { 100, null, ); - final UniqueKey key = UniqueKey(); - final TestBytesLoader loader = TestBytesLoader(buffer.done()); + final key = UniqueKey(); + final loader = TestBytesLoader(buffer.done()); // See listener.dart. final int imageKey = Object.hash(loader.hashCode, 0, 0); @@ -627,15 +627,15 @@ void main() { }, skip: kIsWeb); test('AssetBytesLoader respects packages', () async { - final TestBundle bundle = TestBundle({ + final bundle = TestBundle({ 'foo': Uint8List(0).buffer.asByteData(), 'packages/packageName/foo': Uint8List(1).buffer.asByteData(), }); - final AssetBytesLoader loader = AssetBytesLoader( + final loader = AssetBytesLoader( 'foo', assetBundle: bundle, ); - final AssetBytesLoader packageLoader = AssetBytesLoader( + final packageLoader = AssetBytesLoader( 'foo', assetBundle: bundle, packageName: 'packageName', @@ -645,7 +645,7 @@ void main() { }); testWidgets('Respects text direction', (WidgetTester tester) async { - final TestAssetBundle testBundle = TestAssetBundle(); + final testBundle = TestAssetBundle(); await tester.pumpWidget( Directionality( @@ -674,13 +674,13 @@ void main() { ); await tester.pumpAndSettle(); - final Matrix4 matrix = Matrix4.identity(); + final matrix = Matrix4.identity(); final RenderObject transformObject = find .byType(Transform) .evaluate() .first .renderObject!; - bool visited = false; + var visited = false; transformObject.visitChildren((RenderObject child) { if (!visited) { transformObject.applyPaintTransform(child, matrix); @@ -738,7 +738,7 @@ class TestAssetBundle extends Fake implements AssetBundle { @override Future load(String key) async { loadKeys.add(key); - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); codec.writeSize(buffer, 100, 200); return buffer.done(); } diff --git a/packages/vector_graphics_codec/lib/src/fp16.dart b/packages/vector_graphics_codec/lib/src/fp16.dart index 7f3da334168..6b5aa98c903 100644 --- a/packages/vector_graphics_codec/lib/src/fp16.dart +++ b/packages/vector_graphics_codec/lib/src/fp16.dart @@ -39,8 +39,8 @@ void toHalf(ByteData byteData) { final int s = bits >> FP32_SIGN_SHIFT; int e = (bits >> FP32_EXPONENT_SHIFT) & FP32_SHIFTED_EXPONENT_MASK; int m = bits & FP32_SIGNIFICAND_MASK; - int outE = 0; - int outM = 0; + var outE = 0; + var outM = 0; if (e == 0xff) { // Infinite or NaN @@ -96,8 +96,8 @@ double toDouble(ByteData byteData) { final int s = bits & SIGN_MASK; final int e = (bits >> EXPONENT_SHIFT) & SHIFTED_EXPONENT_MASK; final int m = bits & SIGNIFICAND_MASK; - int outE = 0; - int outM = 0; + var outE = 0; + var outM = 0; if (e == 0) { // Denormal or 0 if (m != 0) { diff --git a/packages/vector_graphics_codec/lib/vector_graphics_codec.dart b/packages/vector_graphics_codec/lib/vector_graphics_codec.dart index 00fe9e1425e..2f491a78340 100644 --- a/packages/vector_graphics_codec/lib/vector_graphics_codec.dart +++ b/packages/vector_graphics_codec/lib/vector_graphics_codec.dart @@ -167,7 +167,7 @@ class VectorGraphicsCodec { buffer = response._buffer!; } - bool readImage = false; + var readImage = false; while (buffer.hasRemaining) { final int type = buffer.getUint8(); switch (type) { @@ -614,7 +614,7 @@ class VectorGraphicsCodec { if (fontFamily != null) { // Newer versions of Dart will make this a Uint8List and not require the cast. // ignore: unnecessary_cast - final Uint8List encoded = utf8.encode(fontFamily) as Uint8List; + final encoded = utf8.encode(fontFamily) as Uint8List; buffer._putUint16(encoded.length); buffer._putUint8List(encoded); } else { @@ -624,7 +624,7 @@ class VectorGraphicsCodec { // text-value // Newer versions of Dart will make this a Uint8List and not require the cast. // ignore: unnecessary_cast - final Uint8List encoded = utf8.encode(text) as Uint8List; + final encoded = utf8.encode(text) as Uint8List; buffer._putUint16(encoded.length); buffer._putUint8List(encoded); @@ -756,9 +756,9 @@ class VectorGraphicsCodec { } Uint16List _encodeToHalfPrecision(Float32List list) { - final Uint16List output = Uint16List(list.length); - final ByteData buffer = ByteData(8); - for (int i = 0; i < list.length; i++) { + final output = Uint16List(list.length); + final buffer = ByteData(8); + for (var i = 0; i < list.length; i++) { buffer.setFloat32(0, list[i]); fp16.toHalf(buffer); output[i] = buffer.getInt16(0); @@ -767,9 +767,9 @@ class VectorGraphicsCodec { } Float32List _decodeFromHalfPrecision(Uint16List list) { - final Float32List output = Float32List(list.length); - final ByteData buffer = ByteData(8); - for (int i = 0; i < list.length; i++) { + final output = Float32List(list.length); + final buffer = ByteData(8); + for (var i = 0; i < list.length; i++) { buffer.setUint16(0, list[i]); output[i] = fp16.toDouble(buffer); } @@ -836,7 +836,7 @@ class VectorGraphicsCodec { points = buffer.getFloat32List(pointLength); } listener?.onPathStart(id, fillType); - for (int i = 0, j = 0; i < tagLength; i += 1) { + for (var i = 0, j = 0; i < tagLength; i += 1) { switch (tags[i]) { case ControlPointTypes.moveTo: listener?.onPathMoveTo(points[j], points[j + 1]); @@ -931,7 +931,7 @@ class VectorGraphicsCodec { final double dx = buffer.getFloat32(); final double dy = buffer.getFloat32(); - final bool reset = buffer.getUint8() != 0; + final reset = buffer.getUint8() != 0; final Float64List? transform = buffer.getTransform(); listener?.onTextPosition( diff --git a/packages/vector_graphics_codec/test/fp16_test.dart b/packages/vector_graphics_codec/test/fp16_test.dart index ee6798281dd..75db15da14d 100644 --- a/packages/vector_graphics_codec/test/fp16_test.dart +++ b/packages/vector_graphics_codec/test/fp16_test.dart @@ -8,7 +8,7 @@ import 'package:test/test.dart'; import 'package:vector_graphics_codec/src/fp16.dart'; double convert(double value) { - final ByteData byteData = ByteData(8); + final byteData = ByteData(8); byteData.setFloat32(0, value); toHalf(byteData); return toDouble(byteData); @@ -16,7 +16,7 @@ double convert(double value) { void main() { test('fp16 positive values', () { - final List> missed = >[]; + final missed = >[]; /// Validate that all numbers between [min] and [max] can be converted within [tolerance]. void checkRange({ @@ -24,8 +24,8 @@ void main() { required double max, required double tolerance, }) { - final ByteData byteData = ByteData(8); - for (double i = min; i < max; i += 1) { + final byteData = ByteData(8); + for (var i = min; i < max; i += 1) { byteData.setFloat32(0, i); toHalf(byteData); diff --git a/packages/vector_graphics_codec/test/vector_graphics_codec_test.dart b/packages/vector_graphics_codec/test/vector_graphics_codec_test.dart index 4aa35b7e851..613ed1a0d8f 100644 --- a/packages/vector_graphics_codec/test/vector_graphics_codec_test.dart +++ b/packages/vector_graphics_codec/test/vector_graphics_codec_test.dart @@ -35,7 +35,7 @@ void bufferContains(VectorGraphicsBuffer buffer, List expectedBytes) { void main() { test('Messages begin with a magic number and version', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); bufferContains(buffer, [98, 45, 136, 0, 1]); }); @@ -67,7 +67,7 @@ void main() { }); test('Messages without an incompatible version cannot be decoded', () { - final Uint8List bytes = Uint8List(6); + final bytes = Uint8List(6); bytes[0] = 98; bytes[1] = 45; bytes[2] = 136; @@ -89,8 +89,8 @@ void main() { }); test('Basic message encode and decode with filled path', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int paintId = codec.writeFill(buffer, 23, 0); final int pathId = codec.writePath( buffer, @@ -128,8 +128,8 @@ void main() { }); test('Basic message encode and decode with shaded path', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int shaderId = codec.writeLinearGradient( buffer, fromX: 0, @@ -210,8 +210,8 @@ void main() { }); test('Basic message encode and decode with stroked vertex', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int paintId = codec.writeStroke(buffer, 44, 1, 2, 3, 4.0, 6.0); codec.writeDrawVertices( buffer, @@ -243,8 +243,8 @@ void main() { }); test('Basic message encode and decode with stroked vertex and indexes', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int paintId = codec.writeStroke(buffer, 44, 1, 2, 3, 4.0, 6.0); codec.writeDrawVertices( buffer, @@ -276,8 +276,8 @@ void main() { }); test('Can encode opacity/save/restore layers', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int paintId = codec.writeFill(buffer, 0xAA000000, 0); codec.writeSaveLayer(buffer, paintId); @@ -302,8 +302,8 @@ void main() { }); test('Can encode a radial gradient', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int shaderId = codec.writeRadialGradient( buffer, @@ -337,8 +337,8 @@ void main() { }); test('Can encode a radial gradient (no matrix)', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int shaderId = codec.writeRadialGradient( buffer, @@ -372,8 +372,8 @@ void main() { }); test('Can encode a linear gradient', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int shaderId = codec.writeLinearGradient( buffer, @@ -403,8 +403,8 @@ void main() { }); test('Can encode clips', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int pathId = codec.writePath( buffer, Uint8List.fromList([ @@ -434,16 +434,16 @@ void main() { }); test('Can encode masks', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); codec.writeMask(buffer); codec.decode(buffer.done(), listener); expect(listener.commands, [const OnMask()]); }); test('Encodes a size', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); codec.writeSize(buffer, 20, 30); codec.decode(buffer.done(), listener); @@ -452,15 +452,15 @@ void main() { }); test('Only supports a single size', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); codec.writeSize(buffer, 20, 30); expect(() => codec.writeSize(buffer, 1, 1), throwsStateError); }); test('Encodes text', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int paintId = codec.writeFill(buffer, 0xFFAABBAA, 0); final int textId = codec.writeTextConfig( @@ -495,8 +495,8 @@ void main() { }); test('Encodes text with null font family', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int paintId = codec.writeFill(buffer, 0xFFAABBAA, 0); final int textId = codec.writeTextConfig( @@ -531,8 +531,8 @@ void main() { }); test('Encodes empty text', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int paintId = codec.writeFill(buffer, 0xFFAABBAA, 0); final int textId = codec.writeTextConfig( @@ -567,8 +567,8 @@ void main() { }); test('Encodes text position', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); codec.writeTextPosition(buffer, 1, 2, 3, 4, true, mat4); @@ -588,8 +588,8 @@ void main() { }); test('Encodes image data without transform', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int id = codec.writeImage( buffer, @@ -619,8 +619,8 @@ void main() { }); test('Encodes image data with transform', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int id = codec.writeImage( buffer, @@ -650,7 +650,7 @@ void main() { }); test('Encodes image data with various formats', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + final buffer = VectorGraphicsBuffer(); for (final int format in ImageFormatTypes.values) { expect( @@ -665,8 +665,8 @@ void main() { }); test('Basic message encode and decode with shaded path and image', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int imageId = codec.writeImage( buffer, @@ -803,8 +803,8 @@ void main() { }); test('Basic message encode and decode with half precision path', () { - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); - final TestListener listener = TestListener(); + final buffer = VectorGraphicsBuffer(); + final listener = TestListener(); final int fillId = codec.writeFill(buffer, 23, 0); final int strokeId = codec.writeStroke(buffer, 44, 1, 2, 3, 4.0, 6.0); @@ -1738,7 +1738,7 @@ bool _listEquals(List? left, List? right) { if (left.length != right.length) { return false; } - for (int i = 0; i < left.length; i++) { + for (var i = 0; i < left.length; i++) { if (left[i] != right[i]) { return false; } diff --git a/packages/vector_graphics_compiler/bin/util/isolate_processor.dart b/packages/vector_graphics_compiler/bin/util/isolate_processor.dart index ae869b4ed98..78a6f4511d8 100644 --- a/packages/vector_graphics_compiler/bin/util/isolate_processor.dart +++ b/packages/vector_graphics_compiler/bin/util/isolate_processor.dart @@ -40,7 +40,7 @@ class IsolateProcessor { }) async { _total = pairs.length; _current = 0; - bool failure = false; + var failure = false; await Future.wait(eagerError: true, >[ for (final Pair pair in pairs) _process( @@ -152,11 +152,11 @@ class Pool { Future request() async { if (active.length < concurrency) { - final PoolHandle handle = PoolHandle(this); + final handle = PoolHandle(this); active.add(handle); return handle; } - final Completer completer = Completer(); + final completer = Completer(); pending.add(completer); return completer.future; } @@ -166,7 +166,7 @@ class Pool { active.remove(oldHandle); while (active.length < concurrency && pending.isNotEmpty) { final Completer completer = pending.removeAt(0); - final PoolHandle handle = PoolHandle(this); + final handle = PoolHandle(this); active.add(handle); completer.complete(handle); } diff --git a/packages/vector_graphics_compiler/bin/vector_graphics_compiler.dart b/packages/vector_graphics_compiler/bin/vector_graphics_compiler.dart index 4820b8d4c79..b971aa2c73c 100644 --- a/packages/vector_graphics_compiler/bin/vector_graphics_compiler.dart +++ b/packages/vector_graphics_compiler/bin/vector_graphics_compiler.dart @@ -152,9 +152,9 @@ Future main(List args) async { } validateOptions(results); - final List pairs = []; + final pairs = []; if (results.wasParsed('input-dir')) { - final Directory directory = Directory(results['input-dir'] as String); + final directory = Directory(results['input-dir'] as String); if (!directory.existsSync()) { print('input-dir ${directory.path} does not exist.'); exit(1); @@ -165,11 +165,11 @@ Future main(List args) async { continue; } - String outputPath = '${file.path}.vec'; + var outputPath = '${file.path}.vec'; // to specfic the output directory when parse multi svg if (results.wasParsed('out-dir')) { - final Directory outDir = Directory(results['out-dir'] as String); + final outDir = Directory(results['out-dir'] as String); //to add the output dirctory if it exist if (!outDir.existsSync()) { outDir.createSync(); @@ -180,18 +180,18 @@ Future main(List args) async { pairs.add(Pair(file.path, outputPath)); } } else { - final String inputFilePath = results['input'] as String; + final inputFilePath = results['input'] as String; final String outputFilePath = results['output'] as String? ?? '$inputFilePath.vec'; pairs.add(Pair(inputFilePath, outputFilePath)); } - final bool maskingOptimizerEnabled = results['optimize-masks'] == true; - final bool clippingOptimizerEnabled = results['optimize-clips'] == true; - final bool overdrawOptimizerEnabled = results['optimize-overdraw'] == true; - final bool tessellate = results['tessellate'] == true; - final bool dumpDebug = results['dump-debug'] == true; - final bool useHalfPrecisionControlPoints = + final maskingOptimizerEnabled = results['optimize-masks'] == true; + final clippingOptimizerEnabled = results['optimize-clips'] == true; + final overdrawOptimizerEnabled = results['optimize-overdraw'] == true; + final tessellate = results['tessellate'] == true; + final dumpDebug = results['dump-debug'] == true; + final useHalfPrecisionControlPoints = results['use-half-precision-control-points'] == true; final int concurrency; if (results.wasParsed('concurrency')) { @@ -200,7 +200,7 @@ Future main(List args) async { concurrency = Platform.numberOfProcessors; } - final IsolateProcessor processor = IsolateProcessor( + final processor = IsolateProcessor( results['libpathops'] as String?, results['libtessellator'] as String?, concurrency, diff --git a/packages/vector_graphics_compiler/lib/src/_initialize_path_ops_io.dart b/packages/vector_graphics_compiler/lib/src/_initialize_path_ops_io.dart index 30d62b453a1..692ab0f1347 100644 --- a/packages/vector_graphics_compiler/lib/src/_initialize_path_ops_io.dart +++ b/packages/vector_graphics_compiler/lib/src/_initialize_path_ops_io.dart @@ -34,7 +34,7 @@ bool initializePathOpsFromFlutterCache() { print('path_ops not supported on ${Platform.localeName}'); return false; } - final String pathops = + final pathops = '${cacheRoot.path}/artifacts/engine/$platform/$executable'; if (!File(pathops).existsSync()) { print('Could not locate libpathops at $pathops.'); diff --git a/packages/vector_graphics_compiler/lib/src/_initialize_tessellator_io.dart b/packages/vector_graphics_compiler/lib/src/_initialize_tessellator_io.dart index 756fd32f046..735f633687d 100644 --- a/packages/vector_graphics_compiler/lib/src/_initialize_tessellator_io.dart +++ b/packages/vector_graphics_compiler/lib/src/_initialize_tessellator_io.dart @@ -34,7 +34,7 @@ bool initializeTessellatorFromFlutterCache() { print('Tesselation not supported on ${Platform.localeName}'); return false; } - final String tessellator = + final tessellator = '${cacheRoot.path}/artifacts/engine/$platform/$executable'; if (!File(tessellator).existsSync()) { print('Could not locate libtessellator at $tessellator.'); diff --git a/packages/vector_graphics_compiler/lib/src/debug_format.dart b/packages/vector_graphics_compiler/lib/src/debug_format.dart index 2ca0cf63da0..16feaf55e4c 100644 --- a/packages/vector_graphics_compiler/lib/src/debug_format.dart +++ b/packages/vector_graphics_compiler/lib/src/debug_format.dart @@ -12,8 +12,8 @@ import 'paint.dart'; /// Write an unstable but human readable form of the vector graphics binary /// package intended to be used for debugging and development. Uint8List dumpToDebugFormat(Uint8List bytes) { - const VectorGraphicsCodec codec = VectorGraphicsCodec(); - final _DebugVectorGraphicsListener listener = _DebugVectorGraphicsListener(); + const codec = VectorGraphicsCodec(); + final listener = _DebugVectorGraphicsListener(); final DecodeResponse response = codec.decode( bytes.buffer.asByteData(), listener, @@ -54,7 +54,7 @@ class _DebugVectorGraphicsListener extends VectorGraphicsCodecListener { @override void onDrawPath(int pathId, int? paintId, int? patternId) { - final String patternContext = patternId != null + final patternContext = patternId != null ? ', patternId:$patternId' : ''; buffer.writeln('DrawPath: id:$pathId (paintId:$paintId$patternContext)'); @@ -201,7 +201,7 @@ class _DebugVectorGraphicsListener extends VectorGraphicsCodecListener { int tileMode, int id, ) { - final bool hasFocal = focalX != null; + final hasFocal = focalX != null; buffer.writeln( 'StoreGradient: id:$id Radial(\n' 'center: ($centerX, $centerY)\n' diff --git a/packages/vector_graphics_compiler/lib/src/draw_command_builder.dart b/packages/vector_graphics_compiler/lib/src/draw_command_builder.dart index 1b1bc5b53c3..03599bafd3f 100644 --- a/packages/vector_graphics_compiler/lib/src/draw_command_builder.dart +++ b/packages/vector_graphics_compiler/lib/src/draw_command_builder.dart @@ -135,9 +135,9 @@ class DrawCommandBuilder { /// Add an image to the current draw command stack. void addImage(ResolvedImageNode node, String? debugString) { - final ImageData imageData = ImageData(node.data, node.format.index); + final imageData = ImageData(node.data, node.format.index); final int imageId = _getOrGenerateId(imageData, _images); - final DrawImageData drawImageData = DrawImageData( + final drawImageData = DrawImageData( imageId, node.rect, node.transform, diff --git a/packages/vector_graphics_compiler/lib/src/geometry/matrix.dart b/packages/vector_graphics_compiler/lib/src/geometry/matrix.dart index 200bd59d4c5..02e5e7bf2df 100644 --- a/packages/vector_graphics_compiler/lib/src/geometry/matrix.dart +++ b/packages/vector_graphics_compiler/lib/src/geometry/matrix.dart @@ -215,7 +215,7 @@ class AffineMatrix { /// The transformed rect is then projected back into the plane with z equals /// 0.0 before computing its bounding rect. Rect _transformRect(Float64List transform, Rect rect) { - final Float64List storage = transform; + final storage = transform; final double x = rect.left; final double y = rect.top; final double w = rect.right - x; @@ -380,8 +380,8 @@ Rect _transformRect(Float64List transform, Rect rect) { final double ry = storage[1] * x + storage[5] * y + storage[13]; if (storage[3] == 0.0 && storage[7] == 0.0 && storage[15] == 1.0) { - double left = rx; - double right = rx; + var left = rx; + var right = rx; if (wx < 0) { left += wx; } else { @@ -393,8 +393,8 @@ Rect _transformRect(Float64List transform, Rect rect) { right += hx; } - double top = ry; - double bottom = ry; + var top = ry; + var bottom = ry; if (wy < 0) { top += wy; } else { @@ -431,13 +431,13 @@ Rect _transformRect(Float64List transform, Rect rect) { } double _min4(double a, double b, double c, double d) { - final double e = (a < b) ? a : b; - final double f = (c < d) ? c : d; + final e = (a < b) ? a : b; + final f = (c < d) ? c : d; return (e < f) ? e : f; } double _max4(double a, double b, double c, double d) { - final double e = (a > b) ? a : b; - final double f = (c > d) ? c : d; + final e = (a > b) ? a : b; + final f = (c > d) ? c : d; return (e > f) ? e : f; } diff --git a/packages/vector_graphics_compiler/lib/src/geometry/path.dart b/packages/vector_graphics_compiler/lib/src/geometry/path.dart index c2927fc5627..51f7ffe0a4c 100644 --- a/packages/vector_graphics_compiler/lib/src/geometry/path.dart +++ b/packages/vector_graphics_compiler/lib/src/geometry/path.dart @@ -369,12 +369,12 @@ class PathBuilder implements PathProxy { /// Adds an oval command to new path. PathBuilder addOval(Rect oval) { - final Point r = Point(oval.width * 0.5, oval.height * 0.5); - final Point c = Point( + final r = Point(oval.width * 0.5, oval.height * 0.5); + final c = Point( oval.left + (oval.width * 0.5), oval.top + (oval.height * 0.5), ); - final Point m = Point( + final m = Point( _kArcApproximationMagic * r.x, _kArcApproximationMagic * r.y, ); @@ -483,7 +483,7 @@ class PathBuilder implements PathProxy { /// path objects with the same commands. By default, the builder will reset /// to an initial state. Path toPath({bool reset = true}) { - final Path path = Path(commands: _commands, fillType: fillType); + final path = Path(commands: _commands, fillType: fillType); if (reset) { _commands.clear(); @@ -524,7 +524,7 @@ class Path { /// Creates a new path whose commands and points are transformed by `matrix`. Path transformed(AffineMatrix matrix) { - final List commands = []; + final commands = []; for (final PathCommand command in _commands) { commands.add(command.transformed(matrix)); } @@ -554,7 +554,7 @@ class Path { if (intervals.isEmpty) { return this; } - final _PathDasher dasher = _PathDasher(intervals); + final dasher = _PathDasher(intervals); return dasher.dash(this); } @@ -570,20 +570,20 @@ class Path { for (final PathCommand command in _commands) { switch (command.type) { case PathCommandType.move: - final MoveToCommand move = command as MoveToCommand; + final move = command as MoveToCommand; smallestX = math.min(move.x, smallestX); smallestY = math.min(move.y, smallestY); largestX = math.max(move.x, largestX); largestY = math.max(move.y, largestY); case PathCommandType.line: - final LineToCommand move = command as LineToCommand; + final move = command as LineToCommand; smallestX = math.min(move.x, smallestX); smallestY = math.min(move.y, smallestY); largestX = math.max(move.x, largestX); largestY = math.max(move.y, largestY); case PathCommandType.cubic: - final CubicToCommand cubic = command as CubicToCommand; - for (final List pair in >[ + final cubic = command as CubicToCommand; + for (final pair in >[ [cubic.x1, cubic.y1], [cubic.x2, cubic.y2], [cubic.x3, cubic.y3], @@ -602,7 +602,7 @@ class Path { /// Returns a string that prints the dart:ui code to create this path. String toFlutterString() { - final StringBuffer buffer = StringBuffer('Path()'); + final buffer = StringBuffer('Path()'); if (fillType != PathFillType.nonZero) { buffer.write('\n ..fillType = $fillType'); } @@ -615,7 +615,7 @@ class Path { @override String toString() { - final StringBuffer buffer = StringBuffer('Path('); + final buffer = StringBuffer('Path('); if (commands.isNotEmpty) { buffer.write('\n commands: $commands,'); } @@ -633,9 +633,9 @@ Path parseSvgPathData(String svg, [PathFillType? type]) { return Path(fillType: type ?? PathFillType.nonZero); } - final SvgPathStringSource parser = SvgPathStringSource(svg); - final PathBuilder pathBuilder = PathBuilder(type); - final SvgPathNormalizer normalizer = SvgPathNormalizer(); + final parser = SvgPathStringSource(svg); + final pathBuilder = PathBuilder(type); + final normalizer = SvgPathNormalizer(); for (final PathSegmentData seg in parser.parseSegments()) { normalizer.emitSegment(seg, pathBuilder); } @@ -739,12 +739,12 @@ class _PathDasher { for (final PathCommand command in path._commands) { switch (command.type) { case PathCommandType.move: - final MoveToCommand move = command as MoveToCommand; + final move = command as MoveToCommand; currentPoint = Point(move.x, move.y); currentSubpathPoint = currentPoint; _dashedCommands.add(command); case PathCommandType.line: - final LineToCommand line = command as LineToCommand; + final line = command as LineToCommand; _dashLineTo(Point(line.x, line.y)); case PathCommandType.cubic: _dashCubicTo(command as CubicToCommand); diff --git a/packages/vector_graphics_compiler/lib/src/geometry/vertices.dart b/packages/vector_graphics_compiler/lib/src/geometry/vertices.dart index 3204655c7ed..1cd478e8ed3 100644 --- a/packages/vector_graphics_compiler/lib/src/geometry/vertices.dart +++ b/packages/vector_graphics_compiler/lib/src/geometry/vertices.dart @@ -20,8 +20,8 @@ class Vertices { 'vertices', ); } - final List vertexPoints = []; - for (int index = 0; index < vertices.length; index += 2) { + final vertexPoints = []; + for (var index = 0; index < vertices.length; index += 2) { vertexPoints.add(Point(vertices[index], vertices[index + 1])); } return Vertices(vertexPoints); @@ -35,17 +35,17 @@ class Vertices { /// Creates an optimized version of [vertexPoints] where the points are /// deduplicated via an index buffer. IndexedVertices createIndex() { - final Map pointMap = {}; - int index = 0; - final List indices = []; + final pointMap = {}; + var index = 0; + final indices = []; for (final Point point in vertexPoints) { indices.add(pointMap.putIfAbsent(point, () => index++)); } Float32List pointsToFloat32List(List points) { - final Float32List vertices = Float32List(points.length * 2); - int vertexIndex = 0; - for (final Point point in points) { + final vertices = Float32List(points.length * 2); + var vertexIndex = 0; + for (final point in points) { vertices[vertexIndex++] = point.x; vertices[vertexIndex++] = point.y; } diff --git a/packages/vector_graphics_compiler/lib/src/image/image_info.dart b/packages/vector_graphics_compiler/lib/src/image/image_info.dart index ce8c2cd7083..24e425cdb94 100644 --- a/packages/vector_graphics_compiler/lib/src/image/image_info.dart +++ b/packages/vector_graphics_compiler/lib/src/image/image_info.dart @@ -139,7 +139,7 @@ class JpegImageSizeData extends ImageSizeData { : super(format: ImageFormat.jpeg); factory JpegImageSizeData._fromBytes(ByteData data) { - int index = 4; // Skip the first header bytes (already validated). + var index = 4; // Skip the first header bytes (already validated). index += data.getUint16(index); while (index < data.lengthInBytes) { if (data.getUint8(index) != 0xFF) { diff --git a/packages/vector_graphics_compiler/lib/src/paint.dart b/packages/vector_graphics_compiler/lib/src/paint.dart index c1a12e2509f..9b17473f49e 100644 --- a/packages/vector_graphics_compiler/lib/src/paint.dart +++ b/packages/vector_graphics_compiler/lib/src/paint.dart @@ -451,8 +451,8 @@ class Paint { @override String toString() { - final StringBuffer buffer = StringBuffer('Paint(blendMode: $blendMode'); - const String leading = ', '; + final buffer = StringBuffer('Paint(blendMode: $blendMode'); + const leading = ', '; if (stroke != null) { buffer.write('${leading}stroke: $stroke'); } @@ -530,8 +530,8 @@ class Stroke { @override String toString() { - final StringBuffer buffer = StringBuffer('Stroke(color: $color'); - const String leading = ', '; + final buffer = StringBuffer('Stroke(color: $color'); + const leading = ', '; if (shader != null) { buffer.write('${leading}shader: $shader'); } @@ -580,8 +580,8 @@ class Fill { @override String toString() { - final StringBuffer buffer = StringBuffer('Fill(color: $color'); - const String leading = ', '; + final buffer = StringBuffer('Fill(color: $color'); + const leading = ', '; if (shader != null) { buffer.write('${leading}shader: $shader'); @@ -1290,7 +1290,7 @@ class TextPosition { @override String toString() { - final StringBuffer buffer = StringBuffer(); + final buffer = StringBuffer(); buffer.write('TextPosition(reset: $reset'); if (x != null) { buffer.write(', x: $x'); @@ -1454,8 +1454,8 @@ class TextDecoration { /// Creates a decoration that paints the union of all the given decorations. factory TextDecoration.combine(List decorations) { - int mask = 0; - for (final TextDecoration decoration in decorations) { + var mask = 0; + for (final decoration in decorations) { mask |= decoration.mask; } return TextDecoration._(mask); @@ -1494,7 +1494,7 @@ class TextDecoration { if (mask == 0) { return 'TextDecoration.none'; } - final List values = []; + final values = []; if (mask & underline.mask != 0) { values.add('underline'); } diff --git a/packages/vector_graphics_compiler/lib/src/svg/_path_ops_ffi.dart b/packages/vector_graphics_compiler/lib/src/svg/_path_ops_ffi.dart index 34c8347a3b2..05bc0bfa83b 100644 --- a/packages/vector_graphics_compiler/lib/src/svg/_path_ops_ffi.dart +++ b/packages/vector_graphics_compiler/lib/src/svg/_path_ops_ffi.dart @@ -27,7 +27,7 @@ class Path implements PathProxy { /// Creates a copy of this path. factory Path.from(Path other) { - final Path result = Path(other.fillType); + final result = Path(other.fillType); other.replay(result); return result; } @@ -57,7 +57,7 @@ class Path implements PathProxy { if (reset) { proxy.reset(); } - int index = 0; + var index = 0; for (final PathVerb verb in verbs.toList()) { switch (verb) { case PathVerb.moveTo: @@ -188,7 +188,7 @@ class Path implements PathProxy { Path applyOp(Path other, PathOp op) { assert(_path != null); assert(other._path != null); - final Path result = Path.from(this); + final result = Path.from(this); _opFn(result._path!, other._path!, op.index); return result; } diff --git a/packages/vector_graphics_compiler/lib/src/svg/_path_ops_unsupported.dart b/packages/vector_graphics_compiler/lib/src/svg/_path_ops_unsupported.dart index 416152c04e3..d9abca5e53f 100644 --- a/packages/vector_graphics_compiler/lib/src/svg/_path_ops_unsupported.dart +++ b/packages/vector_graphics_compiler/lib/src/svg/_path_ops_unsupported.dart @@ -19,7 +19,7 @@ class Path implements PathProxy { /// Creates a copy of this path. factory Path.from(Path other) { - final Path result = Path(other.fillType); + final result = Path(other.fillType); other.replay(result); return result; } diff --git a/packages/vector_graphics_compiler/lib/src/svg/_tessellator_ffi.dart b/packages/vector_graphics_compiler/lib/src/svg/_tessellator_ffi.dart index 4a408240b9a..2d76ec4f14e 100644 --- a/packages/vector_graphics_compiler/lib/src/svg/_tessellator_ffi.dart +++ b/packages/vector_graphics_compiler/lib/src/svg/_tessellator_ffi.dart @@ -88,19 +88,19 @@ class Tessellator extends Visitor return pathNode; } - final List children = []; + final children = []; if (fill != null) { - final VerticesBuilder builder = VerticesBuilder(); + final builder = VerticesBuilder(); for (final PathCommand command in pathNode.path.commands) { switch (command.type) { case PathCommandType.move: - final MoveToCommand move = command as MoveToCommand; + final move = command as MoveToCommand; builder.moveTo(move.x, move.y); case PathCommandType.line: - final LineToCommand line = command as LineToCommand; + final line = command as LineToCommand; builder.lineTo(line.x, line.y); case PathCommandType.cubic: - final CubicToCommand cubic = command as CubicToCommand; + final cubic = command as CubicToCommand; builder.cubicTo( cubic.x1, cubic.y1, @@ -117,7 +117,7 @@ class Tessellator extends Visitor fillType: pathNode.path.fillType, ); if (rawVertices.isNotEmpty) { - final Vertices vertices = Vertices.fromFloat32List(rawVertices); + final vertices = Vertices.fromFloat32List(rawVertices); final IndexedVertices indexedVertices = vertices.createIndex(); children.add( ResolvedVerticesNode( diff --git a/packages/vector_graphics_compiler/lib/src/svg/clipping_optimizer.dart b/packages/vector_graphics_compiler/lib/src/svg/clipping_optimizer.dart index e008e0db848..0da96b033d5 100644 --- a/packages/vector_graphics_compiler/lib/src/svg/clipping_optimizer.dart +++ b/packages/vector_graphics_compiler/lib/src/svg/clipping_optimizer.dart @@ -36,7 +36,7 @@ class ClippingOptimizer extends Visitor<_Result, Node> /// Applies clip to a path node, and returns resulting path node. ResolvedPathNode applyClip(Node child, Path clipPath) { - final ResolvedPathNode pathNode = child as ResolvedPathNode; + final pathNode = child as ResolvedPathNode; final path_ops.Path clipPathOpsPath = toPathOpsPath(clipPath); final path_ops.Path pathPathOpsPath = toPathOpsPath(pathNode.path); final path_ops.Path intersection = clipPathOpsPath.applyOp( @@ -44,7 +44,7 @@ class ClippingOptimizer extends Visitor<_Result, Node> path_ops.PathOp.intersect, ); final Path newPath = toVectorGraphicsPath(intersection); - final ResolvedPathNode newPathNode = ResolvedPathNode( + final newPathNode = ResolvedPathNode( paint: pathNode.paint, bounds: newPath.bounds(), path: newPath, @@ -60,7 +60,7 @@ class ClippingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitEmptyNode(Node node, void data) { - final _Result result = _Result(node); + final result = _Result(node); return result; } @@ -76,8 +76,8 @@ class ClippingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitParentNode(ParentNode parentNode, Node data) { - final List newChildren = []; - bool deleteClipNode = true; + final newChildren = []; + var deleteClipNode = true; for (final Node child in parentNode.children) { final _Result childResult = child.accept(this, parentNode); @@ -87,13 +87,13 @@ class ClippingOptimizer extends Visitor<_Result, Node> } } - final ParentNode newParentNode = ParentNode( + final newParentNode = ParentNode( parentNode.attributes, precalculatedTransform: parentNode.transform, children: newChildren, ); - final _Result result = _Result(newParentNode); + final result = _Result(newParentNode); result.deleteClipNode = deleteClipNode; return result; @@ -102,14 +102,14 @@ class ClippingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitMaskNode(MaskNode maskNode, Node data) { - final _Result result = _Result(maskNode); + final result = _Result(maskNode); return result; } @override // ignore: library_private_types_in_public_api _Result visitPathNode(PathNode pathNode, Node data) { - final _Result result = _Result(pathNode); + final result = _Result(pathNode); return result; } @@ -117,12 +117,12 @@ class ClippingOptimizer extends Visitor<_Result, Node> // ignore: library_private_types_in_public_api _Result visitResolvedMaskNode(ResolvedMaskNode maskNode, void data) { final _Result childResult = maskNode.child.accept(this, maskNode); - final ResolvedMaskNode newMaskNode = ResolvedMaskNode( + final newMaskNode = ResolvedMaskNode( child: childResult.node, mask: maskNode.mask, blendMode: maskNode.blendMode, ); - final _Result result = _Result(newMaskNode); + final result = _Result(newMaskNode); result.children.add(childResult.node); result.childCount = 1; @@ -132,7 +132,7 @@ class ClippingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitResolvedClipNode(ResolvedClipNode clipNode, Node data) { - _Result result = _Result(clipNode); + var result = _Result(clipNode); Path? singleClipPath; if (clipNode.clips.length == 1) { @@ -147,7 +147,7 @@ class ClippingOptimizer extends Visitor<_Result, Node> if (childResult.deleteClipNode) { result = _Result(childResult.node); } else { - final ResolvedClipNode newClipNode = ResolvedClipNode( + final newClipNode = ResolvedClipNode( child: childResult.node, clips: clipNode.clips, ); @@ -155,7 +155,7 @@ class ClippingOptimizer extends Visitor<_Result, Node> } } else { final _Result childResult = clipNode.child.accept(this, clipNode); - final ResolvedClipNode newClipNode = ResolvedClipNode( + final newClipNode = ResolvedClipNode( child: childResult.node, clips: clipNode.clips, ); @@ -167,9 +167,9 @@ class ClippingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitResolvedPath(ResolvedPathNode pathNode, Node data) { - _Result result = _Result(pathNode); - bool hasStrokeWidth = false; - bool deleteClipNode = true; + var result = _Result(pathNode); + var hasStrokeWidth = false; + var deleteClipNode = true; if (pathNode.paint.stroke?.width != null) { hasStrokeWidth = true; @@ -177,7 +177,7 @@ class ClippingOptimizer extends Visitor<_Result, Node> } if (clipsToApply.isNotEmpty && !hasStrokeWidth) { - ResolvedPathNode newPathNode = pathNode; + var newPathNode = pathNode; for (final Path clipPath in clipsToApply) { final ResolvedPathNode intersection = applyClip(newPathNode, clipPath); if (intersection.path.commands.isNotEmpty) { @@ -198,7 +198,7 @@ class ClippingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitResolvedText(ResolvedTextNode textNode, Node data) { - final _Result result = _Result(textNode); + final result = _Result(textNode); return result; } @@ -208,25 +208,25 @@ class ClippingOptimizer extends Visitor<_Result, Node> ResolvedVerticesNode verticesNode, Node data, ) { - final _Result result = _Result(verticesNode); + final result = _Result(verticesNode); return result; } @override // ignore: library_private_types_in_public_api _Result visitSaveLayerNode(SaveLayerNode layerNode, Node data) { - final List newChildren = []; + final newChildren = []; for (final Node child in layerNode.children) { final _Result childResult = child.accept(this, layerNode); newChildren.add(childResult.node); } - final SaveLayerNode newLayerNode = SaveLayerNode( + final newLayerNode = SaveLayerNode( layerNode.attributes, paint: layerNode.paint, children: newChildren, ); - final _Result result = _Result(newLayerNode); + final result = _Result(newLayerNode); result.children = newChildren; result.childCount = newChildren.length; return result; @@ -235,13 +235,13 @@ class ClippingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitViewportNode(ViewportNode viewportNode, void data) { - final List children = []; + final children = []; for (final Node child in viewportNode.children) { final _Result childNode = child.accept(this, viewportNode); children.add(childNode.node); } - final ViewportNode node = ViewportNode( + final node = ViewportNode( viewportNode.attributes, width: viewportNode.width, height: viewportNode.height, @@ -249,7 +249,7 @@ class ClippingOptimizer extends Visitor<_Result, Node> children: children, ); - final _Result result = _Result(node); + final result = _Result(node); result.children = children; result.childCount = children.length; return result; @@ -261,7 +261,7 @@ class ClippingOptimizer extends Visitor<_Result, Node> ResolvedImageNode resolvedImageNode, Node data, ) { - final _Result result = _Result(resolvedImageNode); + final result = _Result(resolvedImageNode); result.deleteClipNode = false; return result; } diff --git a/packages/vector_graphics_compiler/lib/src/svg/masking_optimizer.dart b/packages/vector_graphics_compiler/lib/src/svg/masking_optimizer.dart index 3395df9e690..755f8799a4f 100644 --- a/packages/vector_graphics_compiler/lib/src/svg/masking_optimizer.dart +++ b/packages/vector_graphics_compiler/lib/src/svg/masking_optimizer.dart @@ -42,15 +42,15 @@ PathFillType toVectorGraphicsFillType(path_ops.FillType fill) { /// Converts vector_graphics Path to path_ops Path. path_ops.Path toPathOpsPath(Path path) { - final path_ops.Path newPath = path_ops.Path(toPathOpsFillTyle(path.fillType)); + final newPath = path_ops.Path(toPathOpsFillTyle(path.fillType)); for (final PathCommand command in path.commands) { switch (command.type) { case PathCommandType.line: - final LineToCommand lineToCommand = command as LineToCommand; + final lineToCommand = command as LineToCommand; newPath.lineTo(lineToCommand.x, lineToCommand.y); case PathCommandType.cubic: - final CubicToCommand cubicToCommand = command as CubicToCommand; + final cubicToCommand = command as CubicToCommand; newPath.cubicTo( cubicToCommand.x1, cubicToCommand.y1, @@ -60,7 +60,7 @@ path_ops.Path toPathOpsPath(Path path) { cubicToCommand.y3, ); case PathCommandType.move: - final MoveToCommand moveToCommand = command as MoveToCommand; + final moveToCommand = command as MoveToCommand; newPath.moveTo(moveToCommand.x, moveToCommand.y); case PathCommandType.close: newPath.close(); @@ -72,9 +72,9 @@ path_ops.Path toPathOpsPath(Path path) { /// Converts path_ops Path to VectorGraphicsPath. Path toVectorGraphicsPath(path_ops.Path path) { - final List newCommands = []; + final newCommands = []; - int index = 0; + var index = 0; final Float32List points = path.points; for (final path_ops.PathVerb verb in path.verbs.toList()) { switch (verb) { @@ -104,7 +104,7 @@ Path toVectorGraphicsPath(path_ops.Path path) { } } - final Path newPath = Path( + final newPath = Path( commands: newCommands, fillType: toVectorGraphicsFillType(path.fillType), ); @@ -151,7 +151,7 @@ class MaskingOptimizer extends Visitor<_Result, Node> path_ops.PathOp.intersect, ); final Path newPath = toVectorGraphicsPath(intersection); - final ResolvedPathNode newPathNode = ResolvedPathNode( + final newPathNode = ResolvedPathNode( paint: pathNode.paint, bounds: maskPathNode.bounds, path: newPath, @@ -167,7 +167,7 @@ class MaskingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitEmptyNode(Node node, void data) { - final _Result result = _Result(node); + final result = _Result(node); return result; } @@ -183,7 +183,7 @@ class MaskingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitParentNode(ParentNode parentNode, Node data) { - final List newChildren = []; + final newChildren = []; for (final Node child in parentNode.children) { final _Result childResult = child.accept(this, parentNode); @@ -193,13 +193,13 @@ class MaskingOptimizer extends Visitor<_Result, Node> } } - final ParentNode newParentNode = ParentNode( + final newParentNode = ParentNode( parentNode.attributes, precalculatedTransform: parentNode.transform, children: newChildren, ); - final _Result result = _Result(newParentNode); + final result = _Result(newParentNode); return result; } @@ -207,7 +207,7 @@ class MaskingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitMaskNode(MaskNode maskNode, Node data) { - final _Result result = _Result(maskNode); + final result = _Result(maskNode); return result; } @@ -215,14 +215,14 @@ class MaskingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitPathNode(PathNode pathNode, Node data) { - final _Result result = _Result(pathNode); + final result = _Result(pathNode); return result; } @override // ignore: library_private_types_in_public_api _Result visitResolvedMaskNode(ResolvedMaskNode maskNode, void data) { - _Result result = _Result(maskNode); + var result = _Result(maskNode); final ResolvedPathNode? singleMaskPathNode = getSingleChild(maskNode.mask); if (singleMaskPathNode != null) { @@ -233,7 +233,7 @@ class MaskingOptimizer extends Visitor<_Result, Node> if (childResult.deleteMaskNode) { result = _Result(childResult.node); } else { - final ResolvedMaskNode newMaskNode = ResolvedMaskNode( + final newMaskNode = ResolvedMaskNode( child: childResult.node, mask: maskNode.mask, blendMode: maskNode.blendMode, @@ -242,7 +242,7 @@ class MaskingOptimizer extends Visitor<_Result, Node> } } else { final _Result childResult = maskNode.child.accept(this, maskNode); - final ResolvedMaskNode newMaskNode = ResolvedMaskNode( + final newMaskNode = ResolvedMaskNode( child: childResult.node, mask: maskNode.mask, blendMode: maskNode.blendMode, @@ -257,11 +257,11 @@ class MaskingOptimizer extends Visitor<_Result, Node> // ignore: library_private_types_in_public_api _Result visitResolvedClipNode(ResolvedClipNode clipNode, Node data) { final _Result childResult = clipNode.child.accept(this, clipNode); - final ResolvedClipNode newClipNode = ResolvedClipNode( + final newClipNode = ResolvedClipNode( clips: clipNode.clips, child: childResult.node, ); - final _Result result = _Result(newClipNode); + final result = _Result(newClipNode); result.children.add(childResult.node); return result; @@ -270,14 +270,14 @@ class MaskingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitResolvedPath(ResolvedPathNode pathNode, Node data) { - _Result result = _Result(pathNode); + var result = _Result(pathNode); if (pathNode.paint.stroke?.width != null) { return _Result(pathNode, deleteMaskNode: false); } if (masksToApply.isNotEmpty) { - ResolvedPathNode newPathNode = pathNode; + var newPathNode = pathNode; for (final ResolvedPathNode maskPathNode in masksToApply) { final ResolvedPathNode intersection = applyMask( newPathNode, @@ -298,7 +298,7 @@ class MaskingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitResolvedText(ResolvedTextNode textNode, Node data) { - final _Result result = _Result(textNode); + final result = _Result(textNode); return result; } @@ -308,25 +308,25 @@ class MaskingOptimizer extends Visitor<_Result, Node> ResolvedVerticesNode verticesNode, Node data, ) { - final _Result result = _Result(verticesNode); + final result = _Result(verticesNode); return result; } @override // ignore: library_private_types_in_public_api _Result visitSaveLayerNode(SaveLayerNode layerNode, Node data) { - final List newChildren = []; + final newChildren = []; for (final Node child in layerNode.children) { final _Result childResult = child.accept(this, layerNode); newChildren.add(childResult.node); } - final SaveLayerNode newLayerNode = SaveLayerNode( + final newLayerNode = SaveLayerNode( layerNode.attributes, paint: layerNode.paint, children: newChildren, ); - final _Result result = _Result(newLayerNode); + final result = _Result(newLayerNode); result.children.addAll(newChildren); return result; } @@ -334,13 +334,13 @@ class MaskingOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitViewportNode(ViewportNode viewportNode, void data) { - final List children = []; + final children = []; for (final Node child in viewportNode.children) { final _Result childNode = child.accept(this, viewportNode); children.add(childNode.node); } - final ViewportNode node = ViewportNode( + final node = ViewportNode( viewportNode.attributes, width: viewportNode.width, height: viewportNode.height, @@ -348,7 +348,7 @@ class MaskingOptimizer extends Visitor<_Result, Node> children: children, ); - final _Result result = _Result(node); + final result = _Result(node); result.children.addAll(children); return result; } @@ -359,7 +359,7 @@ class MaskingOptimizer extends Visitor<_Result, Node> ResolvedImageNode resolvedImageNode, Node data, ) { - final _Result result = _Result(resolvedImageNode, deleteMaskNode: false); + final result = _Result(resolvedImageNode, deleteMaskNode: false); return result; } diff --git a/packages/vector_graphics_compiler/lib/src/svg/numbers.dart b/packages/vector_graphics_compiler/lib/src/svg/numbers.dart index f58cbae0800..8798422f9f4 100644 --- a/packages/vector_graphics_compiler/lib/src/svg/numbers.dart +++ b/packages/vector_graphics_compiler/lib/src/svg/numbers.dart @@ -65,7 +65,7 @@ double? parseDoubleWithUnits( bool tryParse = false, required SvgTheme theme, }) { - double unit = 1.0; + var unit = 1.0; // 1 rem unit is equal to the root font size. // 1 em unit is equal to the current font size. diff --git a/packages/vector_graphics_compiler/lib/src/svg/overdraw_optimizer.dart b/packages/vector_graphics_compiler/lib/src/svg/overdraw_optimizer.dart index 469f9a539b2..492d038401d 100644 --- a/packages/vector_graphics_compiler/lib/src/svg/overdraw_optimizer.dart +++ b/packages/vector_graphics_compiler/lib/src/svg/overdraw_optimizer.dart @@ -42,7 +42,7 @@ class OverdrawOptimizer extends Visitor<_Result, Node> path_ops.PathOp.difference, ); final Path newPath = toVectorGraphicsPath(newBottomPath); - final ResolvedPathNode newPathNode = ResolvedPathNode( + final newPathNode = ResolvedPathNode( paint: bottomPathNode.paint, bounds: bottomPathNode.bounds, path: newPath, @@ -73,7 +73,7 @@ class OverdrawOptimizer extends Visitor<_Result, Node> final double g = ((1 - a0) * a1 * g1 + a0 * g0) / a; final double b = ((1 - a0) * a1 * b1 + a0 * b0) / a; - final Color overlapColor = Color.fromARGB( + final overlapColor = Color.fromARGB( (a * 255).round(), r.round(), g.round(), @@ -113,17 +113,17 @@ class OverdrawOptimizer extends Visitor<_Result, Node> final Path newTopVGPath = toVectorGraphicsPath(newTopPath); final Path newOverlapVGPath = toVectorGraphicsPath(intersection); - final ResolvedPathNode newBottomPathNode = ResolvedPathNode( + final newBottomPathNode = ResolvedPathNode( paint: bottomPathNode.paint, bounds: bottomPathNode.bounds, path: newBottomVGPath, ); - final ResolvedPathNode newTopPathNode = ResolvedPathNode( + final newTopPathNode = ResolvedPathNode( paint: topPathNode.paint, bounds: bottomPathNode.bounds, path: newTopVGPath, ); - final ResolvedPathNode newOverlapPathNode = ResolvedPathNode( + final newOverlapPathNode = ResolvedPathNode( paint: Paint( blendMode: bottomPathNode.paint.blendMode, stroke: bottomPathNode.paint.stroke, @@ -161,7 +161,7 @@ class OverdrawOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitEmptyNode(Node node, void data) { - final _Result result = _Result(node); + final result = _Result(node); return result; } @@ -177,9 +177,9 @@ class OverdrawOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitParentNode(ParentNode parentNode, Node data) { - int pathNodeCount = 0; - final List> newChildList = >[]; - final List newChildren = []; + var pathNodeCount = 0; + final newChildList = >[]; + final newChildren = []; for (final Node child in parentNode.children) { if (child is ResolvedPathNode) { @@ -188,7 +188,7 @@ class OverdrawOptimizer extends Visitor<_Result, Node> newChildList.add([child]); } - int index = 0; + var index = 0; ResolvedPathNode? lastPathNode; int? lastPathNodeIndex; @@ -244,7 +244,7 @@ class OverdrawOptimizer extends Visitor<_Result, Node> index = 0; /// Here the 2-dimensional list of new children is flattened. - for (final List child in newChildList) { + for (final child in newChildList) { if (child.isNotEmpty) { if (child.first is ResolvedPathNode) { newChildren.addAll(child); @@ -265,7 +265,7 @@ class OverdrawOptimizer extends Visitor<_Result, Node> /// If group opacity is set, the parent nodes children cannot be optimized. return _Result(parentNode); } - final _Result result = _Result( + final result = _Result( ParentNode( parentNode.attributes, children: newChildren, @@ -292,12 +292,12 @@ class OverdrawOptimizer extends Visitor<_Result, Node> // ignore: library_private_types_in_public_api _Result visitResolvedMaskNode(ResolvedMaskNode maskNode, void data) { final _Result childResult = maskNode.child.accept(this, maskNode); - final ResolvedMaskNode newMaskNode = ResolvedMaskNode( + final newMaskNode = ResolvedMaskNode( child: childResult.node, mask: maskNode.mask, blendMode: maskNode.blendMode, ); - final _Result result = _Result(newMaskNode); + final result = _Result(newMaskNode); result.children.add(childResult.node); return result; } @@ -306,11 +306,11 @@ class OverdrawOptimizer extends Visitor<_Result, Node> // ignore: library_private_types_in_public_api _Result visitResolvedClipNode(ResolvedClipNode clipNode, Node data) { final _Result childResult = clipNode.child.accept(this, clipNode); - final ResolvedClipNode newClipNode = ResolvedClipNode( + final newClipNode = ResolvedClipNode( clips: clipNode.clips, child: childResult.node, ); - final _Result result = _Result(newClipNode); + final result = _Result(newClipNode); result.children.add(childResult.node); return result; @@ -340,18 +340,18 @@ class OverdrawOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitSaveLayerNode(SaveLayerNode layerNode, Node data) { - final List newChildren = []; + final newChildren = []; for (final Node child in layerNode.children) { final _Result childResult = child.accept(this, layerNode); newChildren.add(childResult.node); } - final SaveLayerNode newLayerNode = SaveLayerNode( + final newLayerNode = SaveLayerNode( layerNode.attributes, paint: layerNode.paint, children: newChildren, ); - final _Result result = _Result(newLayerNode); + final result = _Result(newLayerNode); result.children.addAll(newChildren); return result; } @@ -368,9 +368,9 @@ class OverdrawOptimizer extends Visitor<_Result, Node> @override // ignore: library_private_types_in_public_api _Result visitViewportNode(ViewportNode viewportNode, void data) { - final List children = []; + final children = []; - final ParentNode parentNode = ParentNode( + final parentNode = ParentNode( SvgAttributes.empty, children: viewportNode.children.toList(), ); @@ -378,7 +378,7 @@ class OverdrawOptimizer extends Visitor<_Result, Node> final _Result childResult = parentNode.accept(this, viewportNode); children.addAll((childResult.node as ParentNode).children); - final ViewportNode node = ViewportNode( + final node = ViewportNode( viewportNode.attributes, width: viewportNode.width, height: viewportNode.height, @@ -386,7 +386,7 @@ class OverdrawOptimizer extends Visitor<_Result, Node> children: children, ); - final _Result result = _Result(node); + final result = _Result(node); result.children.addAll(children); return result; } diff --git a/packages/vector_graphics_compiler/lib/src/svg/parser.dart b/packages/vector_graphics_compiler/lib/src/svg/parser.dart index 3ff4a2398dc..2e86a190b23 100644 --- a/packages/vector_graphics_compiler/lib/src/svg/parser.dart +++ b/packages/vector_graphics_compiler/lib/src/svg/parser.dart @@ -73,7 +73,7 @@ class _Elements { // TODO(dnfield): Support nested SVG elements. https://github.com/dnfield/flutter_svg/issues/132 if (parserState._root != null) { - const String errorMessage = 'Unsupported nested element.'; + const errorMessage = 'Unsupported nested element.'; if (warningsAsErrors) { throw UnsupportedError(errorMessage); } @@ -106,7 +106,7 @@ class _Elements { } final ParentNode parent = parserState.currentGroup!; - final ParentNode group = ParentNode(parserState._currentAttributes); + final group = ParentNode(parserState._currentAttributes); parent.addChild( group, @@ -128,7 +128,7 @@ class _Elements { final ParentNode parent = parserState.currentGroup!; final XmlStartElementEvent element = parserState._currentStartElement!; - final TextPositionNode group = TextPositionNode( + final group = TextPositionNode( parserState._currentAttributes, reset: element.localName == 'text', ); @@ -147,7 +147,7 @@ class _Elements { } static void symbol(SvgParser parserState, bool warningsAsErrors) { - final ParentNode group = ParentNode(parserState._currentAttributes); + final group = ParentNode(parserState._currentAttributes); parserState.addGroup(parserState._currentStartElement!, group); return; } @@ -178,7 +178,7 @@ class _Elements { final String? rawY = attributes.raw['y']; final String id = parserState.buildUrlIri(); parserState.patternIds.add(id); - final SvgAttributes newAttributes = SvgAttributes._( + final newAttributes = SvgAttributes._( raw: attributes.raw, id: attributes.id, href: attributes.href, @@ -199,7 +199,7 @@ class _Elements { height: patternHeight, ); - final ParentNode group = ParentNode(newAttributes); + final group = ParentNode(newAttributes); parserState.addGroup(parserState._currentStartElement!, group); return; } @@ -223,7 +223,7 @@ class _Elements { )!, ); - final ParentNode group = ParentNode( + final group = ParentNode( // parserState._currentAttributes, SvgAttributes.empty, precalculatedTransform: transform, @@ -352,11 +352,11 @@ class _Elements { parseStops(parserState, colors, offsets); } - final Point fromPoint = Point( + final fromPoint = Point( parseDecimalOrPercentage(x1), parseDecimalOrPercentage(y1), ); - final Point toPoint = Point( + final toPoint = Point( parseDecimalOrPercentage(x2), parseDecimalOrPercentage(y2), ); @@ -380,7 +380,7 @@ class _Elements { static void clipPath(SvgParser parserState, bool warningsAsErrors) { final String id = parserState.buildUrlIri(); - final List pathNodes = []; + final pathNodes = []; for (final XmlEvent event in parserState._readSubtree()) { if (event is XmlEndElementEvent) { continue; @@ -414,7 +414,7 @@ class _Elements { ), ); } else { - final String errorMessage = + final errorMessage = 'Unsupported clipPath child ${event.name}'; if (warningsAsErrors) { throw UnsupportedError(errorMessage); @@ -433,7 +433,7 @@ class _Elements { } if (xlinkHref.startsWith('data:')) { - const Map supportedMimeTypes = { + const supportedMimeTypes = { 'png': ImageFormat.png, 'jpeg': ImageFormat.jpeg, 'jpg': ImageFormat.jpeg, @@ -463,7 +463,7 @@ class _Elements { final Uint8List data = base64.decode( xlinkHref.substring(commaLocation).replaceAll(_whitespacePattern, ''), ); - final ImageNode image = ImageNode( + final image = ImageNode( data, format, parserState._currentAttributes, @@ -496,7 +496,7 @@ class _Paths { final double r = parserState.parseDoubleWithUnits( parserState.attribute('r', def: '0'), )!; - final Rect oval = Rect.fromCircle(cx, cy, r); + final oval = Rect.fromCircle(cx, cy, r); return PathBuilder( parserState._currentAttributes.fillRule, ).addOval(oval).toPath(); @@ -551,7 +551,7 @@ class _Paths { if (points == '') { return null; } - final String path = 'M$points${close ? 'z' : ''}'; + final path = 'M$points${close ? 'z' : ''}'; return parseSvgPathData(path, parserState._currentAttributes.fillRule); } @@ -570,7 +570,7 @@ class _Paths { parserState.attribute('ry', def: '0'), )!; - final Rect r = Rect.fromLTWH(cx - rx, cy - ry, rx * 2, ry * 2); + final r = Rect.fromLTWH(cx - rx, cy - ry, rx * 2, ry * 2); return PathBuilder( parserState._currentAttributes.fillRule, ).addOval(r).toPath(); @@ -681,7 +681,7 @@ class SvgParser { final int subtreeStartDepth = depth; while (_eventIterator.moveNext()) { final XmlEvent event = _eventIterator.current; - bool isSelfClosing = false; + var isSelfClosing = false; if (event is XmlStartElementEvent) { final Map attributeMap = _createAttributeMap( event.attributes, @@ -721,7 +721,7 @@ class SvgParser { assert(_inTextOrTSpan); assert(_whitespacePattern.pattern == r'\s'); - final bool textHasNonWhitespace = text.trim() != ''; + final textHasNonWhitespace = text.trim() != ''; // Not from the spec, but seems like how Chrome behaves. // - If `x` is specified, don't prepend whitespace. @@ -808,11 +808,11 @@ class SvgParser { _parseTree(); /// Resolve the tree - final ResolvingVisitor resolvingVisitor = ResolvingVisitor(); - final Tessellator tessellator = Tessellator(); - final MaskingOptimizer maskingOptimizer = MaskingOptimizer(); - final ClippingOptimizer clippingOptimizer = ClippingOptimizer(); - final OverdrawOptimizer overdrawOptimizer = OverdrawOptimizer(); + final resolvingVisitor = ResolvingVisitor(); + final tessellator = Tessellator(); + final maskingOptimizer = MaskingOptimizer(); + final clippingOptimizer = ClippingOptimizer(); + final overdrawOptimizer = OverdrawOptimizer(); Node newRoot = _root!.accept(resolvingVisitor, AffineMatrix.identity); @@ -847,7 +847,7 @@ class SvgParser { } /// Convert to vector instructions - final CommandBuilderVisitor commandVisitor = CommandBuilderVisitor(); + final commandVisitor = CommandBuilderVisitor(); newRoot.accept(commandVisitor, null); return commandVisitor.toInstructions(); @@ -902,7 +902,7 @@ class SvgParser { if (path == null) { return false; } - final PathNode drawable = PathNode(path, _currentAttributes); + final drawable = PathNode(path, _currentAttributes); checkForIri(drawable); parent.addChild( @@ -950,7 +950,7 @@ class SvgParser { /// Will only print an error once for unhandled/unexpected elements, except for /// ``, ``, and `` elements. void unhandledElement(XmlStartElementEvent event) { - final String errorMessage = + final errorMessage = 'unhandled element <${event.name}/>; Picture key: $_key'; if (_warningsAsErrors) { // Throw error instead of log warning. @@ -1089,7 +1089,7 @@ class SvgParser { return double.infinity; } assert(() { - final RegExp notDigits = RegExp(r'[^\d\.]'); + final notDigits = RegExp(r'[^\d\.]'); if (!raw.endsWith('px') && !raw.endsWith('em') && !raw.endsWith('ex') && @@ -1214,9 +1214,9 @@ class SvgParser { } final List parts = rawDashArray.split(RegExp(r'[ ,]+')); - final List doubles = []; - bool atLeastOneNonZeroDash = false; - for (final String part in parts) { + final doubles = []; + var atLeastOneNonZeroDash = false; + for (final part in parts) { final double dashOffset = parseDoubleWithUnits(part)!; if (dashOffset != 0) { atLeastOneNonZeroDash = true; @@ -1417,7 +1417,7 @@ class SvgParser { final double saturation = values[1] / 100; final double luminance = values[2] / 100; final int alpha = values.length > 3 ? values[3] : 255; - List rgb = [0, 0, 0]; + var rgb = [0, 0, 0]; if (hue < 1 / 6) { rgb[0] = 1; @@ -1495,9 +1495,9 @@ class SvgParser { } Map _createAttributeMap(List attributes) { - final Map attributeMap = {}; + final attributeMap = {}; - for (final XmlEventAttribute attribute in attributes) { + for (final attribute in attributes) { final String value = attribute.value.trim(); if (attribute.localName == 'style') { for (final String style in value.split(';')) { @@ -1572,7 +1572,7 @@ class SvgParser { strokeColor = parseColor(rawStroke, attributeName: 'stroke', id: id); } - final Color? color = strokeColor; + final color = strokeColor; return SvgStrokeAttributes._( _definitions, @@ -1730,11 +1730,11 @@ class _Resolver { return []; } - final List pathBuilders = []; + final pathBuilders = []; PathBuilder? currentPath; void extractPathsFromNode(Node? target) { if (target is PathNode) { - final PathBuilder nextPath = PathBuilder.fromPath(target.path); + final nextPath = PathBuilder.fromPath(target.path); nextPath.fillType = target.attributes.clipRule ?? PathFillType.nonZero; if (currentPath != null && nextPath.fillType != currentPath!.fillType) { currentPath = nextPath; @@ -2095,7 +2095,7 @@ class SvgAttributes { AffineMatrix? transformOverride, String? hrefOverride, }) { - final Map newRaw = { + final newRaw = { ...Map.fromEntries(parent.heritable), if (includePosition && parent.raw.containsKey('x')) 'x': parent.raw['x']!, if (includePosition && parent.raw.containsKey('y')) 'y': parent.raw['y']!, diff --git a/packages/vector_graphics_compiler/lib/src/svg/parsers.dart b/packages/vector_graphics_compiler/lib/src/svg/parsers.dart index fec2eb89c7e..5b9dd2b46ba 100644 --- a/packages/vector_graphics_compiler/lib/src/svg/parsers.dart +++ b/packages/vector_graphics_compiler/lib/src/svg/parsers.dart @@ -26,9 +26,9 @@ const Map _matrixParsers = { }; List _parseTransformParams(String params) { - final List result = []; - String current = ''; - for (int i = 0; i < params.length; i += 1) { + final result = []; + var current = ''; + for (var i = 0; i < params.length; i += 1) { final String char = params[i]; final bool isSeparator = char == ' ' || char == '-' || char == ','; final bool isExponent = i > 0 && params[i - 1].toLowerCase() == 'e'; @@ -71,7 +71,7 @@ AffineMatrix? parseTransform(String? transform) { .toList() .reversed; AffineMatrix result = AffineMatrix.identity; - for (final Match m in matches) { + for (final m in matches) { final String command = m.group(1)!.trim(); final List params = _parseTransformParams(m.group(2)!.trim()); diff --git a/packages/vector_graphics_compiler/lib/src/svg/resolver.dart b/packages/vector_graphics_compiler/lib/src/svg/resolver.dart index 7f1ecbc652b..632149c399a 100644 --- a/packages/vector_graphics_compiler/lib/src/svg/resolver.dart +++ b/packages/vector_graphics_compiler/lib/src/svg/resolver.dart @@ -22,7 +22,7 @@ class ResolvingVisitor extends Visitor { @override Node visitClipNode(ClipNode clipNode, AffineMatrix data) { final AffineMatrix childTransform = clipNode.concatTransform(data); - final List transformedClips = [ + final transformedClips = [ for (final Path clip in clipNode.resolver(clipNode.clipId)) clip.transformed(childTransform), ]; @@ -98,8 +98,8 @@ class ResolvingVisitor extends Visitor { final Paint? paint = pathNode.computePaint(originalBounds, transform); if (paint != null) { if (pathNode.attributes.stroke?.dashArray != null) { - final List children = []; - final ParentNode parent = ParentNode( + final children = []; + final parent = ParentNode( pathNode.attributes, children: children, ); @@ -258,11 +258,11 @@ class ResolvingVisitor extends Visitor { double? width = double.tryParse(attributes.raw['width'] ?? ''); double? height = double.tryParse(attributes.raw['height'] ?? ''); if (width == null || height == null) { - final ImageSizeData data = ImageSizeData.fromBytes(imageNode.data); + final data = ImageSizeData.fromBytes(imageNode.data); width ??= data.width.toDouble(); height ??= data.height.toDouble(); } - final Rect rect = Rect.fromLTWH(left, top, width, height); + final rect = Rect.fromLTWH(left, top, width, height); // Determine if this image can be drawn without any transforms because // it only has an offset and/or scale. diff --git a/packages/vector_graphics_compiler/lib/src/util.dart b/packages/vector_graphics_compiler/lib/src/util.dart index c00e978d5c6..cbe9243a84d 100644 --- a/packages/vector_graphics_compiler/lib/src/util.dart +++ b/packages/vector_graphics_compiler/lib/src/util.dart @@ -17,7 +17,7 @@ bool listEquals(List? a, List? b) { if (identical(a, b)) { return true; } - for (int index = 0; index < a.length; index += 1) { + for (var index = 0; index < a.length; index += 1) { if (a[index] != b[index]) { return false; } diff --git a/packages/vector_graphics_compiler/lib/src/vector_instructions.dart b/packages/vector_graphics_compiler/lib/src/vector_instructions.dart index 72a96dfe9dd..15552480633 100644 --- a/packages/vector_graphics_compiler/lib/src/vector_instructions.dart +++ b/packages/vector_graphics_compiler/lib/src/vector_instructions.dart @@ -216,7 +216,7 @@ class DrawCommand { @override String toString() { - final StringBuffer buffer = StringBuffer('DrawCommand($type'); + final buffer = StringBuffer('DrawCommand($type'); if (objectId != null) { buffer.write(', objectId: $objectId'); } diff --git a/packages/vector_graphics_compiler/lib/vector_graphics_compiler.dart b/packages/vector_graphics_compiler/lib/vector_graphics_compiler.dart index fe889333c07..2af9afc725f 100644 --- a/packages/vector_graphics_compiler/lib/vector_graphics_compiler.dart +++ b/packages/vector_graphics_compiler/lib/vector_graphics_compiler.dart @@ -65,7 +65,7 @@ VectorInstructions parse( bool enableOverdrawOptimizer = true, ColorMapper? colorMapper, }) { - final SvgParser parser = SvgParser( + final parser = SvgParser( xml, theme, key, @@ -162,14 +162,14 @@ Uint8List _encodeInstructions( VectorInstructions instructions, bool useHalfPrecisionControlPoints, ) { - const VectorGraphicsCodec codec = VectorGraphicsCodec(); - final VectorGraphicsBuffer buffer = VectorGraphicsBuffer(); + const codec = VectorGraphicsCodec(); + final buffer = VectorGraphicsBuffer(); codec.writeSize(buffer, instructions.width, instructions.height); - final Map fillIds = {}; - final Map strokeIds = {}; - final Map shaderIds = {}; + final fillIds = {}; + final strokeIds = {}; + final shaderIds = {}; for (final ImageData data in instructions.images) { codec.writeImage(buffer, data.format, data.data); @@ -180,7 +180,7 @@ Uint8List _encodeInstructions( _encodeShader(paint.stroke?.shader, shaderIds, codec, buffer); } - int nextPaintId = 0; + var nextPaintId = 0; for (final Paint paint in instructions.paints) { final Fill? fill = paint.fill; final Stroke? stroke = paint.stroke; @@ -212,24 +212,24 @@ Uint8List _encodeInstructions( nextPaintId += 1; } - final Map pathIds = {}; - int nextPathId = 0; + final pathIds = {}; + var nextPathId = 0; for (final Path path in instructions.paths) { - final List controlPointTypes = []; - final List controlPoints = []; + final controlPointTypes = []; + final controlPoints = []; for (final PathCommand command in path.commands) { switch (command.type) { case PathCommandType.move: - final MoveToCommand move = command as MoveToCommand; + final move = command as MoveToCommand; controlPointTypes.add(ControlPointTypes.moveTo); controlPoints.addAll([move.x, move.y]); case PathCommandType.line: - final LineToCommand line = command as LineToCommand; + final line = command as LineToCommand; controlPointTypes.add(ControlPointTypes.lineTo); controlPoints.addAll([line.x, line.y]); case PathCommandType.cubic: - final CubicToCommand cubic = command as CubicToCommand; + final cubic = command as CubicToCommand; controlPointTypes.add(ControlPointTypes.cubicTo); controlPoints.addAll([ cubic.x1, diff --git a/packages/vector_graphics_compiler/test/cli_test.dart b/packages/vector_graphics_compiler/test/cli_test.dart index ea949906588..941a1a010c3 100644 --- a/packages/vector_graphics_compiler/test/cli_test.dart +++ b/packages/vector_graphics_compiler/test/cli_test.dart @@ -12,8 +12,8 @@ import '../bin/util/isolate_processor.dart'; import '../bin/vector_graphics_compiler.dart' as cli; void main() { - final File output = File('test_data/example.vec'); - final File outputDebug = File('test_data/example.vec.debug'); + final output = File('test_data/example.vec'); + final outputDebug = File('test_data/example.vec.debug'); test('currentColor/font-size works', () async { try { @@ -42,7 +42,7 @@ void main() { test('Can run with isolate processor', () async { try { - final IsolateProcessor processor = IsolateProcessor(null, null, 4); + final processor = IsolateProcessor(null, null, 4); final bool result = await processor.process( [Pair('test_data/example.svg', output.path)], maskingOptimizerEnabled: false, @@ -63,7 +63,7 @@ void main() { test('Can dump debug format with isolate processor', () async { try { - final IsolateProcessor processor = IsolateProcessor(null, null, 4); + final processor = IsolateProcessor(null, null, 4); final bool result = await processor.process( [Pair('test_data/example.svg', output.path)], maskingOptimizerEnabled: false, @@ -87,9 +87,9 @@ void main() { }); test('out-dir option works', () async { - const String inputTestDir = 'test_data'; + const inputTestDir = 'test_data'; - const String outTestDir = 'output_vec'; + const outTestDir = 'output_vec'; try { await cli.main([ @@ -99,10 +99,10 @@ void main() { outTestDir, ]); - bool passed = false; + var passed = false; - final Directory inputDir = Directory(inputTestDir); - final Directory outDir = Directory(outTestDir); + final inputDir = Directory(inputTestDir); + final outDir = Directory(outTestDir); if (inputDir.existsSync() && outDir.existsSync()) { final List inputTestFiles = inputDir diff --git a/packages/vector_graphics_compiler/test/clipping_optimizer_test.dart b/packages/vector_graphics_compiler/test/clipping_optimizer_test.dart index c69280fe32d..a7a98f19e22 100644 --- a/packages/vector_graphics_compiler/test/clipping_optimizer_test.dart +++ b/packages/vector_graphics_compiler/test/clipping_optimizer_test.dart @@ -12,12 +12,12 @@ import 'test_svg_strings.dart'; Node parseAndResolve(String source) { final Node node = parseToNodeTree(source); - final ResolvingVisitor visitor = ResolvingVisitor(); + final visitor = ResolvingVisitor(); return node.accept(visitor, AffineMatrix.identity); } List queryChildren(Node node) { - final List children = []; + final children = []; void visitor(Node child) { if (child is T) { children.add(child); @@ -48,7 +48,7 @@ void main() { '''); - final ClippingOptimizer visitor = ClippingOptimizer(); + final visitor = ClippingOptimizer(); final Node newNode = visitor.apply(node); final List clipNodesNew = queryChildren( @@ -69,7 +69,7 @@ void main() { '''); - final ClippingOptimizer visitor = ClippingOptimizer(); + final visitor = ClippingOptimizer(); final Node newNode = visitor.apply(node); final List clipNodesNew = @@ -93,7 +93,7 @@ void main() { '''); - final ClippingOptimizer visitor = ClippingOptimizer(); + final visitor = ClippingOptimizer(); final Node newNode = visitor.apply(node); final List clipNodesNew = @@ -111,7 +111,7 @@ void main() { ); final List parentNodesOld = queryChildren(node); - final ClippingOptimizer visitor = ClippingOptimizer(); + final visitor = ClippingOptimizer(); final Node newNode = visitor.apply(node); final List pathNodesNew = queryChildren( @@ -176,7 +176,7 @@ void main() { }); test('Preserves fill type changes', () { - const String svg = ''' + const svg = ''' diff --git a/packages/vector_graphics_compiler/test/draw_command_builder_test.dart b/packages/vector_graphics_compiler/test/draw_command_builder_test.dart index 079d11827e0..5f5e895ae2c 100644 --- a/packages/vector_graphics_compiler/test/draw_command_builder_test.dart +++ b/packages/vector_graphics_compiler/test/draw_command_builder_test.dart @@ -8,7 +8,7 @@ import 'package:vector_graphics_compiler/vector_graphics_compiler.dart'; void main() { test('DrawCommandBuilder does not emit empty paths', () { - final DrawCommandBuilder builder = DrawCommandBuilder(); + final builder = DrawCommandBuilder(); builder.addPath(Path(), const Paint(), null, null); expect(builder.toInstructions(100, 100).commands, isEmpty); }); diff --git a/packages/vector_graphics_compiler/test/end_to_end_test.dart b/packages/vector_graphics_compiler/test/end_to_end_test.dart index 490bf573e20..2204b2cc93e 100644 --- a/packages/vector_graphics_compiler/test/end_to_end_test.dart +++ b/packages/vector_graphics_compiler/test/end_to_end_test.dart @@ -62,7 +62,7 @@ void main() { testWidgets('Errors on unsupported image mime type', ( WidgetTester tester, ) async { - const String svgInlineImage = r''' + const svgInlineImage = r''' @@ -82,7 +82,7 @@ void main() { }); test('encodeSvg encodes stroke shaders', () async { - const String svg = ''' + const svg = ''' @@ -103,8 +103,8 @@ void main() { enableMaskingOptimizer: false, enableOverdrawOptimizer: false, ); - const VectorGraphicsCodec codec = VectorGraphicsCodec(); - final TestListener listener = TestListener(); + const codec = VectorGraphicsCodec(); + final listener = TestListener(); codec.decode(bytes.buffer.asByteData(), listener); expect(listener.commands, [ const OnSize(120, 120), @@ -138,7 +138,7 @@ void main() { }); test('Encodes nested tspan for text', () async { - const String svg = ''' + const svg = ''' [ const OnSize(1000, 300), @@ -270,7 +270,7 @@ void main() { }); test('Encodes image elids trivial translation transform', () async { - const String svg = + const svg = ''' @@ -286,8 +286,8 @@ void main() { enableMaskingOptimizer: false, enableOverdrawOptimizer: false, ); - const VectorGraphicsCodec codec = VectorGraphicsCodec(); - final TestListener listener = TestListener(); + const codec = VectorGraphicsCodec(); + final listener = TestListener(); final ByteData data = bytes.buffer.asByteData(); final DecodeResponse response = codec.decode(data, listener); codec.decode(data, listener, response: response); @@ -300,7 +300,7 @@ void main() { }); test('Encodes image elids trivial scale transform', () async { - const String svg = + const svg = ''' @@ -316,8 +316,8 @@ void main() { enableMaskingOptimizer: false, enableOverdrawOptimizer: false, ); - const VectorGraphicsCodec codec = VectorGraphicsCodec(); - final TestListener listener = TestListener(); + const codec = VectorGraphicsCodec(); + final listener = TestListener(); final ByteData data = bytes.buffer.asByteData(); final DecodeResponse response = codec.decode(data, listener); codec.decode(data, listener, response: response); @@ -330,7 +330,7 @@ void main() { }); test('Encodes image does not elide non-trivial transform', () async { - const String svg = + const svg = ''' @@ -346,8 +346,8 @@ void main() { enableMaskingOptimizer: false, enableOverdrawOptimizer: false, ); - const VectorGraphicsCodec codec = VectorGraphicsCodec(); - final TestListener listener = TestListener(); + const codec = VectorGraphicsCodec(); + final listener = TestListener(); final ByteData data = bytes.buffer.asByteData(); final DecodeResponse response = codec.decode(data, listener); codec.decode(data, listener, response: response); @@ -1186,7 +1186,7 @@ bool _listEquals(List? left, List? right) { if (left.length != right.length) { return false; } - for (int i = 0; i < left.length; i++) { + for (var i = 0; i < left.length; i++) { if (left[i] != right[i]) { return false; } diff --git a/packages/vector_graphics_compiler/test/helpers.dart b/packages/vector_graphics_compiler/test/helpers.dart index 5c1a2b14fd2..0f404a4441b 100644 --- a/packages/vector_graphics_compiler/test/helpers.dart +++ b/packages/vector_graphics_compiler/test/helpers.dart @@ -5,7 +5,7 @@ import 'package:vector_graphics_compiler/src/svg/node.dart'; List queryChildren(Node node) { - final List children = []; + final children = []; void visitor(Node child) { if (child is T) { children.add(child); diff --git a/packages/vector_graphics_compiler/test/masking_optimizer_test.dart b/packages/vector_graphics_compiler/test/masking_optimizer_test.dart index 9280d0c701e..305703c1905 100644 --- a/packages/vector_graphics_compiler/test/masking_optimizer_test.dart +++ b/packages/vector_graphics_compiler/test/masking_optimizer_test.dart @@ -15,7 +15,7 @@ import 'test_svg_strings.dart'; Node parseAndResolve(String source) { final Node node = parseToNodeTree(source); - final ResolvingVisitor visitor = ResolvingVisitor(); + final visitor = ResolvingVisitor(); return node.accept(visitor, AffineMatrix.identity); } @@ -42,7 +42,7 @@ void main() { '''); - final MaskingOptimizer visitor = MaskingOptimizer(); + final visitor = MaskingOptimizer(); final Node newNode = visitor.apply(node); final List maskNodesNew = @@ -65,7 +65,7 @@ void main() { '''); - final MaskingOptimizer visitor = MaskingOptimizer(); + final visitor = MaskingOptimizer(); final Node newNode = visitor.apply(node); final List maskNodesNew = @@ -89,7 +89,7 @@ void main() { '''); - final MaskingOptimizer visitor = MaskingOptimizer(); + final visitor = MaskingOptimizer(); final Node newNode = visitor.apply(node); final List maskNodesNew = @@ -108,7 +108,7 @@ void main() { '''); - final MaskingOptimizer visitor = MaskingOptimizer(); + final visitor = MaskingOptimizer(); final Node newNode = visitor.apply(node); final List maskNodesNew = queryChildren( @@ -124,7 +124,7 @@ void main() { ); final List parentNodesOld = queryChildren(node); - final MaskingOptimizer visitor = MaskingOptimizer(); + final visitor = MaskingOptimizer(); final Node newNode = visitor.apply(node); final List pathNodesNew = queryChildren( @@ -201,7 +201,7 @@ void main() { final VectorInstructions instructionsWithOptimizer = parse(blendAndMask); expect(instructionsWithOptimizer.paths, blendsAndMasksForMaskingOptimizer); - const LinearGradient gradient1 = LinearGradient( + const gradient1 = LinearGradient( id: 'url(#linearGradient-3)', from: Point(46.9782516, 60.9121966), to: Point(60.42279469999999, 90.6839734), @@ -210,7 +210,7 @@ void main() { tileMode: TileMode.clamp, unitMode: GradientUnitMode.transformed, ); - const LinearGradient gradient2 = LinearGradient( + const gradient2 = LinearGradient( id: 'url(#linearGradient-3)', from: Point(47.58260128, 58.72975728), to: Point(58.338235759999996, 82.54717871999999), diff --git a/packages/vector_graphics_compiler/test/matrix_test.dart b/packages/vector_graphics_compiler/test/matrix_test.dart index 7f8f6dd34f4..fd1822fff34 100644 --- a/packages/vector_graphics_compiler/test/matrix_test.dart +++ b/packages/vector_graphics_compiler/test/matrix_test.dart @@ -58,11 +58,11 @@ void main() { }); test('Multiply', () { - const AffineMatrix matrix1 = AffineMatrix(2, 2, 3, 4, 5, 6); - const AffineMatrix matrix2 = AffineMatrix(7, 8, 9, 10, 11, 12); + const matrix1 = AffineMatrix(2, 2, 3, 4, 5, 6); + const matrix2 = AffineMatrix(7, 8, 9, 10, 11, 12); - final Matrix4 matrix4_1 = Matrix4.fromFloat64List(matrix1.toMatrix4()); - final Matrix4 matrix4_2 = Matrix4.fromFloat64List(matrix2.toMatrix4()); + final matrix4_1 = Matrix4.fromFloat64List(matrix1.toMatrix4()); + final matrix4_2 = Matrix4.fromFloat64List(matrix2.toMatrix4()); expect( matrix1.multiplied(matrix2).toMatrix4(), matrix4_1.multiplied(matrix4_2).storage, @@ -70,9 +70,9 @@ void main() { }); test('Scale', () { - const AffineMatrix matrix1 = AffineMatrix(2, 2, 3, 4, 5, 6); + const matrix1 = AffineMatrix(2, 2, 3, 4, 5, 6); - final Matrix4 matrix4_1 = Matrix4.fromFloat64List(matrix1.toMatrix4()); + final matrix4_1 = Matrix4.fromFloat64List(matrix1.toMatrix4()); expect( matrix1.scaled(2, 3).toMatrix4(), matrix4_1.scaled(2.0, 3.0).storage, @@ -82,11 +82,11 @@ void main() { }); test('Scale and multiply', () { - const AffineMatrix matrix1 = AffineMatrix(2, 2, 3, 4, 5, 6); - const AffineMatrix matrix2 = AffineMatrix(7, 8, 9, 10, 11, 12); + const matrix1 = AffineMatrix(2, 2, 3, 4, 5, 6); + const matrix2 = AffineMatrix(7, 8, 9, 10, 11, 12); - final Matrix4 matrix4_1 = Matrix4.fromFloat64List(matrix1.toMatrix4()); - final Matrix4 matrix4_2 = Matrix4.fromFloat64List(matrix2.toMatrix4()); + final matrix4_1 = Matrix4.fromFloat64List(matrix1.toMatrix4()); + final matrix4_2 = Matrix4.fromFloat64List(matrix2.toMatrix4()); expect( matrix1.scaled(2, 3).multiplied(matrix2).toMatrix4(), matrix4_1.scaled(2.0, 3.0).multiplied(matrix4_2).storage, @@ -101,24 +101,24 @@ void main() { }); test('Translate', () { - const AffineMatrix matrix1 = AffineMatrix(2, 2, 3, 4, 5, 6); + const matrix1 = AffineMatrix(2, 2, 3, 4, 5, 6); - final Matrix4 matrix4_1 = Matrix4.fromFloat64List(matrix1.toMatrix4()); + final matrix4_1 = Matrix4.fromFloat64List(matrix1.toMatrix4()); matrix4_1.translate(2.0, 3.0); expect(matrix1.translated(2, 3).toMatrix4(), matrix4_1.storage); }); test('Rotate', () { - const AffineMatrix matrix1 = AffineMatrix(2, 2, 3, 4, 5, 6); + const matrix1 = AffineMatrix(2, 2, 3, 4, 5, 6); - final Matrix4 matrix4_1 = Matrix4.fromFloat64List(matrix1.toMatrix4()) + final matrix4_1 = Matrix4.fromFloat64List(matrix1.toMatrix4()) ..rotateZ(31.0); expect(matrix1.rotated(31).toMatrix4(), matrix4_1.storage); }); test('transformRect', () { - const double epsillon = .0000001; - const Rect rectangle20x20 = Rect.fromLTRB(10, 20, 30, 40); + const epsillon = .0000001; + const rectangle20x20 = Rect.fromLTRB(10, 20, 30, 40); // Identity expect(AffineMatrix.identity.transformRect(rectangle20x20), rectangle20x20); @@ -151,7 +151,7 @@ void main() { test('== and hashCode account for hidden field', () { const AffineMatrix matrixA = AffineMatrix.identity; - const AffineMatrix matrixB = AffineMatrix(1, 0, 0, 1, 0, 0, 0); + const matrixB = AffineMatrix(1, 0, 0, 1, 0, 0, 0); expect(matrixA != matrixB, true); expect(matrixA.hashCode != matrixB.hashCode, true); diff --git a/packages/vector_graphics_compiler/test/node_test.dart b/packages/vector_graphics_compiler/test/node_test.dart index a55306a12f3..a5515739f85 100644 --- a/packages/vector_graphics_compiler/test/node_test.dart +++ b/packages/vector_graphics_compiler/test/node_test.dart @@ -9,7 +9,7 @@ import 'package:vector_graphics_compiler/vector_graphics_compiler.dart'; void main() { test('TextPosition uses computed transform', () { - final TextPositionNode node = TextPositionNode( + final node = TextPositionNode( SvgAttributes.forTest( x: DoubleOrPercentage.fromString('5'), y: DoubleOrPercentage.fromString('3'), @@ -32,12 +32,12 @@ void main() { }); test('TextNode returns null for Paint if stroke and fill are missing', () { - final TextNode node = TextNode('text', SvgAttributes.empty); + final node = TextNode('text', SvgAttributes.empty); expect(node.computePaint(Rect.largest, AffineMatrix.identity), null); }); test('PathNode returns null for Paint if stroke and fill are missing', () { - final PathNode node = PathNode(Path(), SvgAttributes.empty); + final node = PathNode(Path(), SvgAttributes.empty); expect(node.computePaint(Rect.largest, AffineMatrix.identity), null); }); } diff --git a/packages/vector_graphics_compiler/test/overdraw_optimizer_test.dart b/packages/vector_graphics_compiler/test/overdraw_optimizer_test.dart index 87c521d4505..477f3c8d0e0 100644 --- a/packages/vector_graphics_compiler/test/overdraw_optimizer_test.dart +++ b/packages/vector_graphics_compiler/test/overdraw_optimizer_test.dart @@ -12,7 +12,7 @@ import 'test_svg_strings.dart'; Node parseAndResolve(String source) { final Node node = parseToNodeTree(source); - final ResolvingVisitor visitor = ResolvingVisitor(); + final visitor = ResolvingVisitor(); return node.accept(visitor, AffineMatrix.identity); } @@ -32,7 +32,7 @@ void main() { final List pathNodesOld = queryChildren(node); - final OverdrawOptimizer visitor = OverdrawOptimizer(); + final visitor = OverdrawOptimizer(); final Node newNode = visitor.apply(node); final List pathNodesNew = @@ -83,7 +83,7 @@ void main() { node, ); - final OverdrawOptimizer visitor = OverdrawOptimizer(); + final visitor = OverdrawOptimizer(); final Node newNode = visitor.apply(node); final List pathNodesNew = queryChildren( @@ -137,7 +137,7 @@ void main() { final Node node = parseAndResolve(opacityOverlap); final VectorInstructions instructions = parse(opacityOverlap); - final OverdrawOptimizer visitor = OverdrawOptimizer(); + final visitor = OverdrawOptimizer(); final Node newNode = visitor.apply(node); final List pathNodesNew = queryChildren( @@ -213,7 +213,7 @@ void main() { final Node node = parseAndResolve(solidOverTrasnparent); final VectorInstructions instructions = parse(solidOverTrasnparent); - final OverdrawOptimizer visitor = OverdrawOptimizer(); + final visitor = OverdrawOptimizer(); final Node newNode = visitor.apply(node); final List pathNodesNew = queryChildren( @@ -267,7 +267,7 @@ void main() { final Node node = parseAndResolve(transparentOverSolid); final VectorInstructions instructions = parse(transparentOverSolid); - final OverdrawOptimizer visitor = OverdrawOptimizer(); + final visitor = OverdrawOptimizer(); final Node newNode = visitor.apply(node); final List pathNodesNew = queryChildren( @@ -365,7 +365,7 @@ void main() { final Node node = parseAndResolve(complexOpacityTest); final VectorInstructions instructions = parse(complexOpacityTest); - final OverdrawOptimizer visitor = OverdrawOptimizer(); + final visitor = OverdrawOptimizer(); final Node newNode = visitor.apply(node); final List pathNodesNew = queryChildren( diff --git a/packages/vector_graphics_compiler/test/paint_test.dart b/packages/vector_graphics_compiler/test/paint_test.dart index 6e6758ad842..064a9e07527 100644 --- a/packages/vector_graphics_compiler/test/paint_test.dart +++ b/packages/vector_graphics_compiler/test/paint_test.dart @@ -17,14 +17,14 @@ void main() { const Color.fromARGB(25, 10, 15, 20), ); - const Color testColor = Color(0xFFABCDEF); + const testColor = Color(0xFFABCDEF); expect(testColor.r, 0xAB); expect(testColor.g, 0xCD); expect(testColor.b, 0xEF); }); test('LinearGradient can be converted to local coordinates', () { - const LinearGradient gradient = LinearGradient( + const gradient = LinearGradient( id: 'test', from: Point.zero, to: Point(1, 1), @@ -44,7 +44,7 @@ void main() { }); test('LinearGradient applied bounds with userSpaceOnUse', () { - const LinearGradient gradient = LinearGradient( + const gradient = LinearGradient( id: 'test', from: Point.zero, to: Point(1, 1), @@ -65,7 +65,7 @@ void main() { }); test('LinearGradient applied bounds with userSpaceOnUse and transformed', () { - final LinearGradient gradient = LinearGradient( + final gradient = LinearGradient( id: 'test', from: Point.zero, to: const Point(1, 1), @@ -86,7 +86,7 @@ void main() { }); test('RadialGradient can be converted to local coordinates', () { - const RadialGradient gradient = RadialGradient( + const gradient = RadialGradient( id: 'test', center: Point(0.5, 0.5), radius: 10, @@ -114,7 +114,7 @@ void main() { }); test('RadialGradient applied bounds with userSpaceOnUse', () { - const RadialGradient gradient = RadialGradient( + const gradient = RadialGradient( id: 'test', center: Point(0.5, 0.5), radius: 10, diff --git a/packages/vector_graphics_compiler/test/parser_test.dart b/packages/vector_graphics_compiler/test/parser_test.dart index 14369bebe75..61644f6351b 100644 --- a/packages/vector_graphics_compiler/test/parser_test.dart +++ b/packages/vector_graphics_compiler/test/parser_test.dart @@ -187,7 +187,7 @@ void main() { }); test('None on fill', () { - const String svg = ''' + const svg = ''' @@ -224,7 +224,7 @@ void main() { }); test('text spacing', () { - const String svg = ''' + const svg = ''' @@ -278,7 +278,7 @@ void main() { }); test('stroke-opacity', () { - const String strokeOpacitySvg = ''' + const strokeOpacitySvg = ''' @@ -295,7 +295,7 @@ void main() { }); test('preserve opacity from color mapper for strokes', () { - const String strokeOpacitySvg = ''' + const strokeOpacitySvg = ''' @@ -369,7 +369,7 @@ void main() { }); test('currentColor', () { - const String currentColorSvg = ''' + const currentColorSvg = ''' @@ -396,7 +396,7 @@ void main() { }); test('currentColor stoke opacity', () { - const String currentColorSvg = ''' + const currentColorSvg = ''' @@ -797,7 +797,7 @@ void main() { }); test('stroke-width with invalid value', () { - const String svg = + const svg = ''; final VectorInstructions instructions = parseWithoutOptimizers(svg); @@ -823,18 +823,18 @@ void main() { }); test('stroke-width with unit value', () { - const SvgTheme theme = SvgTheme(); + const theme = SvgTheme(); const double ptConversionFactor = 96 / 72; - const String svg_px = + const svg_px = ''; - const String svg_pt = + const svg_pt = ''; - const String svg_ex = + const svg_ex = ''; - const String svg_em = + const svg_em = ''; - const String svg_rem = + const svg_rem = ''; final VectorInstructions instructionsPx = parseWithoutOptimizers(svg_px); @@ -1111,7 +1111,7 @@ void main() { ); test('Opaque blend mode gets a save layer', () { - const String svg = ''' + const svg = ''' @@ -1140,7 +1140,7 @@ void main() { }); test('Stroke properties respected in toStroke', () { - const String svg = ''' + const svg = ''' @@ -1359,7 +1359,7 @@ void main() { }); test('Handles viewBox transformations correctly', () { - const String svg = ''' + const svg = ''' @@ -1374,7 +1374,7 @@ void main() { }); test('Parses rrects correctly', () { - const String svg = ''' + const svg = ''' @@ -1619,7 +1619,7 @@ void main() { }); test('Parses text with pattern as fill', () { - const String textWithPattern = ''' + const textWithPattern = ''' @@ -1658,7 +1658,7 @@ void main() { test('Defaults image height/width when not specified', () { // 1x1 PNG image from png-pixel.com. - const String svgStr = ''' + const svgStr = ''' '''; @@ -1676,7 +1676,7 @@ void main() { // 1x1 PNG image from png-pixel.com. Claiming that it's JPEG and using "img" // instead of "image" to make sure parser doesn't barf. Chrome is ok with // this kind of nonsense. How far we have strayed. - const String svgStr = ''' + const svgStr = ''' '''; @@ -3144,7 +3144,7 @@ void main() { }); test('Parse empty tag', () { - const String svgStr = ''' + const svgStr = ''' ', const SvgTheme(), @@ -157,7 +157,7 @@ void main() { }); test('Parses pattern units to double correctly', () { - final ViewportNode viewportNode = ViewportNode( + final viewportNode = ViewportNode( SvgAttributes.empty, width: 100, height: 1000, diff --git a/packages/vector_graphics_compiler/test/path_ops_test.dart b/packages/vector_graphics_compiler/test/path_ops_test.dart index ea480809083..71cdcf5240d 100644 --- a/packages/vector_graphics_compiler/test/path_ops_test.dart +++ b/packages/vector_graphics_compiler/test/path_ops_test.dart @@ -14,7 +14,7 @@ void main() { } }); test('Path tests', () { - final Path path = Path() + final path = Path() ..lineTo(10, 0) ..lineTo(10, 10) ..lineTo(0, 10) @@ -50,7 +50,7 @@ void main() { 50, ]); - final SvgPathProxy proxy = SvgPathProxy(); + final proxy = SvgPathProxy(); path.replay(proxy); expect( proxy.toString(), @@ -60,13 +60,13 @@ void main() { }); test('Ops test', () { - final Path cubics = Path() + final cubics = Path() ..moveTo(16, 128) ..cubicTo(16, 66, 66, 16, 128, 16) ..cubicTo(240, 66, 16, 66, 240, 128) ..close(); - final Path quad = Path() + final quad = Path() ..moveTo(55, 16) ..lineTo(200, 80) ..lineTo(198, 230) @@ -106,7 +106,7 @@ void main() { }); test('Quad', () { - final Path top = Path() + final top = Path() ..moveTo(87.998, 103.591) ..lineTo(82.72, 103.591) ..lineTo(82.72, 106.64999999999999) @@ -114,7 +114,7 @@ void main() { ..lineTo(87.998, 103.591) ..close(); - final Path bottom = Path() + final bottom = Path() ..moveTo(116.232, 154.452) ..lineTo(19.031999999999996, 154.452) ..cubicTo( diff --git a/packages/vector_graphics_compiler/test/path_test.dart b/packages/vector_graphics_compiler/test/path_test.dart index 1305b5106d0..eb9fef8daa8 100644 --- a/packages/vector_graphics_compiler/test/path_test.dart +++ b/packages/vector_graphics_compiler/test/path_test.dart @@ -55,7 +55,7 @@ void main() { }); test('addRect', () { - final PathBuilder builder = PathBuilder() + final builder = PathBuilder() ..addRect(const Rect.fromLTRB(10, 10, 20, 20)); expect( @@ -70,7 +70,7 @@ void main() { }); test('addOval', () { - final PathBuilder builder = PathBuilder() + final builder = PathBuilder() ..addOval(const Rect.fromLTRB(10, 10, 20, 20)) ..addOval(const Rect.fromLTRB(50, 50, 80, 70)); expect( @@ -92,7 +92,7 @@ void main() { }); test('addRRect', () { - final PathBuilder builder = PathBuilder() + final builder = PathBuilder() ..addRRect(const Rect.fromLTRB(20, 20, 60, 60), 5, 5); expect( builder.toPath().toFlutterString(), @@ -111,7 +111,7 @@ void main() { }); test('reset/no reset', () { - final PathBuilder builder = PathBuilder()..lineTo(10, 10); + final builder = PathBuilder()..lineTo(10, 10); final Path a = builder.toPath(reset: false); final Path b = builder.toPath(); @@ -124,11 +124,11 @@ void main() { }); test('PathBuilder.fromPath', () { - final PathBuilder builder = PathBuilder()..lineTo(10, 10); + final builder = PathBuilder()..lineTo(10, 10); final Path a = builder.toPath(); - final PathBuilder builderA = PathBuilder.fromPath(a); + final builderA = PathBuilder.fromPath(a); final Path b = builderA.toPath(); expect(a, b); @@ -209,7 +209,7 @@ void main() { }); test('Compute path bounds with rect', () { - final PathBuilder builder = PathBuilder() + final builder = PathBuilder() ..addRect(const Rect.fromLTWH(5, 5, 95, 95)) ..close(); final Path path = builder.toPath(); @@ -218,7 +218,7 @@ void main() { }); test('Compute path bounds with lines', () { - final PathBuilder builder = PathBuilder() + final builder = PathBuilder() ..moveTo(0, 0) ..lineTo(25, 0) ..lineTo(25, 25) @@ -230,7 +230,7 @@ void main() { }); test('Compute path bounds with cubics', () { - final PathBuilder builder = PathBuilder() + final builder = PathBuilder() ..moveTo(0, 0) ..cubicTo(10, 10, 20, 20, -10, -10) ..close(); @@ -240,14 +240,14 @@ void main() { }); test('Compute cubic bounds where R and B are negative', () { - const Rect circle = Rect.fromCircle(-83.533, -122.753, 74.461); + const circle = Rect.fromCircle(-83.533, -122.753, 74.461); final Path path = PathBuilder().addOval(circle).toPath(); expect(path.bounds(), circle); }); test('Cubic length', () { // Value is very close to what Skia says for same input. - const CubicToCommand command = CubicToCommand( + const command = CubicToCommand( 1.0, 15.327, 15.326, @@ -258,7 +258,7 @@ void main() { expect(command.computeLength(Point.zero), 38.16245134493276); // Trivially describes a line. - const CubicToCommand command2 = CubicToCommand(0, 0, 0, 10, 0, 10); + const command2 = CubicToCommand(0, 0, 0, 10, 0, 10); expect(command2.computeLength(Point.zero), 10); }); diff --git a/packages/vector_graphics_compiler/test/resolver_test.dart b/packages/vector_graphics_compiler/test/resolver_test.dart index ca332424565..a203eb46f15 100644 --- a/packages/vector_graphics_compiler/test/resolver_test.dart +++ b/packages/vector_graphics_compiler/test/resolver_test.dart @@ -138,18 +138,18 @@ void main() { }); test('visitChildren on clips and masks', () { - final ResolvedClipNode clip = ResolvedClipNode( + final clip = ResolvedClipNode( clips: [], child: Node.empty, ); - final ResolvedMaskNode mask = ResolvedMaskNode( + final mask = ResolvedMaskNode( child: Node.empty, mask: Node.empty, blendMode: BlendMode.color, ); - int visitCount = 0; + var visitCount = 0; clip.visitChildren((Node child) { visitCount += 1; expect(child, Node.empty); diff --git a/packages/vector_graphics_compiler/test/theme_test.dart b/packages/vector_graphics_compiler/test/theme_test.dart index 8f51b68b307..576a330cf14 100644 --- a/packages/vector_graphics_compiler/test/theme_test.dart +++ b/packages/vector_graphics_compiler/test/theme_test.dart @@ -12,7 +12,7 @@ void main() { group('SvgTheme', () { group('constructor', () { test('sets currentColor', () { - const Color currentColor = Color(0xFFB0E3BE); + const currentColor = Color(0xFFB0E3BE); expect( SvgTheme(currentColor: currentColor).currentColor, @@ -21,7 +21,7 @@ void main() { }); test('sets fontSize', () { - const double fontSize = 14.0; + const fontSize = 14.0; expect( SvgTheme(currentColor: Color(0xFFB0E3BE)).fontSize, @@ -35,7 +35,7 @@ void main() { }); test('sets xHeight', () { - const double xHeight = 8.0; + const xHeight = 8.0; expect( SvgTheme(fontSize: 26.0, xHeight: xHeight).xHeight, @@ -45,7 +45,7 @@ void main() { test('sets xHeight as fontSize divided by 2 ' 'by default', () { - const double fontSize = 16.0; + const fontSize = 16.0; expect(SvgTheme(fontSize: fontSize).xHeight, equals(fontSize / 2)); }); diff --git a/packages/vector_graphics_compiler/test/util_test.dart b/packages/vector_graphics_compiler/test/util_test.dart index 17173280783..46eb7aafca1 100644 --- a/packages/vector_graphics_compiler/test/util_test.dart +++ b/packages/vector_graphics_compiler/test/util_test.dart @@ -7,10 +7,10 @@ import 'package:vector_graphics_compiler/src/util.dart'; void main() { test('listEquals', () { - final List listA = [1, 2, 3]; - final List listB = [1, 2, 3]; - final List listC = [1, 2]; - final List listD = [3, 2, 1]; + final listA = [1, 2, 3]; + final listB = [1, 2, 3]; + final listC = [1, 2]; + final listD = [3, 2, 1]; expect(listEquals(null, null), isTrue); expect(listEquals(listA, null), isFalse); diff --git a/packages/vector_graphics_compiler/test/vertices_test.dart b/packages/vector_graphics_compiler/test/vertices_test.dart index 7843388a6e4..6fa3ad070d3 100644 --- a/packages/vector_graphics_compiler/test/vertices_test.dart +++ b/packages/vector_graphics_compiler/test/vertices_test.dart @@ -9,7 +9,7 @@ import 'package:vector_graphics_compiler/vector_graphics_compiler.dart'; void main() { test('Vertices.fromFloat32List', () { - final Vertices vertices = Vertices.fromFloat32List( + final vertices = Vertices.fromFloat32List( Float32List.fromList([1, 2, 3, 4, 5, 6]), ); @@ -26,7 +26,7 @@ void main() { }); test('IndexedVertices - creates valid index', () { - final Vertices vertices = Vertices.fromFloat32List( + final vertices = Vertices.fromFloat32List( Float32List.fromList([ 1, 1, @@ -76,7 +76,7 @@ void main() { }); test('IndexedVertices - does not index if index is larger', () { - final Float32List original = Float32List.fromList([ + final original = Float32List.fromList([ 1, 1, 2, @@ -96,7 +96,7 @@ void main() { 4, 5, ]); - final Vertices vertices = Vertices.fromFloat32List(original); + final vertices = Vertices.fromFloat32List(original); final IndexedVertices indexedVertices = vertices.createIndex(); expect(indexedVertices.vertices, original); diff --git a/packages/video_player/video_player/example/integration_test/controller_swap_test.dart b/packages/video_player/video_player/example/integration_test/controller_swap_test.dart index dc0f43681b2..ff98ed99ad3 100644 --- a/packages/video_player/video_player/example/integration_test/controller_swap_test.dart +++ b/packages/video_player/video_player/example/integration_test/controller_swap_test.dart @@ -18,14 +18,14 @@ void main() { 'can substitute one controller by another without crashing', (WidgetTester tester) async { // Use WebM for web to allow CI to use Chromium. - const String videoAssetKey = kIsWeb + const videoAssetKey = kIsWeb ? 'assets/Butterfly-209.webm' : 'assets/Butterfly-209.mp4'; - final VideoPlayerController controller = VideoPlayerController.asset( + final controller = VideoPlayerController.asset( videoAssetKey, ); - final VideoPlayerController another = VideoPlayerController.asset( + final another = VideoPlayerController.asset( videoAssetKey, ); await controller.initialize(); @@ -33,8 +33,8 @@ void main() { await controller.setVolume(0); await another.setVolume(0); - final Completer started = Completer(); - final Completer ended = Completer(); + final started = Completer(); + final ended = Completer(); another.addListener(() { if (another.value.isBuffering && !started.isCompleted) { diff --git a/packages/video_player/video_player/example/integration_test/video_player_test.dart b/packages/video_player/video_player/example/integration_test/video_player_test.dart index c4e46c1cb67..9a6f7a90c92 100644 --- a/packages/video_player/video_player/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player/example/integration_test/video_player_test.dart @@ -57,8 +57,7 @@ void main() { }); testWidgets('live stream duration != 0', (WidgetTester tester) async { - final VideoPlayerController - networkController = VideoPlayerController.networkUrl( + final networkController = VideoPlayerController.networkUrl( Uri.parse( 'https://flutter.github.io/assets-for-api-docs/assets/videos/hls/bee.m3u8', ), @@ -199,7 +198,7 @@ void main() { testWidgets( 'test video player view with local asset', (WidgetTester tester) async { - final Completer loaded = Completer(); + final loaded = Completer(); Future started() async { await controller.initialize(); await controller.play(); @@ -248,7 +247,7 @@ void main() { // Write it to a file to use as a source. final String filename = _videoAssetKey.split('/').last; - final File file = File('$tempDir/$filename'); + final file = File('$tempDir/$filename'); await file.writeAsBytes(bytes.buffer.asInt8List()); controller = VideoPlayerController.file(file); @@ -281,8 +280,8 @@ void main() { // Mute to allow playing without DOM interaction on Web. // See https://developers.google.com/web/updates/2017/09/autoplay-policy-changes await controller.setVolume(0); - final Completer started = Completer(); - final Completer ended = Completer(); + final started = Completer(); + final ended = Completer(); controller.addListener(() { if (!started.isCompleted && controller.value.isBuffering) { started.complete(); diff --git a/packages/video_player/video_player/lib/src/sub_rip.dart b/packages/video_player/video_player/lib/src/sub_rip.dart index 991026fd6e0..a516cd2e5df 100644 --- a/packages/video_player/video_player/lib/src/sub_rip.dart +++ b/packages/video_player/video_player/lib/src/sub_rip.dart @@ -27,7 +27,7 @@ class SubRipCaptionFile extends ClosedCaptionFile { } List _parseCaptionsFromSubRipString(String file) { - final List captions = []; + final captions = []; for (final List captionLines in _readSubRipFile(file)) { if (captionLines.length < 3) { break; @@ -40,7 +40,7 @@ List _parseCaptionsFromSubRipString(String file) { final String text = captionLines.sublist(2).join('\n'); - final Caption newCaption = Caption( + final newCaption = Caption( number: captionNumber, start: captionRange.start, end: captionRange.end, @@ -64,7 +64,7 @@ class _CaptionRange { // For example: // 00:01:54,724 --> 00:01:56,760 static _CaptionRange fromSubRipString(String line) { - final RegExp format = RegExp( + final format = RegExp( _subRipTimeStamp + _subRipArrow + _subRipTimeStamp, ); @@ -113,10 +113,10 @@ Duration _parseSubRipTimestamp(String timestampString) { List> _readSubRipFile(String file) { final List lines = LineSplitter.split(file).toList(); - final List> captionStrings = >[]; - List currentCaption = []; - int lineIndex = 0; - for (final String line in lines) { + final captionStrings = >[]; + var currentCaption = []; + var lineIndex = 0; + for (final line in lines) { final bool isLineBlank = line.trim().isEmpty; if (!isLineBlank) { currentCaption.add(line); diff --git a/packages/video_player/video_player/lib/src/web_vtt.dart b/packages/video_player/video_player/lib/src/web_vtt.dart index a46b602c227..9f4153e5b77 100644 --- a/packages/video_player/video_player/lib/src/web_vtt.dart +++ b/packages/video_player/video_player/lib/src/web_vtt.dart @@ -25,12 +25,12 @@ class WebVTTCaptionFile extends ClosedCaptionFile { } List _parseCaptionsFromWebVTTString(String file) { - final List captions = []; + final captions = []; // Ignore metadata - final Set metadata = {'HEADER', 'NOTE', 'REGION', 'WEBVTT'}; + final metadata = {'HEADER', 'NOTE', 'REGION', 'WEBVTT'}; - int captionNumber = 1; + var captionNumber = 1; for (final List captionLines in _readWebVTTFile(file)) { // CaptionLines represent a complete caption. // E.g @@ -73,7 +73,7 @@ List _parseCaptionsFromWebVTTString(String file) { // https://github.com/flutter/flutter/issues/90007. final String textWithoutFormat = _extractTextFromHtml(text); - final Caption newCaption = Caption( + final newCaption = Caption( number: captionNumber, start: captionRange.start, end: captionRange.end, @@ -96,7 +96,7 @@ class _CaptionRange { // For example: // 00:09.000 --> 00:11.000 static _CaptionRange? fromWebVTTString(String line) { - final RegExp format = RegExp( + final format = RegExp( _webVTTTimeStamp + _webVTTArrow + _webVTTTimeStamp, ); @@ -150,7 +150,7 @@ Duration? _parseWebVTTTimestamp(String timestampString) { if (timeComponents.length > 3 || timeComponents.length < 2) { return null; } - int hours = 0; + var hours = 0; if (timeComponents.length == 3) { final String hourString = timeComponents.removeAt(0); if (hourString.length < 2) { @@ -193,10 +193,10 @@ Duration? _parseWebVTTTimestamp(String timestampString) { List> _readWebVTTFile(String file) { final List lines = LineSplitter.split(file).toList(); - final List> captionStrings = >[]; - List currentCaption = []; - int lineIndex = 0; - for (final String line in lines) { + final captionStrings = >[]; + var currentCaption = []; + var lineIndex = 0; + for (final line in lines) { final bool isLineBlank = line.trim().isEmpty; if (!isLineBlank) { currentCaption.add(line); diff --git a/packages/video_player/video_player/lib/video_player.dart b/packages/video_player/video_player/lib/video_player.dart index 70460a96b5b..f0589cb4686 100644 --- a/packages/video_player/video_player/lib/video_player.dart +++ b/packages/video_player/video_player/lib/video_player.dart @@ -458,7 +458,7 @@ class VideoPlayerController extends ValueNotifier { ); } - final VideoCreationOptions creationOptions = VideoCreationOptions( + final creationOptions = VideoCreationOptions( dataSource: dataSourceDescription, viewType: viewType, ); @@ -473,7 +473,7 @@ class VideoPlayerController extends ValueNotifier { (await _videoPlayerPlatform.createWithOptions(creationOptions)) ?? kUninitializedPlayerId; _creatingCompleter!.complete(null); - final Completer initializingCompleter = Completer(); + final initializingCompleter = Completer(); // Apply the web-specific options if (kIsWeb && videoPlayerOptions?.webOptions != null) { @@ -544,7 +544,7 @@ class VideoPlayerController extends ValueNotifier { } void errorListener(Object obj) { - final PlatformException e = obj as PlatformException; + final e = obj as PlatformException; value = VideoPlayerValue.erroneous(e.message!); _timer?.cancel(); if (!initializingCompleter.isCompleted) { @@ -995,7 +995,7 @@ class _VideoScrubberState extends State { @override Widget build(BuildContext context) { void seekToRelativePosition(Offset globalPosition) { - final RenderBox box = context.findRenderObject()! as RenderBox; + final box = context.findRenderObject()! as RenderBox; final Offset tapPos = box.globalToLocal(globalPosition); final double relative = tapPos.dx / box.size.width; final Duration position = controller.value.duration * relative; diff --git a/packages/video_player/video_player/test/closed_caption_file_test.dart b/packages/video_player/video_player/test/closed_caption_file_test.dart index 990f9eacea9..be8aaa479de 100644 --- a/packages/video_player/video_player/test/closed_caption_file_test.dart +++ b/packages/video_player/video_player/test/closed_caption_file_test.dart @@ -8,7 +8,7 @@ import 'package:video_player/src/closed_caption_file.dart'; void main() { group('ClosedCaptionFile', () { test('toString()', () { - const Caption caption = Caption( + const caption = Caption( number: 1, start: Duration(seconds: 1), end: Duration(seconds: 2), diff --git a/packages/video_player/video_player/test/sub_rip_file_test.dart b/packages/video_player/video_player/test/sub_rip_file_test.dart index 84b5f6978c4..7414c9de10e 100644 --- a/packages/video_player/video_player/test/sub_rip_file_test.dart +++ b/packages/video_player/video_player/test/sub_rip_file_test.dart @@ -8,7 +8,7 @@ import 'package:video_player/video_player.dart'; void main() { test('Parses SubRip file', () { - final SubRipCaptionFile parsedFile = SubRipCaptionFile(_validSubRip); + final parsedFile = SubRipCaptionFile(_validSubRip); expect(parsedFile.captions.length, 4); diff --git a/packages/video_player/video_player/test/video_player_initialization_test.dart b/packages/video_player/video_player/test/video_player_initialization_test.dart index 0a71d1c6425..aca78701786 100644 --- a/packages/video_player/video_player/test/video_player_initialization_test.dart +++ b/packages/video_player/video_player/test/video_player_initialization_test.dart @@ -20,7 +20,7 @@ void main() { }); test('plugin initialized', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( Uri.parse('https://127.0.0.1'), ); await controller.initialize(); @@ -28,13 +28,13 @@ void main() { }); test('web configuration is applied (web only)', () async { - const VideoPlayerWebOptions expected = VideoPlayerWebOptions( + const expected = VideoPlayerWebOptions( allowContextMenu: false, allowRemotePlayback: false, controls: VideoPlayerWebOptionsControls.enabled(), ); - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( Uri.parse('https://127.0.0.1'), videoPlayerOptions: VideoPlayerOptions(webOptions: expected), ); @@ -59,7 +59,7 @@ void main() { test('video view type is applied', () async { const VideoViewType expected = VideoViewType.platformView; - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( Uri.parse('https://127.0.0.1'), viewType: expected, ); diff --git a/packages/video_player/video_player/test/video_player_test.dart b/packages/video_player/video_player/test/video_player_test.dart index 2e5324fa050..d43b02a188c 100644 --- a/packages/video_player/video_player/test/video_player_test.dart +++ b/packages/video_player/video_player/test/video_player_test.dart @@ -133,7 +133,7 @@ void main() { } testWidgets('update texture', (WidgetTester tester) async { - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); await tester.pumpWidget(VideoPlayer(controller)); expect(find.byType(Texture), findsNothing); @@ -149,7 +149,7 @@ void main() { }); testWidgets('update controller', (WidgetTester tester) async { - final FakeController controller1 = FakeController(); + final controller1 = FakeController(); addTearDown(controller1.dispose); controller1.playerId = 101; await tester.pumpWidget(VideoPlayer(controller1)); @@ -160,7 +160,7 @@ void main() { findsOneWidget, ); - final FakeController controller2 = FakeController(); + final controller2 = FakeController(); addTearDown(controller2.dispose); controller2.playerId = 102; await tester.pumpWidget(VideoPlayer(controller2)); @@ -175,7 +175,7 @@ void main() { testWidgets( 'VideoPlayer still listens for controller changes when reparented', (WidgetTester tester) async { - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); final GlobalKey videoKey = GlobalKey(); final Widget videoPlayer = KeyedSubtree( @@ -208,7 +208,7 @@ void main() { testWidgets( 'VideoProgressIndicator still listens for controller changes after reparenting', (WidgetTester tester) async { - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); final GlobalKey key = GlobalKey(); final Widget progressIndicator = VideoProgressIndicator( @@ -239,7 +239,7 @@ void main() { testWidgets('VideoPlayer does not crash after loading 0-duration videos', ( WidgetTester tester, ) async { - final FakeController controller = FakeController(); + final controller = FakeController(); addTearDown(controller.dispose); controller.value = controller.value.copyWith( duration: Duration.zero, @@ -256,13 +256,13 @@ void main() { testWidgets('non-zero rotationCorrection value is used', ( WidgetTester tester, ) async { - final FakeController controller = FakeController.value( + final controller = FakeController.value( const VideoPlayerValue(duration: Duration.zero, rotationCorrection: 180), ); addTearDown(controller.dispose); controller.playerId = 1; await tester.pumpWidget(VideoPlayer(controller)); - final RotatedBox actualRotationCorrection = + final actualRotationCorrection = find.byType(RotatedBox).evaluate().single.widget as RotatedBox; final int actualQuarterTurns = actualRotationCorrection.quarterTurns; expect(actualQuarterTurns, equals(2)); @@ -271,7 +271,7 @@ void main() { testWidgets('no RotatedBox when rotationCorrection is zero', ( WidgetTester tester, ) async { - final FakeController controller = FakeController.value( + final controller = FakeController.value( const VideoPlayerValue(duration: Duration.zero), ); addTearDown(controller.dispose); @@ -282,7 +282,7 @@ void main() { group('ClosedCaption widget', () { testWidgets('uses a default text style', (WidgetTester tester) async { - const String text = 'foo'; + const text = 'foo'; await tester.pumpWidget( const MaterialApp(home: ClosedCaption(text: text)), ); @@ -293,8 +293,8 @@ void main() { }); testWidgets('uses given text and style', (WidgetTester tester) async { - const String text = 'foo'; - const TextStyle textStyle = TextStyle(fontSize: 14.725); + const text = 'foo'; + const textStyle = TextStyle(fontSize: 14.725); await tester.pumpWidget( const MaterialApp( home: ClosedCaption(text: text, textStyle: textStyle), @@ -319,7 +319,7 @@ void main() { testWidgets('Passes text contrast ratio guidelines', ( WidgetTester tester, ) async { - const String text = 'foo'; + const text = 'foo'; await tester.pumpWidget( const MaterialApp( home: Scaffold( @@ -337,7 +337,7 @@ void main() { group('VideoPlayerController', () { group('legacy initialize', () { test('network', () async { - final VideoPlayerController controller = VideoPlayerController.network( + final controller = VideoPlayerController.network( 'https://127.0.0.1', ); await controller.initialize(); @@ -351,7 +351,7 @@ void main() { }); test('network with hint', () async { - final VideoPlayerController controller = VideoPlayerController.network( + final controller = VideoPlayerController.network( 'https://127.0.0.1', formatHint: VideoFormat.dash, ); @@ -369,7 +369,7 @@ void main() { }); test('network with some headers', () async { - final VideoPlayerController controller = VideoPlayerController.network( + final controller = VideoPlayerController.network( 'https://127.0.0.1', httpHeaders: {'Authorization': 'Bearer token'}, ); @@ -386,7 +386,7 @@ void main() { group('initialize', () { test('started app lifecycle observing', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(Uri.parse('https://127.0.0.1')); addTearDown(controller.dispose); await controller.initialize(); @@ -398,7 +398,7 @@ void main() { }); test('asset', () async { - final VideoPlayerController controller = VideoPlayerController.asset( + final controller = VideoPlayerController.asset( 'a.avi', ); await controller.initialize(); @@ -408,7 +408,7 @@ void main() { }); test('network url', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(Uri.parse('https://127.0.0.1')); addTearDown(controller.dispose); await controller.initialize(); @@ -422,7 +422,7 @@ void main() { }); test('network url with hint', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl( Uri.parse('https://127.0.0.1'), formatHint: VideoFormat.dash, @@ -442,7 +442,7 @@ void main() { }); test('network url with some headers', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl( Uri.parse('https://127.0.0.1'), httpHeaders: {'Authorization': 'Bearer token'}, @@ -463,20 +463,20 @@ void main() { () async { final Uri invalidUrl = Uri.parse('http://testing.com/invalid_url'); - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(invalidUrl); addTearDown(controller.dispose); late Object error; fakeVideoPlayerPlatform.forceInitError = true; await controller.initialize().catchError((Object e) => error = e); - final PlatformException platformEx = error as PlatformException; + final platformEx = error as PlatformException; expect(platformEx.code, equals('VideoError')); }, ); test('file', () async { - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File('a.avi'), ); await controller.initialize(); @@ -489,7 +489,7 @@ void main() { test( 'file with special characters', () async { - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File('A #1 Hit.avi'), ); await controller.initialize(); @@ -512,7 +512,7 @@ void main() { test( 'file with headers (m3u8)', () async { - final VideoPlayerController controller = VideoPlayerController.file( + final controller = VideoPlayerController.file( File('a.avi'), httpHeaders: {'Authorization': 'Bearer token'}, ); @@ -537,7 +537,7 @@ void main() { test( 'successful initialize on controller with error clears error', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.network('https://127.0.0.1'); fakeVideoPlayerPlatform.forceInitError = true; await controller.initialize().catchError((dynamic e) {}); @@ -551,7 +551,7 @@ void main() { test( 'given controller with error when initialization succeeds it should clear error', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); addTearDown(controller.dispose); @@ -566,7 +566,7 @@ void main() { }); test('contentUri', () async { - final VideoPlayerController controller = VideoPlayerController.contentUri( + final controller = VideoPlayerController.contentUri( Uri.parse('content://video'), ); await controller.initialize(); @@ -575,7 +575,7 @@ void main() { }); test('dispose', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, ); addTearDown(controller.dispose); @@ -591,7 +591,7 @@ void main() { }); test('calling dispose() on disposed controller does not throw', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, ); addTearDown(controller.dispose); @@ -603,7 +603,7 @@ void main() { }); test('play', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( Uri.parse('https://127.0.0.1'), ); addTearDown(controller.dispose); @@ -624,7 +624,7 @@ void main() { }); test('play before initialized does not call platform', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, ); addTearDown(controller.dispose); @@ -637,13 +637,13 @@ void main() { }); test('play restarts from beginning if video is at end', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, ); addTearDown(controller.dispose); await controller.initialize(); - const Duration nonzeroDuration = Duration(milliseconds: 100); + const nonzeroDuration = Duration(milliseconds: 100); controller.value = controller.value.copyWith(duration: nonzeroDuration); await controller.seekTo(nonzeroDuration); expect(controller.value.isPlaying, isFalse); @@ -656,7 +656,7 @@ void main() { }); test('setLooping', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, ); addTearDown(controller.dispose); @@ -669,7 +669,7 @@ void main() { }); test('pause', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, ); addTearDown(controller.dispose); @@ -686,7 +686,7 @@ void main() { group('seekTo', () { test('works', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); addTearDown(controller.dispose); @@ -699,7 +699,7 @@ void main() { }); test('before initialized does not call platform', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); addTearDown(controller.dispose); @@ -711,7 +711,7 @@ void main() { }); test('clamps values that are too high or low', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); addTearDown(controller.dispose); @@ -728,21 +728,21 @@ void main() { group('setVolume', () { test('works', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); addTearDown(controller.dispose); await controller.initialize(); expect(controller.value.volume, 1.0); - const double volume = 0.5; + const volume = 0.5; await controller.setVolume(volume); expect(controller.value.volume, volume); }); test('clamps values that are too high or low', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); addTearDown(controller.dispose); @@ -759,21 +759,21 @@ void main() { group('setPlaybackSpeed', () { test('works', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); addTearDown(controller.dispose); await controller.initialize(); expect(controller.value.playbackSpeed, 1.0); - const double speed = 1.5; + const speed = 1.5; await controller.setPlaybackSpeed(speed); expect(controller.value.playbackSpeed, speed); }); test('rejects negative values', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); addTearDown(controller.dispose); @@ -788,11 +788,11 @@ void main() { testWidgets('restarts on release if already playing', ( WidgetTester tester, ) async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); await controller.initialize(); - final VideoProgressIndicator progressWidget = VideoProgressIndicator( + final progressWidget = VideoProgressIndicator( controller, allowScrubbing: true, ); @@ -821,11 +821,11 @@ void main() { testWidgets('does not restart when dragging to end', ( WidgetTester tester, ) async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); await controller.initialize(); - final VideoProgressIndicator progressWidget = VideoProgressIndicator( + final progressWidget = VideoProgressIndicator( controller, allowScrubbing: true, ); @@ -852,7 +852,7 @@ void main() { group('caption', () { test('works when position updates', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl( _localhostUri, closedCaptionFile: _loadClosedCaption(), @@ -862,7 +862,7 @@ void main() { await controller.play(); // Optionally record caption changes for later verification. - final Map recordedCaptions = {}; + final recordedCaptions = {}; controller.addListener(() { // Record the caption for the current position (in milliseconds). @@ -870,11 +870,11 @@ void main() { recordedCaptions[ms] = controller.value.caption.text; }); - const Duration updateInterval = Duration(milliseconds: 100); - const int totalDurationMs = 350; + const updateInterval = Duration(milliseconds: 100); + const totalDurationMs = 350; // Simulate continuous playback by incrementing in 50ms steps. - for (int ms = 0; ms <= totalDurationMs; ms += 50) { + for (var ms = 0; ms <= totalDurationMs; ms += 50) { fakeVideoPlayerPlatform._positions[controller.playerId] = Duration( milliseconds: ms, ); @@ -892,7 +892,7 @@ void main() { }); test('works when seeking', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl( _localhostUri, closedCaptionFile: _loadClosedCaption(), @@ -926,7 +926,7 @@ void main() { }); test('works when seeking with captionOffset positive', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl( _localhostUri, closedCaptionFile: _loadClosedCaption(), @@ -964,7 +964,7 @@ void main() { }); test('works when seeking with captionOffset negative', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl( _localhostUri, closedCaptionFile: _loadClosedCaption(), @@ -1005,7 +1005,7 @@ void main() { }); test('setClosedCaptionFile loads caption file', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); addTearDown(controller.dispose); @@ -1020,7 +1020,7 @@ void main() { }); test('setClosedCaptionFile removes/changes caption file', () async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl( _localhostUri, closedCaptionFile: _loadClosedCaption(), @@ -1040,11 +1040,11 @@ void main() { group('Platform callbacks', () { testWidgets('playing completed', (WidgetTester tester) async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); await controller.initialize(); - const Duration nonzeroDuration = Duration(milliseconds: 100); + const nonzeroDuration = Duration(milliseconds: 100); controller.value = controller.value.copyWith(duration: nonzeroDuration); expect(controller.value.isPlaying, isFalse); await controller.play(); @@ -1063,7 +1063,7 @@ void main() { }); testWidgets('playback status', (WidgetTester tester) async { - final VideoPlayerController controller = VideoPlayerController.network( + final controller = VideoPlayerController.network( 'https://.0.0.1', ); await controller.initialize(); @@ -1092,7 +1092,7 @@ void main() { }); testWidgets('buffering status', (WidgetTester tester) async { - final VideoPlayerController controller = + final controller = VideoPlayerController.networkUrl(_localhostUri); await controller.initialize(); @@ -1108,7 +1108,7 @@ void main() { expect(controller.value.isBuffering, isTrue); const Duration bufferStart = Duration.zero; - const Duration bufferEnd = Duration(milliseconds: 500); + const bufferEnd = Duration(milliseconds: 500); fakeVideoEventStream.add( VideoEvent( eventType: VideoEventType.bufferingUpdate, @@ -1134,17 +1134,17 @@ void main() { }); test('updates position', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, videoPlayerOptions: VideoPlayerOptions(), ); await controller.initialize(); - const Duration updatesInterval = Duration(milliseconds: 100); + const updatesInterval = Duration(milliseconds: 100); - final List positions = []; - final Completer intervalUpdateCompleter = Completer(); + final positions = []; + final intervalUpdateCompleter = Completer(); // Listen for position updates controller.addListener(() { @@ -1154,7 +1154,7 @@ void main() { } }); await controller.play(); - for (int i = 0; i < 3; i++) { + for (var i = 0; i < 3; i++) { await Future.delayed(updatesInterval); fakeVideoPlayerPlatform._positions[controller.playerId] = Duration( milliseconds: i * updatesInterval.inMilliseconds, @@ -1171,10 +1171,10 @@ void main() { group('DurationRange', () { test('uses given values', () { - const Duration start = Duration(seconds: 2); - const Duration end = Duration(seconds: 8); + const start = Duration(seconds: 2); + const end = Duration(seconds: 8); - final DurationRange range = DurationRange(start, end); + final range = DurationRange(start, end); expect(range.start, start); expect(range.end, end); @@ -1182,11 +1182,11 @@ void main() { }); test('calculates fractions', () { - const Duration start = Duration(seconds: 2); - const Duration end = Duration(seconds: 8); - const Duration total = Duration(seconds: 10); + const start = Duration(seconds: 2); + const end = Duration(seconds: 8); + const total = Duration(seconds: 10); - final DurationRange range = DurationRange(start, end); + final range = DurationRange(start, end); expect(range.startFraction(total), .2); expect(range.endFraction(total), .8); @@ -1195,7 +1195,7 @@ void main() { group('VideoPlayerValue', () { test('uninitialized()', () { - const VideoPlayerValue uninitialized = VideoPlayerValue.uninitialized(); + const uninitialized = VideoPlayerValue.uninitialized(); expect(uninitialized.duration, equals(Duration.zero)); expect(uninitialized.position, equals(Duration.zero)); @@ -1215,8 +1215,8 @@ void main() { }); test('erroneous()', () { - const String errorMessage = 'foo'; - const VideoPlayerValue error = VideoPlayerValue.erroneous(errorMessage); + const errorMessage = 'foo'; + const error = VideoPlayerValue.erroneous(errorMessage); expect(error.duration, equals(Duration.zero)); expect(error.position, equals(Duration.zero)); @@ -1236,27 +1236,27 @@ void main() { }); test('toString()', () { - const Duration duration = Duration(seconds: 5); - const Size size = Size(400, 300); - const Duration position = Duration(seconds: 1); - const Caption caption = Caption( + const duration = Duration(seconds: 5); + const size = Size(400, 300); + const position = Duration(seconds: 1); + const caption = Caption( text: 'foo', number: 0, start: Duration.zero, end: Duration.zero, ); - const Duration captionOffset = Duration(milliseconds: 250); - final List buffered = [ + const captionOffset = Duration(milliseconds: 250); + final buffered = [ DurationRange(Duration.zero, const Duration(seconds: 4)), ]; - const bool isInitialized = true; - const bool isPlaying = true; - const bool isLooping = true; - const bool isBuffering = true; - const double volume = 0.5; - const double playbackSpeed = 1.5; - - final VideoPlayerValue value = VideoPlayerValue( + const isInitialized = true; + const isPlaying = true; + const isLooping = true; + const isBuffering = true; + const volume = 0.5; + const playbackSpeed = 1.5; + + final value = VideoPlayerValue( duration: duration, size: size, position: position, @@ -1292,19 +1292,19 @@ void main() { group('copyWith()', () { test('exact copy', () { - const VideoPlayerValue original = VideoPlayerValue.uninitialized(); + const original = VideoPlayerValue.uninitialized(); final VideoPlayerValue exactCopy = original.copyWith(); expect(exactCopy.toString(), original.toString()); }); test('errorDescription is not persisted when copy with null', () { - const VideoPlayerValue original = VideoPlayerValue.erroneous('error'); + const original = VideoPlayerValue.erroneous('error'); final VideoPlayerValue copy = original.copyWith(errorDescription: null); expect(copy.errorDescription, null); }); test('errorDescription is changed when copy with another error', () { - const VideoPlayerValue original = VideoPlayerValue.erroneous('error'); + const original = VideoPlayerValue.erroneous('error'); final VideoPlayerValue copy = original.copyWith( errorDescription: 'new error', ); @@ -1312,7 +1312,7 @@ void main() { expect(copy.errorDescription, 'new error'); }); test('errorDescription is changed when copy with error', () { - const VideoPlayerValue original = VideoPlayerValue.uninitialized(); + const original = VideoPlayerValue.uninitialized(); final VideoPlayerValue copy = original.copyWith( errorDescription: 'new error', ); @@ -1323,7 +1323,7 @@ void main() { group('aspectRatio', () { test('640x480 -> 4:3', () { - const VideoPlayerValue value = VideoPlayerValue( + const value = VideoPlayerValue( isInitialized: true, size: Size(640, 480), duration: Duration(seconds: 1), @@ -1332,7 +1332,7 @@ void main() { }); test('no size -> 1.0', () { - const VideoPlayerValue value = VideoPlayerValue( + const value = VideoPlayerValue( isInitialized: true, duration: Duration(seconds: 1), ); @@ -1340,7 +1340,7 @@ void main() { }); test('height = 0 -> 1.0', () { - const VideoPlayerValue value = VideoPlayerValue( + const value = VideoPlayerValue( isInitialized: true, size: Size(640, 0), duration: Duration(seconds: 1), @@ -1349,7 +1349,7 @@ void main() { }); test('width = 0 -> 1.0', () { - const VideoPlayerValue value = VideoPlayerValue( + const value = VideoPlayerValue( isInitialized: true, size: Size(0, 480), duration: Duration(seconds: 1), @@ -1358,7 +1358,7 @@ void main() { }); test('negative aspect ratio -> 1.0', () { - const VideoPlayerValue value = VideoPlayerValue( + const value = VideoPlayerValue( isInitialized: true, size: Size(640, -480), duration: Duration(seconds: 1), @@ -1370,7 +1370,7 @@ void main() { group('VideoPlayerOptions', () { test('setMixWithOthers', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true), ); @@ -1381,7 +1381,7 @@ void main() { }); test('true allowBackgroundPlayback continues playback', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, videoPlayerOptions: VideoPlayerOptions(allowBackgroundPlayback: true), ); @@ -1396,7 +1396,7 @@ void main() { }); test('false allowBackgroundPlayback pauses playback', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, videoPlayerOptions: VideoPlayerOptions(), ); @@ -1412,11 +1412,11 @@ void main() { }); test('VideoProgressColors', () { - const Color playedColor = Color.fromRGBO(0, 0, 255, 0.75); - const Color bufferedColor = Color.fromRGBO(0, 255, 0, 0.5); - const Color backgroundColor = Color.fromRGBO(255, 255, 0, 0.25); + const playedColor = Color.fromRGBO(0, 0, 255, 0.75); + const bufferedColor = Color.fromRGBO(0, 255, 0, 0.5); + const backgroundColor = Color.fromRGBO(255, 255, 0, 0.25); - const VideoProgressColors colors = VideoProgressColors( + const colors = VideoProgressColors( playedColor: playedColor, bufferedColor: bufferedColor, backgroundColor: backgroundColor, @@ -1428,7 +1428,7 @@ void main() { }); test('isCompleted updates on video end', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, videoPlayerOptions: VideoPlayerOptions(), ); @@ -1456,7 +1456,7 @@ void main() { }); test('isCompleted updates on video play after completed', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, videoPlayerOptions: VideoPlayerOptions(), ); @@ -1471,7 +1471,7 @@ void main() { final void Function() isCompletedTest = expectAsync0(() {}, count: 2); final void Function() isNoLongerCompletedTest = expectAsync0(() {}); - bool hasLooped = false; + var hasLooped = false; controller.addListener(() async { if (currentIsCompleted != controller.value.isCompleted) { @@ -1497,7 +1497,7 @@ void main() { }); test('isCompleted updates on video seek to end', () async { - final VideoPlayerController controller = VideoPlayerController.networkUrl( + final controller = VideoPlayerController.networkUrl( _localhostUri, videoPlayerOptions: VideoPlayerOptions(), ); @@ -1546,7 +1546,7 @@ class FakeVideoPlayerPlatform extends VideoPlayerPlatform { @override Future create(DataSource dataSource) async { calls.add('create'); - final StreamController stream = StreamController(); + final stream = StreamController(); streams[nextPlayerId] = stream; if (forceInitError) { stream.addError( @@ -1571,7 +1571,7 @@ class FakeVideoPlayerPlatform extends VideoPlayerPlatform { @override Future createWithOptions(VideoCreationOptions options) async { calls.add('createWithOptions'); - final StreamController stream = StreamController(); + final stream = StreamController(); streams[nextPlayerId] = stream; if (forceInitError) { stream.addError( diff --git a/packages/video_player/video_player_android/example/integration_test/video_player_test.dart b/packages/video_player/video_player_android/example/integration_test/video_player_test.dart index d7e9758fec3..e9d10764e1d 100644 --- a/packages/video_player/video_player_android/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_android/example/integration_test/video_player_test.dart @@ -101,7 +101,7 @@ void main() { testWidgets('can play a video from a file', (WidgetTester tester) async { final Directory directory = await getTemporaryDirectory(); - final File file = File('${directory.path}/video.mp4'); + final file = File('${directory.path}/video.mp4'); await file.writeAsBytes( Uint8List.fromList( (await rootBundle.load(_videoAssetKey)).buffer.asUint8List(), diff --git a/packages/video_player/video_player_android/example/lib/mini_controller.dart b/packages/video_player/video_player_android/example/lib/mini_controller.dart index 453a3ef50d7..d8b275df773 100644 --- a/packages/video_player/video_player_android/example/lib/mini_controller.dart +++ b/packages/video_player/video_player_android/example/lib/mini_controller.dart @@ -257,7 +257,7 @@ class MiniController extends ValueNotifier { ); } - final VideoCreationOptions creationOptions = VideoCreationOptions( + final creationOptions = VideoCreationOptions( dataSource: dataSourceDescription, viewType: viewType, ); @@ -266,7 +266,7 @@ class MiniController extends ValueNotifier { (await _platform.createWithOptions(creationOptions)) ?? kUninitializedPlayerId; _creatingCompleter!.complete(null); - final Completer initializingCompleter = Completer(); + final initializingCompleter = Completer(); void eventListener(VideoEvent event) { switch (event.eventType) { @@ -297,7 +297,7 @@ class MiniController extends ValueNotifier { } void errorListener(Object obj) { - final PlatformException e = obj as PlatformException; + final e = obj as PlatformException; value = VideoPlayerValue.erroneous(e.message!); _timer?.cancel(); if (!initializingCompleter.isCompleted) { @@ -483,7 +483,7 @@ class _VideoScrubberState extends State<_VideoScrubber> { @override Widget build(BuildContext context) { void seekToRelativePosition(Offset globalPosition) { - final RenderBox box = context.findRenderObject()! as RenderBox; + final box = context.findRenderObject()! as RenderBox; final Offset tapPos = box.globalToLocal(globalPosition); final double relative = tapPos.dx / box.size.width; final Duration position = controller.value.duration * relative; @@ -543,9 +543,9 @@ class _VideoProgressIndicatorState extends State { @override Widget build(BuildContext context) { - const Color playedColor = Color.fromRGBO(255, 0, 0, 0.7); - const Color bufferedColor = Color.fromRGBO(50, 50, 200, 0.2); - const Color backgroundColor = Color.fromRGBO(200, 200, 200, 0.5); + const playedColor = Color.fromRGBO(255, 0, 0, 0.7); + const bufferedColor = Color.fromRGBO(50, 50, 200, 0.2); + const backgroundColor = Color.fromRGBO(200, 200, 200, 0.5); final Widget progressIndicator; if (controller.value.isInitialized) { diff --git a/packages/video_player/video_player_android/lib/src/android_video_player.dart b/packages/video_player/video_player_android/lib/src/android_video_player.dart index f65b83b8a84..78db9273e5d 100644 --- a/packages/video_player/video_player_android/lib/src/android_video_player.dart +++ b/packages/video_player/video_player_android/lib/src/android_video_player.dart @@ -109,7 +109,7 @@ class AndroidVideoPlayer extends VideoPlayerPlatform { if (uri == null) { throw ArgumentError('Unable to construct a video asset from $options'); } - final CreationOptions pigeonCreationOptions = CreationOptions( + final pigeonCreationOptions = CreationOptions( uri: uri, httpHeaders: httpHeaders, userAgent: userAgent, @@ -138,12 +138,12 @@ class AndroidVideoPlayer extends VideoPlayerPlatform { String? _userAgentFromHeaders(Map httpHeaders) { // TODO(stuartmorgan): HTTP headers are case-insensitive, so this should be // adjusted to find any entry where the key has a case-insensitive match. - const String userAgentKey = 'User-Agent'; + const userAgentKey = 'User-Agent'; // TODO(stuartmorgan): Investigate removing this. The use of a hard-coded // default agent dates back to the original ExoPlayer implementation of the // plugin, but it's not clear why the default isn't null, which would let // ExoPlayer use its own default value. - const String defaultUserAgent = 'ExoPlayer'; + const defaultUserAgent = 'ExoPlayer'; return httpHeaders[userAgentKey] ?? defaultUserAgent; } diff --git a/packages/video_player/video_player_android/lib/src/platform_view_player.dart b/packages/video_player/video_player_android/lib/src/platform_view_player.dart index 84d21540043..c133b25d206 100644 --- a/packages/video_player/video_player_android/lib/src/platform_view_player.dart +++ b/packages/video_player/video_player_android/lib/src/platform_view_player.dart @@ -20,8 +20,8 @@ class PlatformViewPlayer extends StatelessWidget { @override Widget build(BuildContext context) { - const String viewType = 'plugins.flutter.dev/video_player_android'; - final PlatformVideoViewCreationParams creationParams = + const viewType = 'plugins.flutter.dev/video_player_android'; + final creationParams = PlatformVideoViewCreationParams(playerId: playerId); // IgnorePointer so that GestureDetector can be used above the platform view. diff --git a/packages/video_player/video_player_android/test/android_video_player_test.dart b/packages/video_player/video_player_android/test/android_video_player_test.dart index 8ce82b0fdfb..a234a39699f 100644 --- a/packages/video_player/video_player_android/test/android_video_player_test.dart +++ b/packages/video_player/video_player_android/test/android_video_player_test.dart @@ -24,9 +24,9 @@ void main() { (AndroidVideoPlayer, MockAndroidVideoPlayerApi, MockVideoPlayerInstanceApi) setUpMockPlayer({required int playerId, int? textureId}) { - final MockAndroidVideoPlayerApi pluginApi = MockAndroidVideoPlayerApi(); - final MockVideoPlayerInstanceApi instanceApi = MockVideoPlayerInstanceApi(); - final AndroidVideoPlayer player = AndroidVideoPlayer( + final pluginApi = MockAndroidVideoPlayerApi(); + final instanceApi = MockVideoPlayerInstanceApi(); + final player = AndroidVideoPlayer( pluginApi: pluginApi, playerApiProvider: (_) => instanceApi, ); @@ -46,11 +46,11 @@ void main() { StreamController, ) setUpMockPlayerWithStream({required int playerId, int? textureId}) { - final MockAndroidVideoPlayerApi pluginApi = MockAndroidVideoPlayerApi(); - final MockVideoPlayerInstanceApi instanceApi = MockVideoPlayerInstanceApi(); - final StreamController streamController = + final pluginApi = MockAndroidVideoPlayerApi(); + final instanceApi = MockVideoPlayerInstanceApi(); + final streamController = StreamController(); - final AndroidVideoPlayer player = AndroidVideoPlayer( + final player = AndroidVideoPlayer( pluginApi: pluginApi, playerApiProvider: (_) => instanceApi, videoEventStreamProvider: (_) => @@ -90,14 +90,14 @@ void main() { test('create with asset', () async { final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = setUpMockPlayer(playerId: 1, textureId: 100); - const int newPlayerId = 2; + const newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), ); - const String asset = 'someAsset'; - const String package = 'somePackage'; - const String assetKey = 'resultingAssetKey'; + const asset = 'someAsset'; + const package = 'somePackage'; + const assetKey = 'resultingAssetKey'; when( api.getLookupKeyForAsset(asset, package), ).thenAnswer((_) async => assetKey); @@ -113,7 +113,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, 'asset:///$assetKey'); expect(playerId, newPlayerId); @@ -126,12 +126,12 @@ void main() { test('create with network', () async { final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = setUpMockPlayer(playerId: 1, textureId: 100); - const int newPlayerId = 2; + const newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), ); - const String uri = 'https://example.com'; + const uri = 'https://example.com'; final int? playerId = await player.create( DataSource( sourceType: DataSourceType.network, @@ -143,7 +143,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, uri); expect(creationOptions.formatHint, PlatformVideoFormat.dash); @@ -162,7 +162,7 @@ void main() { api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); - const Map headers = { + const headers = { 'Authorization': 'Bearer token', }; await player.create( @@ -175,7 +175,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.httpHeaders, headers); }); @@ -197,7 +197,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.userAgent, 'ExoPlayer'); }); @@ -209,8 +209,8 @@ void main() { api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); - const String userAgent = 'Test User Agent'; - const Map headers = { + const userAgent = 'Test User Agent'; + const headers = { 'User-Agent': userAgent, }; await player.create( @@ -223,7 +223,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.userAgent, userAgent); }); @@ -235,14 +235,14 @@ void main() { api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); - const String fileUri = 'file:///foo/bar'; + const fileUri = 'file:///foo/bar'; final int? playerId = await player.create( DataSource(sourceType: DataSourceType.file, uri: fileUri), ); final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, fileUri); expect( @@ -258,8 +258,8 @@ void main() { api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); - const String fileUri = 'file:///foo/bar'; - const Map headers = { + const fileUri = 'file:///foo/bar'; + const headers = { 'Authorization': 'Bearer token', }; await player.create( @@ -272,7 +272,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.httpHeaders, headers); }); @@ -280,14 +280,14 @@ void main() { test('createWithOptions with asset', () async { final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = setUpMockPlayer(playerId: 1, textureId: 100); - const int newPlayerId = 2; + const newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), ); - const String asset = 'someAsset'; - const String package = 'somePackage'; - const String assetKey = 'resultingAssetKey'; + const asset = 'someAsset'; + const package = 'somePackage'; + const assetKey = 'resultingAssetKey'; when( api.getLookupKeyForAsset(asset, package), ).thenAnswer((_) async => assetKey); @@ -306,7 +306,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, 'asset:///$assetKey'); expect(playerId, newPlayerId); @@ -319,12 +319,12 @@ void main() { test('createWithOptions with network', () async { final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = setUpMockPlayer(playerId: 1, textureId: 100); - const int newPlayerId = 2; + const newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), ); - const String uri = 'https://example.com'; + const uri = 'https://example.com'; final int? playerId = await player.createWithOptions( VideoCreationOptions( dataSource: DataSource( @@ -339,7 +339,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, uri); expect(creationOptions.formatHint, PlatformVideoFormat.dash); @@ -354,12 +354,12 @@ void main() { test('createWithOptions with network passes headers', () async { final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = setUpMockPlayer(playerId: 1, textureId: 100); - const int newPlayerId = 2; + const newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), ); - const Map headers = { + const headers = { 'Authorization': 'Bearer token', }; final int? playerId = await player.createWithOptions( @@ -376,7 +376,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.httpHeaders, headers); expect(playerId, newPlayerId); @@ -385,12 +385,12 @@ void main() { test('createWithOptions with file', () async { final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = setUpMockPlayer(playerId: 1, textureId: 100); - const int newPlayerId = 2; + const newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), ); - const String fileUri = 'file:///foo/bar'; + const fileUri = 'file:///foo/bar'; final int? playerId = await player.createWithOptions( VideoCreationOptions( dataSource: DataSource(sourceType: DataSourceType.file, uri: fileUri), @@ -401,7 +401,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, fileUri); expect(playerId, newPlayerId); @@ -418,8 +418,8 @@ void main() { api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); - const String fileUri = 'file:///foo/bar'; - const Map headers = { + const fileUri = 'file:///foo/bar'; + const headers = { 'Authorization': 'Bearer token', }; await player.createWithOptions( @@ -436,7 +436,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.httpHeaders, headers); }); @@ -444,10 +444,10 @@ void main() { test('createWithOptions with platform view', () async { final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = setUpMockPlayer(playerId: 1); - const int newPlayerId = 2; + const newPlayerId = 2; when(api.createForPlatformView(any)).thenAnswer((_) async => newPlayerId); - const String uri = 'file:///foo/bar'; + const uri = 'file:///foo/bar'; final int? playerId = await player.createWithOptions( VideoCreationOptions( dataSource: DataSource(sourceType: DataSourceType.file, uri: uri), @@ -458,7 +458,7 @@ void main() { final VerificationResult verification = verify( api.createForPlatformView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, uri); expect(playerId, newPlayerId); @@ -533,7 +533,7 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const double volume = 0.7; + const volume = 0.7; await player.setVolume(1, volume); verify(playerApi.setVolume(volume)); @@ -547,7 +547,7 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const double speed = 1.5; + const speed = 1.5; await player.setPlaybackSpeed(1, speed); verify(playerApi.setPlaybackSpeed(speed)); @@ -561,7 +561,7 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int positionMilliseconds = 12345; + const positionMilliseconds = 12345; await player.seekTo( 1, const Duration(milliseconds: positionMilliseconds), @@ -578,7 +578,7 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int positionMilliseconds = 12345; + const positionMilliseconds = 12345; when( playerApi.getCurrentPosition(), ).thenAnswer((_) async => positionMilliseconds); @@ -594,7 +594,7 @@ void main() { Stream mockPlayerEmitingEvents( List events, ) { - const int playerId = 1; + const playerId = 1; final ( AndroidVideoPlayer player, _, diff --git a/packages/video_player/video_player_avfoundation/example/integration_test/video_player_test.dart b/packages/video_player/video_player_avfoundation/example/integration_test/video_player_test.dart index 206fcf7ce07..31321932c1b 100644 --- a/packages/video_player/video_player_avfoundation/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_avfoundation/example/integration_test/video_player_test.dart @@ -103,7 +103,7 @@ void main() { // Verify that we stopped playing after the pause. // TODO(stuartmorgan): Investigate why this has a slight discrepency, and // fix it if possible. Is AVPlayer's pause method internally async? - const Duration allowableDelta = Duration(milliseconds: 10); + const allowableDelta = Duration(milliseconds: 10); expect( await controller.position, lessThan(pausedPosition + allowableDelta), @@ -119,7 +119,7 @@ void main() { // Write it to a file to use as a source. final String filename = _videoAssetKey.split('/').last; - final File file = File('$tempDir/$filename'); + final file = File('$tempDir/$filename'); await file.writeAsBytes(bytes.buffer.asInt8List()); controller = MiniController.file(file); @@ -148,8 +148,8 @@ void main() { (WidgetTester tester) async { await controller.initialize(); - final Completer started = Completer(); - final Completer ended = Completer(); + final started = Completer(); + final ended = Completer(); controller.addListener(() { if (!started.isCompleted && controller.value.isBuffering) { started.complete(); @@ -180,7 +180,7 @@ void main() { ); testWidgets('live stream duration != 0', (WidgetTester tester) async { - final MiniController livestreamController = MiniController.network( + final livestreamController = MiniController.network( 'https://flutter.github.io/assets-for-api-docs/assets/videos/hls/bee.m3u8', ); await livestreamController.initialize(); @@ -199,7 +199,7 @@ void main() { ) async { // Some m3u8 files contain rotation data that may incorrectly invert the aspect ratio. // More info [here](https://github.com/flutter/flutter/issues/109116). - final MiniController livestreamController = MiniController.network( + final livestreamController = MiniController.network( 'https://flutter.github.io/assets-for-api-docs/assets/videos/hls/rotated_nail_manifest.m3u8', ); await livestreamController.initialize(); diff --git a/packages/video_player/video_player_avfoundation/example/lib/mini_controller.dart b/packages/video_player/video_player_avfoundation/example/lib/mini_controller.dart index 8640d16c703..bfc6b1dd496 100644 --- a/packages/video_player/video_player_avfoundation/example/lib/mini_controller.dart +++ b/packages/video_player/video_player_avfoundation/example/lib/mini_controller.dart @@ -245,7 +245,7 @@ class MiniController extends ValueNotifier { ); } - final VideoCreationOptions creationOptions = VideoCreationOptions( + final creationOptions = VideoCreationOptions( dataSource: dataSourceDescription, viewType: viewType, ); @@ -254,7 +254,7 @@ class MiniController extends ValueNotifier { (await _platform.createWithOptions(creationOptions)) ?? kUninitializedPlayerId; _creatingCompleter!.complete(null); - final Completer initializingCompleter = Completer(); + final initializingCompleter = Completer(); void eventListener(VideoEvent event) { switch (event.eventType) { @@ -284,7 +284,7 @@ class MiniController extends ValueNotifier { } void errorListener(Object obj) { - final PlatformException e = obj as PlatformException; + final e = obj as PlatformException; value = VideoPlayerValue.erroneous(e.message!); _timer?.cancel(); if (!initializingCompleter.isCompleted) { @@ -450,7 +450,7 @@ class _VideoScrubberState extends State<_VideoScrubber> { @override Widget build(BuildContext context) { void seekToRelativePosition(Offset globalPosition) { - final RenderBox box = context.findRenderObject()! as RenderBox; + final box = context.findRenderObject()! as RenderBox; final Offset tapPos = box.globalToLocal(globalPosition); final double relative = tapPos.dx / box.size.width; final Duration position = controller.value.duration * relative; @@ -510,9 +510,9 @@ class _VideoProgressIndicatorState extends State { @override Widget build(BuildContext context) { - const Color playedColor = Color.fromRGBO(255, 0, 0, 0.7); - const Color bufferedColor = Color.fromRGBO(50, 50, 200, 0.2); - const Color backgroundColor = Color.fromRGBO(200, 200, 200, 0.5); + const playedColor = Color.fromRGBO(255, 0, 0, 0.7); + const bufferedColor = Color.fromRGBO(50, 50, 200, 0.2); + const backgroundColor = Color.fromRGBO(200, 200, 200, 0.5); final Widget progressIndicator; if (controller.value.isInitialized) { diff --git a/packages/video_player/video_player_avfoundation/lib/src/avfoundation_video_player.dart b/packages/video_player/video_player_avfoundation/lib/src/avfoundation_video_player.dart index 4c1719578f6..05532bf2682 100644 --- a/packages/video_player/video_player_avfoundation/lib/src/avfoundation_video_player.dart +++ b/packages/video_player/video_player_avfoundation/lib/src/avfoundation_video_player.dart @@ -100,7 +100,7 @@ class AVFoundationVideoPlayer extends VideoPlayerPlatform { if (uri == null) { throw ArgumentError('Unable to construct a video asset from $options'); } - final CreationOptions pigeonCreationOptions = CreationOptions( + final pigeonCreationOptions = CreationOptions( uri: uri, httpHeaders: dataSource.httpHeaders, ); @@ -176,7 +176,7 @@ class AVFoundationVideoPlayer extends VideoPlayerPlatform { return _eventChannelFor(playerId).receiveBroadcastStream().map(( dynamic event, ) { - final Map map = event as Map; + final map = event as Map; return switch (map['event']) { 'initialized' => VideoEvent( eventType: VideoEventType.initialized, @@ -233,7 +233,7 @@ class AVFoundationVideoPlayer extends VideoPlayerPlatform { } Widget _buildPlatformView(int playerId) { - final PlatformVideoViewCreationParams creationParams = + final creationParams = PlatformVideoViewCreationParams(playerId: playerId); return IgnorePointer( @@ -256,9 +256,9 @@ class AVFoundationVideoPlayer extends VideoPlayerPlatform { } DurationRange _toDurationRange(dynamic value) { - final List pair = value as List; - final int startMilliseconds = pair[0] as int; - final int durationMilliseconds = pair[1] as int; + final pair = value as List; + final startMilliseconds = pair[0] as int; + final durationMilliseconds = pair[1] as int; return DurationRange( Duration(milliseconds: startMilliseconds), Duration(milliseconds: startMilliseconds + durationMilliseconds), diff --git a/packages/video_player/video_player_avfoundation/test/avfoundation_video_player_test.dart b/packages/video_player/video_player_avfoundation/test/avfoundation_video_player_test.dart index 11cac97a7dd..3f74d4ef00d 100644 --- a/packages/video_player/video_player_avfoundation/test/avfoundation_video_player_test.dart +++ b/packages/video_player/video_player_avfoundation/test/avfoundation_video_player_test.dart @@ -25,10 +25,10 @@ void main() { MockVideoPlayerInstanceApi, ) setUpMockPlayer({required int playerId}) { - final MockAVFoundationVideoPlayerApi pluginApi = + final pluginApi = MockAVFoundationVideoPlayerApi(); - final MockVideoPlayerInstanceApi instanceApi = MockVideoPlayerInstanceApi(); - final AVFoundationVideoPlayer player = AVFoundationVideoPlayer( + final instanceApi = MockVideoPlayerInstanceApi(); + final player = AVFoundationVideoPlayer( pluginApi: pluginApi, playerProvider: (_) => instanceApi, ); @@ -77,16 +77,16 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int newPlayerId = 2; - const int textureId = 100; + const newPlayerId = 2; + const textureId = 100; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: textureId), ); - const String asset = 'someAsset'; - const String package = 'somePackage'; - const String assetUrl = 'file:///some/asset/path'; + const asset = 'someAsset'; + const package = 'somePackage'; + const assetUrl = 'file:///some/asset/path'; when(api.getAssetUrl(asset, package)).thenAnswer((_) async => assetUrl); final int? playerId = await player.create( @@ -100,7 +100,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, assetUrl); expect(playerId, newPlayerId); @@ -121,8 +121,8 @@ void main() { playerId: 1, ); - const String asset = 'someAsset'; - const String package = 'somePackage'; + const asset = 'someAsset'; + const package = 'somePackage'; when(api.getAssetUrl(asset, package)).thenAnswer((_) async => null); expect( @@ -146,14 +146,14 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int newPlayerId = 2; - const int textureId = 100; + const newPlayerId = 2; + const textureId = 100; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: textureId), ); - const String uri = 'https://example.com'; + const uri = 'https://example.com'; final int? playerId = await player.create( DataSource( sourceType: DataSourceType.network, @@ -165,7 +165,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, uri); expect(creationOptions.httpHeaders, {}); @@ -188,7 +188,7 @@ void main() { api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); - const Map headers = { + const headers = { 'Authorization': 'Bearer token', }; await player.create( @@ -201,7 +201,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.httpHeaders, headers); }); @@ -214,21 +214,21 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int newPlayerId = 2; - const int textureId = 100; + const newPlayerId = 2; + const textureId = 100; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: textureId), ); - const String fileUri = 'file:///foo/bar'; + const fileUri = 'file:///foo/bar'; final int? playerId = await player.create( DataSource(sourceType: DataSourceType.file, uri: fileUri), ); final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, fileUri); expect(playerId, newPlayerId); @@ -246,16 +246,16 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int newPlayerId = 2; - const int textureId = 100; + const newPlayerId = 2; + const textureId = 100; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: textureId), ); - const String asset = 'someAsset'; - const String package = 'somePackage'; - const String assetUrl = 'file:///some/asset/path'; + const asset = 'someAsset'; + const package = 'somePackage'; + const assetUrl = 'file:///some/asset/path'; when(api.getAssetUrl(asset, package)).thenAnswer((_) async => assetUrl); final int? playerId = await player.createWithOptions( VideoCreationOptions( @@ -271,7 +271,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, assetUrl); expect(playerId, newPlayerId); @@ -289,14 +289,14 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int newPlayerId = 2; - const int textureId = 100; + const newPlayerId = 2; + const textureId = 100; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: textureId), ); - const String uri = 'https://example.com'; + const uri = 'https://example.com'; final int? playerId = await player.createWithOptions( VideoCreationOptions( dataSource: DataSource( @@ -311,7 +311,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, uri); expect(creationOptions.httpHeaders, {}); @@ -330,12 +330,12 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int newPlayerId = 2; + const newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), ); - const Map headers = { + const headers = { 'Authorization': 'Bearer token', }; final int? playerId = await player.createWithOptions( @@ -352,7 +352,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.httpHeaders, headers); expect(playerId, newPlayerId); @@ -366,14 +366,14 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int newPlayerId = 2; - const int textureId = 100; + const newPlayerId = 2; + const textureId = 100; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: textureId), ); - const String fileUri = 'file:///foo/bar'; + const fileUri = 'file:///foo/bar'; final int? playerId = await player.createWithOptions( VideoCreationOptions( dataSource: DataSource(sourceType: DataSourceType.file, uri: fileUri), @@ -384,7 +384,7 @@ void main() { final VerificationResult verification = verify( api.createForTextureView(captureAny), ); - final CreationOptions creationOptions = + final creationOptions = verification.captured[0] as CreationOptions; expect(creationOptions.uri, fileUri); expect(playerId, newPlayerId); @@ -402,7 +402,7 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int newPlayerId = 2; + const newPlayerId = 2; when(api.createForPlatformView(any)).thenAnswer((_) async => newPlayerId); final int? playerId = await player.createWithOptions( @@ -497,7 +497,7 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const double volume = 0.7; + const volume = 0.7; await player.setVolume(1, volume); verify(playerApi.setVolume(volume)); @@ -511,7 +511,7 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const double speed = 1.5; + const speed = 1.5; await player.setPlaybackSpeed(1, speed); verify(playerApi.setPlaybackSpeed(speed)); @@ -525,7 +525,7 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int positionMilliseconds = 12345; + const positionMilliseconds = 12345; await player.seekTo( 1, const Duration(milliseconds: positionMilliseconds), @@ -542,7 +542,7 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const int positionMilliseconds = 12345; + const positionMilliseconds = 12345; when( playerApi.getPosition(), ).thenAnswer((_) async => positionMilliseconds); @@ -559,7 +559,7 @@ void main() { ) = setUpMockPlayer( playerId: 1, ); - const String mockChannel = 'flutter.io/videoPlayer/videoEvents123'; + const mockChannel = 'flutter.io/videoPlayer/videoEvents123'; TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMessageHandler(mockChannel, (ByteData? message) async { final MethodCall methodCall = const StandardMethodCodec() diff --git a/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart b/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart index 6525d3bab33..1cec5f42c21 100644 --- a/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart +++ b/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart @@ -521,7 +521,7 @@ class VideoPlayerWebOptionsControls { /// A string representation of disallowed controls String get controlsList { - final List controlsList = []; + final controlsList = []; if (!allowDownload) { controlsList.add('nodownload'); } diff --git a/packages/video_player/video_player_platform_interface/test/video_player_options_test.dart b/packages/video_player/video_player_platform_interface/test/video_player_options_test.dart index dcfb9e4c15a..6af3e57f6c0 100644 --- a/packages/video_player/video_player_platform_interface/test/video_player_options_test.dart +++ b/packages/video_player/video_player_platform_interface/test/video_player_options_test.dart @@ -7,11 +7,11 @@ import 'package:video_player_platform_interface/video_player_platform_interface. void main() { test('VideoPlayerOptions allowBackgroundPlayback defaults to false', () { - final VideoPlayerOptions options = VideoPlayerOptions(); + final options = VideoPlayerOptions(); expect(options.allowBackgroundPlayback, false); }); test('VideoPlayerOptions mixWithOthers defaults to false', () { - final VideoPlayerOptions options = VideoPlayerOptions(); + final options = VideoPlayerOptions(); expect(options.mixWithOthers, false); }); } diff --git a/packages/video_player/video_player_platform_interface/test/video_player_web_options_test.dart b/packages/video_player/video_player_platform_interface/test/video_player_web_options_test.dart index 5b53aca21e5..6cccd1842f7 100644 --- a/packages/video_player/video_player_platform_interface/test/video_player_web_options_test.dart +++ b/packages/video_player/video_player_platform_interface/test/video_player_web_options_test.dart @@ -9,29 +9,29 @@ void main() { test( 'VideoPlayerOptions controls defaults to VideoPlayerWebOptionsControls.disabled()', () { - const VideoPlayerWebOptions options = VideoPlayerWebOptions(); + const options = VideoPlayerWebOptions(); expect(options.controls, const VideoPlayerWebOptionsControls.disabled()); }, ); test('VideoPlayerOptions allowContextMenu defaults to true', () { - const VideoPlayerWebOptions options = VideoPlayerWebOptions(); + const options = VideoPlayerWebOptions(); expect(options.allowContextMenu, isTrue); }); test('VideoPlayerOptions allowRemotePlayback defaults to true', () { - const VideoPlayerWebOptions options = VideoPlayerWebOptions(); + const options = VideoPlayerWebOptions(); expect(options.allowRemotePlayback, isTrue); }); group('VideoPlayerOptions poster', () { test('defaults to null', () { - const VideoPlayerWebOptions options = VideoPlayerWebOptions(); + const options = VideoPlayerWebOptions(); expect(options.poster, null); }); test('with a value', () { - final VideoPlayerWebOptions options = VideoPlayerWebOptions( + final options = VideoPlayerWebOptions( poster: Uri.parse('https://example.com/poster.jpg'), ); expect(options.poster, Uri.parse('https://example.com/poster.jpg')); diff --git a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart index 2e7c1a44f50..0621951693e 100644 --- a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart @@ -30,7 +30,7 @@ void main() { }); testWidgets('initialize() calls load', (WidgetTester _) async { - bool loadCalled = false; + var loadCalled = false; video['load'] = () { loadCalled = true; @@ -64,7 +64,7 @@ void main() { }); testWidgets('setVolume', (WidgetTester tester) async { - final VideoPlayer player = VideoPlayer(videoElement: video)..initialize(); + final player = VideoPlayer(videoElement: video)..initialize(); player.setVolume(0); expect(video.muted, isTrue, reason: 'muted attribute should be true'); @@ -97,7 +97,7 @@ void main() { }); testWidgets('setPlaybackSpeed', (WidgetTester tester) async { - final VideoPlayer player = VideoPlayer(videoElement: video)..initialize(); + final player = VideoPlayer(videoElement: video)..initialize(); expect( () { @@ -118,7 +118,7 @@ void main() { group('seekTo', () { testWidgets('negative time - throws assert', (WidgetTester tester) async { - final VideoPlayer player = VideoPlayer(videoElement: video) + final player = VideoPlayer(videoElement: video) ..initialize(); expect( @@ -134,7 +134,7 @@ void main() { WidgetTester tester, ) async { makeSetCurrentTimeThrow(video); - final VideoPlayer player = VideoPlayer(videoElement: video) + final player = VideoPlayer(videoElement: video) ..initialize(); expect( @@ -161,7 +161,7 @@ void main() { late VideoPlayer player; late Stream timedStream; - final Set bufferingEvents = { + final bufferingEvents = { VideoEventType.bufferingStart, VideoEventType.bufferingEnd, }; diff --git a/packages/video_player/video_player_web/lib/src/video_player.dart b/packages/video_player/video_player_web/lib/src/video_player.dart index d3ee51e3910..45aa558508d 100644 --- a/packages/video_player/video_player_web/lib/src/video_player.dart +++ b/packages/video_player/video_player_web/lib/src/video_player.dart @@ -153,7 +153,7 @@ class VideoPlayer { // playback for any reason, such as permission issues. // The rejection handler is called with a DOMException. // See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play - final web.DOMException exception = e as web.DOMException; + final exception = e as web.DOMException; _eventController.addError( PlatformException(code: exception.name, message: exception.message), ); @@ -359,8 +359,8 @@ class VideoPlayer { // Converts from [html.TimeRanges] to our own List. List _toDurationRange(web.TimeRanges buffered) { - final List durationRange = []; - for (int i = 0; i < buffered.length; i++) { + final durationRange = []; + for (var i = 0; i < buffered.length; i++) { durationRange.add( DurationRange( Duration(milliseconds: (buffered.start(i) * 1000).round()), diff --git a/packages/video_player/video_player_web/lib/video_player_web.dart b/packages/video_player/video_player_web/lib/video_player_web.dart index 279e1298907..ecc8e427d2d 100644 --- a/packages/video_player/video_player_web/lib/video_player_web.dart +++ b/packages/video_player/video_player_web/lib/video_player_web.dart @@ -90,7 +90,7 @@ class VideoPlayerPlugin extends VideoPlayerPlatform { ); } - final web.HTMLVideoElement videoElement = web.HTMLVideoElement() + final videoElement = web.HTMLVideoElement() ..id = 'videoElement-$playerId' ..style.border = 'none' ..style.height = '100%' @@ -102,7 +102,7 @@ class VideoPlayerPlugin extends VideoPlayerPlatform { (int viewId) => videoElement, ); - final VideoPlayer player = VideoPlayer(videoElement: videoElement) + final player = VideoPlayer(videoElement: videoElement) ..initialize(src: uri); _videoPlayers[playerId] = player; diff --git a/packages/web_benchmarks/example/analyze_example.dart b/packages/web_benchmarks/example/analyze_example.dart index a83c625f5d0..2b69eda7020 100644 --- a/packages/web_benchmarks/example/analyze_example.dart +++ b/packages/web_benchmarks/example/analyze_example.dart @@ -32,8 +32,8 @@ void main() { } BenchmarkResults _benchmarkResultsFromFile(String path) { - final File file = File.fromUri(Uri.parse(path)); - final Map fileContentAsJson = + final file = File.fromUri(Uri.parse(path)); + final fileContentAsJson = jsonDecode(file.readAsStringSync()) as Map; return BenchmarkResults.parse(fileContentAsJson); } diff --git a/packages/web_benchmarks/lib/analysis.dart b/packages/web_benchmarks/lib/analysis.dart index 73edaf62fb4..4dda2437509 100644 --- a/packages/web_benchmarks/lib/analysis.dart +++ b/packages/web_benchmarks/lib/analysis.dart @@ -20,10 +20,10 @@ BenchmarkResults computeAverage(List results) { (BenchmarkResults sum, BenchmarkResults next) => sum._sumWith(next), ); - final BenchmarkResults average = totalSum; + final average = totalSum; for (final String benchmark in totalSum.scores.keys) { final List scoresForBenchmark = totalSum.scores[benchmark]!; - for (int i = 0; i < scoresForBenchmark.length; i++) { + for (var i = 0; i < scoresForBenchmark.length; i++) { final BenchmarkScore score = scoresForBenchmark[i]; final double averageValue = score.value / results.length; average.scores[benchmark]![i] = BenchmarkScore( @@ -42,7 +42,7 @@ BenchmarkResults computeDelta( BenchmarkResults baseline, BenchmarkResults test, ) { - final Map> delta = + final delta = >{}; for (final String benchmarkName in test.scores.keys) { final List testScores = test.scores[benchmarkName]!; @@ -76,7 +76,7 @@ extension _AnalysisExtension on BenchmarkResults { BenchmarkResults other, { bool throwExceptionOnMismatch = true, }) { - final Map> sum = + final sum = >{}; for (final String benchmark in scores.keys) { // Look up this benchmark in [other]. diff --git a/packages/web_benchmarks/lib/client.dart b/packages/web_benchmarks/lib/client.dart index d9d60e30501..3af9875354b 100644 --- a/packages/web_benchmarks/lib/client.dart +++ b/packages/web_benchmarks/lib/client.dart @@ -68,7 +68,7 @@ Future runBenchmarks( final Uri currentUri = Uri.parse(window.location.href); // Create a new URI with the parsed value of [benchmarkPath] to ensure the // benchmark app is reloaded with the proper configuration. - final String newUri = Uri.parse(benchmarkPath) + final newUri = Uri.parse(benchmarkPath) .replace( scheme: currentUri.scheme, host: currentUri.host, @@ -94,7 +94,7 @@ Future _runBenchmark(String? benchmarkName) async { await runZoned>( () async { final Recorder recorder = recorderFactory(); - final Runner runner = recorder.isTracingEnabled && !_client.isInManualMode + final runner = recorder.isTracingEnabled && !_client.isInManualMode ? Runner( recorder: recorder, setUpAllDidRun: () => @@ -168,7 +168,7 @@ void _fallbackToManual(String error) { /// Visualizes results on the Web page for manual inspection. void _printResultsToScreen(Profile profile) { - final HTMLBodyElement body = document.body! as HTMLBodyElement; + final body = document.body! as HTMLBodyElement; body.innerHTMLString = '

${profile.name}

'; @@ -238,7 +238,7 @@ class TimeseriesVisualization { final double barWidth = _screenWidth / _stats.samples.length; double xOffset = 0; - for (int i = 0; i < _stats.samples.length; i++) { + for (var i = 0; i < _stats.samples.length; i++) { final AnnotatedSample sample = _stats.samples[i]; if (sample.isWarmUpValue) { @@ -415,8 +415,8 @@ class LocalBenchmarkServerClient { required String mimeType, String? sendData, }) { - final Completer completer = Completer(); - final XMLHttpRequest xhr = XMLHttpRequest(); + final completer = Completer(); + final xhr = XMLHttpRequest(); xhr.open(method, url, true); xhr.overrideMimeType(mimeType); xhr.onLoad.listen((ProgressEvent e) { diff --git a/packages/web_benchmarks/lib/src/benchmark_result.dart b/packages/web_benchmarks/lib/src/benchmark_result.dart index 69ae5349b27..0ac1fb9703b 100644 --- a/packages/web_benchmarks/lib/src/benchmark_result.dart +++ b/packages/web_benchmarks/lib/src/benchmark_result.dart @@ -11,9 +11,9 @@ class BenchmarkScore { /// Deserializes a JSON object to create a [BenchmarkScore] object. factory BenchmarkScore.parse(Map json) { - final String metric = json[metricKey]! as String; + final metric = json[metricKey]! as String; final double value = (json[valueKey]! as num).toDouble(); - final num? delta = json[deltaKey] as num?; + final delta = json[deltaKey] as num?; return BenchmarkScore(metric: metric, value: value, delta: delta); } @@ -59,7 +59,7 @@ class BenchmarkResults { /// Deserializes a JSON object to create a [BenchmarkResults] object. factory BenchmarkResults.parse(Map json) { - final Map> results = + final results = >{}; for (final String key in json.keys) { final List scores = (json[key]! as List) diff --git a/packages/web_benchmarks/lib/src/browser.dart b/packages/web_benchmarks/lib/src/browser.dart index 137d7b6fccf..9698b4b62fe 100644 --- a/packages/web_benchmarks/lib/src/browser.dart +++ b/packages/web_benchmarks/lib/src/browser.dart @@ -100,9 +100,9 @@ class Chrome { print('Launching Chrome...'); } final String? url = options.url; - final bool withDebugging = options.debugPort != null; + final withDebugging = options.debugPort != null; - final List args = [ + final args = [ if (options.userDataDirectory != null) '--user-data-dir=${options.userDataDirectory}', if (url != null) url, @@ -251,13 +251,13 @@ String _findSystemChromeExecutable() { throw Exception('Failed to locate system Chrome installation.'); } - final String output = which.stdout as String; + final output = which.stdout as String; return output.trim(); } else if (io.Platform.isMacOS) { return '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'; } else if (io.Platform.isWindows) { - const String kWindowsExecutable = r'Google\Chrome\Application\chrome.exe'; - final List kWindowsPrefixes = [ + const kWindowsExecutable = r'Google\Chrome\Application\chrome.exe'; + final kWindowsPrefixes = [ for (final String? item in [ io.Platform.environment['LOCALAPPDATA'], io.Platform.environment['PROGRAMFILES'], @@ -311,7 +311,7 @@ Future _connectToChromeDebugPort( Uri.parse('http://localhost:$port'), ); print('Connecting to DevTools: $devtoolsUri'); - final ChromeConnection chromeConnection = ChromeConnection('localhost', port); + final chromeConnection = ChromeConnection('localhost', port); final Iterable tabs = (await chromeConnection.getTabs()).where(( ChromeTab tab, ) { @@ -325,12 +325,12 @@ Future _connectToChromeDebugPort( /// Gets the Chrome debugger URL for the web page being benchmarked. Future _getRemoteDebuggerUrl(Uri base) async { - final io.HttpClient client = io.HttpClient(); + final client = io.HttpClient(); final io.HttpClientRequest request = await client.getUrl( base.resolve('/json/list'), ); final io.HttpClientResponse response = await request.close(); - final List? jsonObject = + final jsonObject = await json.fuse(utf8).decoder.bind(response).single as List?; if (jsonObject == null || jsonObject.isEmpty) { return base; @@ -381,10 +381,10 @@ class BlinkTraceSummary { .toList(); // Extract frame data. - final List frames = []; - int skipCount = 0; - BlinkFrame frame = BlinkFrame(); - for (final BlinkTraceEvent event in events) { + final frames = []; + var skipCount = 0; + var frame = BlinkFrame(); + for (final event in events) { if (event.isBeginFrame) { frame.beginFrame = event; } else if (event.isUpdateAllLifecyclePhases) { @@ -425,7 +425,7 @@ class BlinkTraceSummary { ), ); } catch (_) { - final io.File traceFile = io.File('./chrome-trace.json'); + final traceFile = io.File('./chrome-trace.json'); io.stderr.writeln( 'Failed to interpret the Chrome trace contents. The trace was saved in ${traceFile.path}', ); @@ -643,7 +643,7 @@ class BlinkTraceEvent { /// /// Returns null if the value is null. int? _readInt(Map json, String key) { - final num? jsonValue = json[key] as num?; + final jsonValue = json[key] as num?; if (jsonValue == null) { return null; // ignore: avoid_returning_null diff --git a/packages/web_benchmarks/lib/src/computations.dart b/packages/web_benchmarks/lib/src/computations.dart index 605fe93817f..35c548255b6 100644 --- a/packages/web_benchmarks/lib/src/computations.dart +++ b/packages/web_benchmarks/lib/src/computations.dart @@ -121,7 +121,7 @@ class Timeseries { candidateValues, ); - final List annotatedValues = [ + final annotatedValues = [ for (final double warmUpValue in warmUpValues) AnnotatedSample( magnitude: warmUpValue, @@ -243,7 +243,7 @@ class TimeseriesStats { @override String toString() { - final StringBuffer buffer = StringBuffer(); + final buffer = StringBuffer(); buffer.writeln( '$name: (samples: $cleanSampleCount clean/$outlierSampleCount ' 'outliers/${cleanSampleCount + outlierSampleCount} ' @@ -342,7 +342,7 @@ Map computePercentiles( '$label: attempted to compute a percentile of an empty value list.', ); } - for (final double percentile in percentiles) { + for (final percentile in percentiles) { if (percentile < 0.0 || percentile > 1.0) { throw StateError( '$label: attempted to compute a percentile for an invalid ' @@ -354,8 +354,8 @@ Map computePercentiles( final List sorted = values.sorted( (double a, double b) => a.compareTo(b), ); - final Map computed = {}; - for (final double percentile in percentiles) { + final computed = {}; + for (final percentile in percentiles) { final int percentileIndex = (sorted.length * percentile).round().clamp( 0, sorted.length - 1, diff --git a/packages/web_benchmarks/lib/src/recorder.dart b/packages/web_benchmarks/lib/src/recorder.dart index c4667762373..a1eec9883d2 100644 --- a/packages/web_benchmarks/lib/src/recorder.dart +++ b/packages/web_benchmarks/lib/src/recorder.dart @@ -30,7 +30,7 @@ const int kTotalSampleCount = _kWarmUpSampleCount + kMeasuredSampleCount; /// Measures the amount of time [action] takes. Duration timeAction(VoidCallback action) { - final Stopwatch stopwatch = Stopwatch()..start(); + final stopwatch = Stopwatch()..start(); action(); stopwatch.stop(); return stopwatch.elapsed; @@ -226,7 +226,7 @@ abstract class SceneBuilderRecorder extends Recorder { @override Future run() { - final Completer profileCompleter = Completer(); + final profileCompleter = Completer(); _profile = Profile(name: name); PlatformDispatcher.instance.onBeginFrame = (_) { @@ -242,7 +242,7 @@ abstract class SceneBuilderRecorder extends Recorder { final FlutterView? view = PlatformDispatcher.instance.implicitView; try { _profile.record(BenchmarkMetric.drawFrame.label, () { - final SceneBuilder sceneBuilder = SceneBuilder(); + final sceneBuilder = SceneBuilder(); onDrawFrame(sceneBuilder); _profile.record('sceneBuildDuration', () { final Scene scene = sceneBuilder.build(); @@ -435,7 +435,7 @@ abstract class WidgetRecorder extends Recorder implements FrameRecorder { late void Function(List frameTimings) frameTimingsCallback; binding.addTimingsCallback( frameTimingsCallback = (List frameTimings) { - for (final FrameTiming frameTiming in frameTimings) { + for (final frameTiming in frameTimings) { localProfile.addDataPoint( BenchmarkMetric.flutterFrameTotalTime.label, frameTiming.totalSpan, @@ -689,8 +689,8 @@ class Profile { /// Returns a JSON representation of the profile that will be sent to the /// server. Map toJson() { - final List scoreKeys = []; - final Map json = { + final scoreKeys = []; + final json = { 'name': name, 'scoreKeys': scoreKeys, }; @@ -726,7 +726,7 @@ class Profile { @override String toString() { - final StringBuffer buffer = StringBuffer(); + final buffer = StringBuffer(); buffer.writeln('name: $name'); for (final String key in scoreData.keys) { final Timeseries timeseries = scoreData[key]!; diff --git a/packages/web_benchmarks/lib/src/runner.dart b/packages/web_benchmarks/lib/src/runner.dart index a57762c5182..2ec3e69f680 100644 --- a/packages/web_benchmarks/lib/src/runner.dart +++ b/packages/web_benchmarks/lib/src/runner.dart @@ -128,7 +128,7 @@ class BenchmarkServer { ); } - final DateTime startTime = DateTime.now(); + final startTime = DateTime.now(); print('Building Flutter web app $compilationOptions...'); final io.ProcessResult buildResult = await _processManager.run([ 'flutter', @@ -155,9 +155,9 @@ class BenchmarkServer { throw Exception('Failed to build the benchmark.'); } - final Completer>> profileData = + final profileData = Completer>>(); - final List> collectedProfiles = + final collectedProfiles = >[]; List? benchmarks; late Iterator benchmarkIterator; @@ -169,7 +169,7 @@ class BenchmarkServer { Chrome? chrome; late io.HttpServer server; List>? latestPerformanceTrace; - Cascade cascade = Cascade(); + var cascade = Cascade(); // Serves the static files built for the app (html, js, images, fonts, etc) final Handler buildFolderHandler = createStaticHandler( @@ -202,9 +202,9 @@ class BenchmarkServer { try { chrome ??= await whenChromeIsReady; if (request.requestedUri.path.endsWith('/profile-data')) { - final Map profile = + final profile = json.decode(await request.readAsString()) as Map; - final String? benchmarkName = profile['name'] as String?; + final benchmarkName = profile['name'] as String?; if (benchmarkName != benchmarkIterator.current) { profileData.completeError( Exception( @@ -244,11 +244,11 @@ class BenchmarkServer { latestPerformanceTrace = await chrome!.endRecordingPerformance(); return Response.ok('Stopped performance tracing'); } else if (request.requestedUri.path.endsWith('/on-error')) { - final Map errorDetails = + final errorDetails = json.decode(await request.readAsString()) as Map; unawaited(server.close()); // Keep the stack trace as a string. It's thrown in the browser, not this Dart VM. - final String errorMessage = + final errorMessage = 'Caught browser-side error: ${errorDetails['error']}\n${errorDetails['stackTrace']}'; if (!profileData.isCompleted) { profileData.completeError(errorMessage); @@ -300,7 +300,7 @@ class BenchmarkServer { cascade = cascade.add((Request request) async { if (request.method == 'GET') { final Uri newRequestUri = request.requestedUri.replace(path: '/'); - final Request newRequest = Request( + final newRequest = Request( request.method, newRequestUri, headers: request.headers, @@ -324,7 +324,7 @@ class BenchmarkServer { dartToolDirectory, ).createTempSync('chrome_user_data_').path; - final ChromeOptions options = ChromeOptions( + final options = ChromeOptions( url: _benchmarkAppUrl, userDataDirectory: userDataDir, headless: headless, @@ -348,21 +348,21 @@ class BenchmarkServer { final List> profiles = await profileData.future; print('Received profile data'); - final Map> results = + final results = >{}; - for (final Map profile in profiles) { - final String benchmarkName = profile['name'] as String; + for (final profile in profiles) { + final benchmarkName = profile['name'] as String; if (benchmarkName.isEmpty) { throw StateError('Benchmark name is empty'); } - final List scoreKeys = List.from( + final scoreKeys = List.from( profile['scoreKeys'] as Iterable, ); if (scoreKeys.isEmpty) { throw StateError('No score keys in benchmark "$benchmarkName"'); } - for (final String scoreKey in scoreKeys) { + for (final scoreKey in scoreKeys) { if (scoreKey.isEmpty) { throw StateError( 'Score key is empty in benchmark "$benchmarkName". ' @@ -371,7 +371,7 @@ class BenchmarkServer { } } - final List scores = []; + final scores = []; for (final String key in profile.keys) { if (key == 'name' || key == 'scoreKeys') { continue; diff --git a/packages/web_benchmarks/test/src/analysis_test.dart b/packages/web_benchmarks/test/src/analysis_test.dart index 31e305e78aa..e1dd1d21ec7 100644 --- a/packages/web_benchmarks/test/src/analysis_test.dart +++ b/packages/web_benchmarks/test/src/analysis_test.dart @@ -8,7 +8,7 @@ import 'package:web_benchmarks/analysis.dart'; void main() { group('averageBenchmarkResults', () { test('succeeds for identical benchmark names and metrics', () { - final BenchmarkResults result1 = BenchmarkResults( + final result1 = BenchmarkResults( >{ 'foo': [ BenchmarkScore(metric: 'foo.bar', value: 6), @@ -19,7 +19,7 @@ void main() { ], }, ); - final BenchmarkResults result2 = BenchmarkResults( + final result2 = BenchmarkResults( >{ 'foo': [ BenchmarkScore(metric: 'foo.bar', value: 4), @@ -46,12 +46,12 @@ void main() { }); test('fails for mismatched benchmark names', () { - final BenchmarkResults result1 = BenchmarkResults( + final result1 = BenchmarkResults( >{ 'foo': [BenchmarkScore(metric: 'foo.bar', value: 6)], }, ); - final BenchmarkResults result2 = BenchmarkResults( + final result2 = BenchmarkResults( >{ 'foo1': [BenchmarkScore(metric: 'foo.bar', value: 4)], }, @@ -62,12 +62,12 @@ void main() { }); test('fails for mismatched benchmark metrics', () { - final BenchmarkResults result1 = BenchmarkResults( + final result1 = BenchmarkResults( >{ 'foo': [BenchmarkScore(metric: 'foo.bar', value: 6)], }, ); - final BenchmarkResults result2 = BenchmarkResults( + final result2 = BenchmarkResults( >{ 'foo': [BenchmarkScore(metric: 'foo.boo', value: 4)], }, @@ -79,10 +79,10 @@ void main() { }); test('computeDelta', () { - final BenchmarkResults benchmark1 = BenchmarkResults.parse( + final benchmark1 = BenchmarkResults.parse( testBenchmarkResults1, ); - final BenchmarkResults benchmark2 = BenchmarkResults.parse( + final benchmark2 = BenchmarkResults.parse( testBenchmarkResults2, ); final BenchmarkResults delta = computeDelta(benchmark1, benchmark2); diff --git a/packages/web_benchmarks/test/src/benchmark_result_test.dart b/packages/web_benchmarks/test/src/benchmark_result_test.dart index 59a49ee6884..36460713194 100644 --- a/packages/web_benchmarks/test/src/benchmark_result_test.dart +++ b/packages/web_benchmarks/test/src/benchmark_result_test.dart @@ -8,7 +8,7 @@ import 'package:web_benchmarks/server.dart'; void main() { group('can serialize and deserialize', () { test('$BenchmarkResults', () { - final Map data = { + final data = { 'foo': >[ {'metric': 'foo.bar', 'value': 12.34, 'delta': -0.2}, {'metric': 'foo.baz', 'value': 10, 'delta': 3.3}, @@ -18,7 +18,7 @@ void main() { ], }; - final BenchmarkResults benchmarkResults = BenchmarkResults.parse(data); + final benchmarkResults = BenchmarkResults.parse(data); expect(benchmarkResults.scores.length, 2); final List fooBenchmarks = benchmarkResults.scores['foo']!; @@ -40,13 +40,13 @@ void main() { }); test('$BenchmarkScore', () { - final Map data = { + final data = { 'metric': 'foo', 'value': 1.234, 'delta': -0.4, }; - final BenchmarkScore score = BenchmarkScore.parse(data); + final score = BenchmarkScore.parse(data); expect(score.metric, 'foo'); expect(score.value, 1.234); expect(score.delta, -0.4); diff --git a/packages/web_benchmarks/testing/test_app/benchmark/test_infra/automator.dart b/packages/web_benchmarks/testing/test_app/benchmark/test_infra/automator.dart index 43823de83dd..35501f60fa6 100644 --- a/packages/web_benchmarks/testing/test_app/benchmark/test_infra/automator.dart +++ b/packages/web_benchmarks/testing/test_app/benchmark/test_infra/automator.dart @@ -82,7 +82,7 @@ class Automator { } Future _handleAppNavigate() async { - for (int i = 0; i < 10; ++i) { + for (var i = 0; i < 10; ++i) { print('Testing round $i...'); await controller.tap(find.byKey(aboutPageKey)); await animationStops(); @@ -103,7 +103,7 @@ class Automator { } Future _handleAppTap() async { - for (int i = 0; i < 10; ++i) { + for (var i = 0; i < 10; ++i) { print('Testing round $i...'); await controller.tap(find.byIcon(Icons.add)); await animationStops(); @@ -135,7 +135,7 @@ Future animationStops() async { return; } - final Completer stopped = Completer(); + final stopped = Completer(); Timer.periodic(_animationCheckingInterval, (Timer timer) { if (!WidgetsBinding.instance.hasScheduledFrame) { diff --git a/packages/web_benchmarks/testing/test_app/benchmark/web_benchmarks_test.dart b/packages/web_benchmarks/testing/test_app/benchmark/web_benchmarks_test.dart index 15845574c0b..6330f6b4f46 100644 --- a/packages/web_benchmarks/testing/test_app/benchmark/web_benchmarks_test.dart +++ b/packages/web_benchmarks/testing/test_app/benchmark/web_benchmarks_test.dart @@ -88,8 +88,8 @@ Future _runBenchmarks({ .map((BenchmarkMetric metric) => metric.label) .toList(); - for (final String benchmarkName in benchmarkNames) { - for (final String metricName in expectedMetrics) { + for (final benchmarkName in benchmarkNames) { + for (final metricName in expectedMetrics) { for (final BenchmarkMetricComputation computation in BenchmarkMetricComputation.values) { expect( diff --git a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart index aebfaaff445..6bcb42ed172 100644 --- a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart @@ -41,7 +41,7 @@ Future main() async { request.headers[HttpHeaders.authorizationHeader]; if (authHeader != null) { final String encodedCredential = authHeader.first.split(' ')[1]; - final String credential = String.fromCharCodes( + final credential = String.fromCharCodes( base64Decode(encodedCredential), ); if (credential == 'user:password') { @@ -66,16 +66,16 @@ Future main() async { request.response.close(); }), ); - final String prefixUrl = 'http://${server.address.address}:${server.port}'; - final String primaryUrl = '$prefixUrl/hello.txt'; - final String secondaryUrl = '$prefixUrl/secondary.txt'; - final String headersUrl = '$prefixUrl/headers'; - final String basicAuthUrl = '$prefixUrl/http-basic-authentication'; + final prefixUrl = 'http://${server.address.address}:${server.port}'; + final primaryUrl = '$prefixUrl/hello.txt'; + final secondaryUrl = '$prefixUrl/secondary.txt'; + final headersUrl = '$prefixUrl/headers'; + final basicAuthUrl = '$prefixUrl/http-basic-authentication'; testWidgets('loadRequest', (WidgetTester tester) async { - final Completer pageFinished = Completer(); + final pageFinished = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setNavigationDelegate( NavigationDelegate(onPageFinished: (_) => pageFinished.complete()), ); @@ -89,9 +89,9 @@ Future main() async { }); testWidgets('runJavaScriptReturningResult', (WidgetTester tester) async { - final Completer pageFinished = Completer(); + final pageFinished = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate(onPageFinished: (_) => pageFinished.complete()), @@ -109,13 +109,13 @@ Future main() async { }); testWidgets('loadRequest with headers', (WidgetTester tester) async { - final Map headers = { + final headers = { 'test_header': 'flutter_test_header', }; - final StreamController pageLoads = StreamController(); + final pageLoads = StreamController(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate(onPageFinished: (String url) => pageLoads.add(url)), @@ -127,7 +127,7 @@ Future main() async { await pageLoads.stream.firstWhere((String url) => url == headersUrl); - final String content = + final content = await controller.runJavaScriptReturningResult( 'document.documentElement.innerText', ) @@ -136,14 +136,14 @@ Future main() async { }); testWidgets('JavascriptChannel', (WidgetTester tester) async { - final Completer pageFinished = Completer(); - final WebViewController controller = WebViewController(); + final pageFinished = Completer(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate(onPageFinished: (_) => pageFinished.complete()), ); - final Completer channelCompleter = Completer(); + final channelCompleter = Completer(); await controller.addJavaScriptChannel( 'Echo', onMessageReceived: (JavaScriptMessage message) { @@ -164,11 +164,11 @@ Future main() async { }); testWidgets('resize webview', (WidgetTester tester) async { - final Completer initialResizeCompleter = Completer(); - final Completer buttonTapResizeCompleter = Completer(); - final Completer onPageFinished = Completer(); + final initialResizeCompleter = Completer(); + final buttonTapResizeCompleter = Completer(); + final onPageFinished = Completer(); - bool resizeButtonTapped = false; + var resizeButtonTapped = false; await tester.pumpWidget( ResizableWebView( onResize: () { @@ -198,9 +198,9 @@ Future main() async { }); testWidgets('set custom userAgent', (WidgetTester tester) async { - final Completer pageFinished = Completer(); + final pageFinished = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate(onPageFinished: (_) => pageFinished.complete()), @@ -221,7 +221,7 @@ Future main() async { () { testWidgets('Auto media playback', (WidgetTester tester) async { final String videoTestBase64 = await getTestVideoBase64(); - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); late PlatformWebViewControllerCreationParams params; if (defaultTargetPlatform == TargetPlatform.iOS) { @@ -232,7 +232,7 @@ Future main() async { params = const PlatformWebViewControllerCreationParams(); } - WebViewController controller = + var controller = WebViewController.fromPlatformCreationParams(params); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); @@ -255,7 +255,7 @@ Future main() async { await pageLoaded.future; - bool isPaused = + var isPaused = await controller.runJavaScriptReturningResult('isPaused();') as bool; expect(isPaused, false); @@ -286,8 +286,8 @@ Future main() async { testWidgets('Video plays inline', (WidgetTester tester) async { final String videoTestBase64 = await getTestVideoBase64(); - final Completer pageLoaded = Completer(); - final Completer videoPlaying = Completer(); + final pageLoaded = Completer(); + final videoPlaying = Completer(); late PlatformWebViewControllerCreationParams params; if (defaultTargetPlatform == TargetPlatform.iOS) { @@ -298,7 +298,7 @@ Future main() async { } else { params = const PlatformWebViewControllerCreationParams(); } - final WebViewController controller = + final controller = WebViewController.fromPlatformCreationParams(params); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); @@ -334,7 +334,7 @@ Future main() async { // Makes sure we get the correct event that indicates the video is actually playing. await videoPlaying.future; - final bool fullScreen = + final fullScreen = await controller.runJavaScriptReturningResult('isFullScreen();') as bool; expect(fullScreen, false); @@ -355,7 +355,7 @@ Future main() async { final String base64AudioData = base64Encode( Uint8List.view(audioData.buffer), ); - final String audioTest = + final audioTest = ''' Audio auto play @@ -381,7 +381,7 @@ Future main() async { }); testWidgets('Auto media playback', (WidgetTester tester) async { - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); late PlatformWebViewControllerCreationParams params; if (defaultTargetPlatform == TargetPlatform.iOS) { @@ -392,7 +392,7 @@ Future main() async { params = const PlatformWebViewControllerCreationParams(); } - WebViewController controller = + var controller = WebViewController.fromPlatformCreationParams(params); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( @@ -413,7 +413,7 @@ Future main() async { await pageLoaded.future; - bool isPaused = + var isPaused = await controller.runJavaScriptReturningResult('isPaused();') as bool; expect(isPaused, false); @@ -446,7 +446,7 @@ Future main() async { ); testWidgets('getTitle', (WidgetTester tester) async { - const String getTitleTest = ''' + const getTitleTest = ''' Some title @@ -457,9 +457,9 @@ Future main() async { final String getTitleTestBase64 = base64Encode( const Utf8Encoder().convert(getTitleTest), ); - final Completer pageLoaded = Completer(); + final pageLoaded = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate(onPageFinished: (_) => pageLoaded.complete()), @@ -486,7 +486,7 @@ Future main() async { 'Programmatic Scroll', () { testWidgets('setAndGetScrollPosition', (WidgetTester tester) async { - const String scrollTestPage = ''' + const scrollTestPage = ''' @@ -511,8 +511,8 @@ Future main() async { const Utf8Encoder().convert(scrollTestPage), ); - final Completer pageLoaded = Completer(); - final WebViewController controller = WebViewController(); + final pageLoaded = Completer(); + final controller = WebViewController(); ScrollPositionChange? recordedPosition; await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( @@ -539,8 +539,8 @@ Future main() async { Offset scrollPos = await controller.getScrollPosition(); // Check scrollTo() - const int X_SCROLL = 123; - const int Y_SCROLL = 321; + const X_SCROLL = 123; + const Y_SCROLL = 321; // Get the initial position; this ensures that scrollTo is actually // changing something, but also gives the native view's scroll position // time to settle. @@ -571,15 +571,15 @@ Future main() async { ); group('NavigationDelegate', () { - const String blankPage = ''; - final String blankPageEncoded = + const blankPage = ''; + final blankPageEncoded = 'data:text/html;charset=utf-8;base64,' '${base64Encode(const Utf8Encoder().convert(blankPage))}'; testWidgets('can allow requests', (WidgetTester tester) async { - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate( @@ -607,10 +607,10 @@ Future main() async { }); testWidgets('onWebResourceError', (WidgetTester tester) async { - final Completer errorCompleter = + final errorCompleter = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate( @@ -630,11 +630,11 @@ Future main() async { testWidgets('onWebResourceError is not called with valid url', ( WidgetTester tester, ) async { - final Completer errorCompleter = + final errorCompleter = Completer(); - final Completer pageFinishCompleter = Completer(); + final pageFinishCompleter = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate( @@ -655,9 +655,9 @@ Future main() async { }); testWidgets('can block requests', (WidgetTester tester) async { - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate( @@ -693,13 +693,13 @@ Future main() async { }); testWidgets('onHttpError', (WidgetTester tester) async { - final Completer errorCompleter = + final errorCompleter = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); - final NavigationDelegate delegate = NavigationDelegate( + final delegate = NavigationDelegate( onHttpError: (HttpResponseError error) { errorCompleter.complete(error); }, @@ -719,7 +719,7 @@ Future main() async { testWidgets('onHttpError is not called when no HTTP error is received', ( WidgetTester tester, ) async { - const String testPage = ''' + const testPage = ''' @@ -727,14 +727,14 @@ Future main() async { '''; - final Completer errorCompleter = + final errorCompleter = Completer(); - final Completer pageFinishCompleter = Completer(); + final pageFinishCompleter = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); - final NavigationDelegate delegate = NavigationDelegate( + final delegate = NavigationDelegate( onPageFinished: pageFinishCompleter.complete, onHttpError: (HttpResponseError error) { errorCompleter.complete(error); @@ -751,9 +751,9 @@ Future main() async { }); testWidgets('supports asynchronous decisions', (WidgetTester tester) async { - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate( @@ -784,9 +784,9 @@ Future main() async { }); testWidgets('can receive url changes', (WidgetTester tester) async { - final Completer pageLoaded = Completer(); + final pageLoaded = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate(onPageFinished: (_) => pageLoaded.complete()), @@ -797,7 +797,7 @@ Future main() async { await pageLoaded.future; - final Completer urlChangeCompleter = Completer(); + final urlChangeCompleter = Completer(); await controller.setNavigationDelegate( NavigationDelegate( onUrlChange: (UrlChange change) { @@ -814,13 +814,13 @@ Future main() async { testWidgets('can receive updates to history state', ( WidgetTester tester, ) async { - final Completer pageLoaded = Completer(); + final pageLoaded = Completer(); - final NavigationDelegate navigationDelegate = NavigationDelegate( + final navigationDelegate = NavigationDelegate( onPageFinished: (_) => pageLoaded.complete(), ); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate(navigationDelegate); await controller.loadRequest(Uri.parse(primaryUrl)); @@ -829,7 +829,7 @@ Future main() async { await pageLoaded.future; - final Completer urlChangeCompleter = Completer(); + final urlChangeCompleter = Completer(); await controller.setNavigationDelegate( NavigationDelegate( onUrlChange: (UrlChange change) { @@ -848,8 +848,8 @@ Future main() async { testWidgets('can receive HTTP basic auth requests', ( WidgetTester tester, ) async { - final Completer authRequested = Completer(); - final WebViewController controller = WebViewController(); + final authRequested = Completer(); + final controller = WebViewController(); await controller.setNavigationDelegate( NavigationDelegate( @@ -868,8 +868,8 @@ Future main() async { testWidgets('can authenticate to HTTP basic auth requests', ( WidgetTester tester, ) async { - final WebViewController controller = WebViewController(); - final Completer pageFinished = Completer(); + final controller = WebViewController(); + final pageFinished = Completer(); await controller.setNavigationDelegate( NavigationDelegate( @@ -892,9 +892,9 @@ Future main() async { testWidgets('target _blank opens in same window', ( WidgetTester tester, ) async { - final Completer pageLoaded = Completer(); + final pageLoaded = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate(onPageFinished: (_) => pageLoaded.complete()), @@ -909,9 +909,9 @@ Future main() async { }); testWidgets('can open new window and go back', (WidgetTester tester) async { - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate(onPageFinished: (_) => pageLoaded.complete()), @@ -936,9 +936,9 @@ Future main() async { }); testWidgets('clearLocalStorage', (WidgetTester tester) async { - Completer pageLoadCompleter = Completer(); + var pageLoadCompleter = Completer(); - final WebViewController controller = WebViewController(); + final controller = WebViewController(); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setNavigationDelegate( NavigationDelegate(onPageFinished: (_) => pageLoadCompleter.complete()), @@ -951,7 +951,7 @@ Future main() async { pageLoadCompleter = Completer(); await controller.runJavaScript('localStorage.setItem("myCat", "Tom");'); - final String myCatItem = + final myCatItem = await controller.runJavaScriptReturningResult( 'localStorage.getItem("myCat");', ) @@ -1089,7 +1089,7 @@ class ResizableWebViewState extends State { Future getTestVideoBase64() async { final ByteData videoData = await rootBundle.load('assets/sample_video.mp4'); final String base64VideoData = base64Encode(Uint8List.view(videoData.buffer)); - final String videoTest = + final videoTest = ''' Video auto play diff --git a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test_legacy.dart b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test_legacy.dart index ebcfe2ac24a..50cc079e6af 100644 --- a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test_legacy.dart +++ b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test_legacy.dart @@ -40,15 +40,15 @@ Future main() async { request.response.close(); }), ); - final String prefixUrl = 'http://${server.address.address}:${server.port}'; - final String primaryUrl = '$prefixUrl/hello.txt'; - final String secondaryUrl = '$prefixUrl/secondary.txt'; - final String headersUrl = '$prefixUrl/headers'; + final prefixUrl = 'http://${server.address.address}:${server.port}'; + final primaryUrl = '$prefixUrl/hello.txt'; + final secondaryUrl = '$prefixUrl/secondary.txt'; + final headersUrl = '$prefixUrl/headers'; testWidgets('initialUrl', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final Completer pageFinishedCompleter = Completer(); + final pageFinishedCompleter = Completer(); await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -71,9 +71,9 @@ Future main() async { }); testWidgets('loadUrl', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final StreamController pageLoads = StreamController(); + final pageLoads = StreamController(); await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -99,7 +99,7 @@ Future main() async { }); testWidgets('evaluateJavascript', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -121,10 +121,10 @@ Future main() async { }); testWidgets('loadUrl with headers', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final StreamController pageStarts = StreamController(); - final StreamController pageLoads = StreamController(); + final pageStarts = StreamController(); + final pageLoads = StreamController(); await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -145,7 +145,7 @@ Future main() async { ), ); final WebViewController controller = await controllerCompleter.future; - final Map headers = { + final headers = { 'test_header': 'flutter_test_header', }; await controller.loadUrl(headersUrl, headers: headers); @@ -160,11 +160,11 @@ Future main() async { }); testWidgets('JavascriptChannel', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final Completer pageStarted = Completer(); - final Completer pageLoaded = Completer(); - final Completer channelCompleter = Completer(); + final pageStarted = Completer(); + final pageLoaded = Completer(); + final channelCompleter = Completer(); await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -205,11 +205,11 @@ Future main() async { }); testWidgets('resize webview', (WidgetTester tester) async { - final Completer initialResizeCompleter = Completer(); - final Completer buttonTapResizeCompleter = Completer(); - final Completer onPageFinished = Completer(); + final initialResizeCompleter = Completer(); + final buttonTapResizeCompleter = Completer(); + final onPageFinished = Completer(); - bool resizeButtonTapped = false; + var resizeButtonTapped = false; await tester.pumpWidget( ResizableWebView( onResize: (_) { @@ -236,7 +236,7 @@ Future main() async { }); testWidgets('set custom userAgent', (WidgetTester tester) async { - final Completer controllerCompleter1 = + final controllerCompleter1 = Completer(); final GlobalKey globalKey = GlobalKey(); await tester.pumpWidget( @@ -276,7 +276,7 @@ Future main() async { testWidgets('use default platform userAgent after webView is rebuilt', ( WidgetTester tester, ) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); final GlobalKey globalKey = GlobalKey(); // Build the webView with no user agent to get the default platform user agent. @@ -330,9 +330,9 @@ Future main() async { 'Auto media playback', (WidgetTester tester) async { final String videoTestBase64 = await getTestVideoBase64(); - Completer controllerCompleter = + var controllerCompleter = Completer(); - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); await tester.pumpWidget( Directionality( @@ -396,9 +396,9 @@ Future main() async { 'Changes to initialMediaPlaybackPolicy are ignored', (WidgetTester tester) async { final String videoTestBase64 = await getTestVideoBase64(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); final GlobalKey key = GlobalKey(); await tester.pumpWidget( @@ -462,10 +462,10 @@ Future main() async { WidgetTester tester, ) async { final String videoTestBase64 = await getTestVideoBase64(); - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final Completer pageLoaded = Completer(); - final Completer videoPlaying = Completer(); + final pageLoaded = Completer(); + final videoPlaying = Completer(); await tester.pumpWidget( Directionality( @@ -521,7 +521,7 @@ Future main() async { final String base64AudioData = base64Encode( Uint8List.view(audioData.buffer), ); - final String audioTest = + final audioTest = ''' Audio auto play @@ -547,10 +547,10 @@ Future main() async { }); testWidgets('Auto media playback', (WidgetTester tester) async { - Completer controllerCompleter = + var controllerCompleter = Completer(); - Completer pageStarted = Completer(); - Completer pageLoaded = Completer(); + var pageStarted = Completer(); + var pageLoaded = Completer(); await tester.pumpWidget( Directionality( @@ -617,10 +617,10 @@ Future main() async { testWidgets('Changes to initialMediaPlaybackPolicy are ignored', ( WidgetTester tester, ) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - Completer pageStarted = Completer(); - Completer pageLoaded = Completer(); + var pageStarted = Completer(); + var pageLoaded = Completer(); final GlobalKey key = GlobalKey(); await tester.pumpWidget( @@ -686,7 +686,7 @@ Future main() async { }); testWidgets('getTitle', (WidgetTester tester) async { - const String getTitleTest = ''' + const getTitleTest = ''' Some title @@ -697,9 +697,9 @@ Future main() async { final String getTitleTestBase64 = base64Encode( const Utf8Encoder().convert(getTitleTest), ); - final Completer pageStarted = Completer(); - final Completer pageLoaded = Completer(); - final Completer controllerCompleter = + final pageStarted = Completer(); + final pageLoaded = Completer(); + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -737,7 +737,7 @@ Future main() async { group('Programmatic Scroll', () { testWidgets('setAndGetScrollPosition', (WidgetTester tester) async { - const String scrollTestPage = ''' + const scrollTestPage = ''' @@ -762,8 +762,8 @@ Future main() async { const Utf8Encoder().convert(scrollTestPage), ); - final Completer pageLoaded = Completer(); - final Completer controllerCompleter = + final pageLoaded = Completer(); + final controllerCompleter = Completer(); await tester.pumpWidget( @@ -791,8 +791,8 @@ Future main() async { int scrollPosY = await controller.getScrollY(); // Check scrollTo() - const int X_SCROLL = 123; - const int Y_SCROLL = 321; + const X_SCROLL = 123; + const Y_SCROLL = 321; // Get the initial position; this ensures that scrollTo is actually // changing something, but also gives the native view's scroll position // time to settle. @@ -825,9 +825,9 @@ Future main() async { }); testWidgets('initialUrl', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final Completer pageFinishedCompleter = Completer(); + final pageFinishedCompleter = Completer(); await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -851,15 +851,15 @@ Future main() async { }, skip: !Platform.isAndroid); group('NavigationDelegate', () { - const String blankPage = ''; - final String blankPageEncoded = + const blankPage = ''; + final blankPageEncoded = 'data:text/html;charset=utf-8;base64,' '${base64Encode(const Utf8Encoder().convert(blankPage))}'; testWidgets('can allow requests', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final StreamController pageLoads = + final pageLoads = StreamController.broadcast(); await tester.pumpWidget( Directionality( @@ -891,7 +891,7 @@ Future main() async { }); testWidgets('onWebResourceError', (WidgetTester tester) async { - final Completer errorCompleter = + final errorCompleter = Completer(); await tester.pumpWidget( @@ -925,9 +925,9 @@ Future main() async { testWidgets('onWebResourceError is not called with valid url', ( WidgetTester tester, ) async { - final Completer errorCompleter = + final errorCompleter = Completer(); - final Completer pageFinishCompleter = Completer(); + final pageFinishCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -951,7 +951,7 @@ Future main() async { testWidgets('onWebResourceError only called for main frame', ( WidgetTester tester, ) async { - const String iframeTest = ''' + const iframeTest = ''' @@ -966,9 +966,9 @@ Future main() async { const Utf8Encoder().convert(iframeTest), ); - final Completer errorCompleter = + final errorCompleter = Completer(); - final Completer pageFinishCompleter = Completer(); + final pageFinishCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -989,9 +989,9 @@ Future main() async { }); testWidgets('can block requests', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final StreamController pageLoads = + final pageLoads = StreamController.broadcast(); await tester.pumpWidget( Directionality( @@ -1031,9 +1031,9 @@ Future main() async { }); testWidgets('supports asynchronous decisions', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final StreamController pageLoads = + final pageLoads = StreamController.broadcast(); await tester.pumpWidget( Directionality( @@ -1071,7 +1071,7 @@ Future main() async { testWidgets('launches with gestureNavigationEnabled on iOS', ( WidgetTester tester, ) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -1098,9 +1098,9 @@ Future main() async { testWidgets('target _blank opens in same window', ( WidgetTester tester, ) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - final Completer pageLoaded = Completer(); + final pageLoaded = Completer(); await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -1124,9 +1124,9 @@ Future main() async { }); testWidgets('can open new window and go back', (WidgetTester tester) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -1162,10 +1162,10 @@ Future main() async { testWidgets('clearCache should clear local storage', ( WidgetTester tester, ) async { - final Completer controllerCompleter = + final controllerCompleter = Completer(); - Completer pageLoadCompleter = Completer(); + var pageLoadCompleter = Completer(); await tester.pumpWidget( Directionality( @@ -1335,7 +1335,7 @@ class ResizableWebViewState extends State { Future getTestVideoBase64() async { final ByteData videoData = await rootBundle.load('assets/sample_video.mp4'); final String base64VideoData = base64Encode(Uint8List.view(videoData.buffer)); - final String videoTest = + final videoTest = ''' Video auto play diff --git a/packages/webview_flutter/webview_flutter/example/lib/main.dart b/packages/webview_flutter/webview_flutter/example/lib/main.dart index 4741122a5e9..fc7b2bc4edb 100644 --- a/packages/webview_flutter/webview_flutter/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter/example/lib/main.dart @@ -135,7 +135,7 @@ class _WebViewExampleState extends State { params = const PlatformWebViewControllerCreationParams(); } - final WebViewController controller = + final controller = WebViewController.fromPlatformCreationParams(params); // #enddocregion platform_features @@ -238,9 +238,9 @@ Page resource error: } Future openDialog(HttpAuthRequest httpRequest) async { - final TextEditingController usernameTextController = + final usernameTextController = TextEditingController(); - final TextEditingController passwordTextController = + final passwordTextController = TextEditingController(); return showDialog( @@ -431,7 +431,7 @@ class SampleMenu extends StatelessWidget { } Future _onListCookies(BuildContext context) async { - final String cookies = + final cookies = await webViewController.runJavaScriptReturningResult('document.cookie') as String; if (context.mounted) { @@ -479,7 +479,7 @@ class SampleMenu extends StatelessWidget { Future _onClearCookies(BuildContext context) async { final bool hadCookies = await cookieManager.clearCookies(); - String message = 'There were cookies. Now, they are gone!'; + var message = 'There were cookies. Now, they are gone!'; if (!hadCookies) { message = 'There are no cookies.'; } @@ -556,7 +556,7 @@ class SampleMenu extends StatelessWidget { static Future _prepareLocalFile() async { final String tmpDir = (await getTemporaryDirectory()).path; - final File indexFile = File( + final indexFile = File( {tmpDir, 'www', 'index.html'}.join(Platform.pathSeparator), ); @@ -579,7 +579,7 @@ class SampleMenu extends StatelessWidget { } Future _promptForUrl(BuildContext context) { - final TextEditingController urlTextController = TextEditingController(); + final urlTextController = TextEditingController(); return showDialog( context: context, 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 b9c1512abc7..19b74d5e530 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/legacy/webview.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/legacy/webview.dart @@ -340,7 +340,7 @@ class _WebViewState extends State { } void _onWebViewPlatformCreated(WebViewPlatformController? webViewPlatform) { - final WebViewController controller = WebViewController._( + final controller = WebViewController._( widget, webViewPlatform!, _javascriptChannelRegistry, @@ -406,7 +406,7 @@ WebSettings _clearUnchangedWebSettings( bool? hasNavigationDelegate; bool? hasProgressTracking; bool? debuggingEnabled; - WebSetting userAgent = const WebSetting.absent(); + var userAgent = const WebSetting.absent(); bool? zoomEnabled; if (currentValue.javascriptMode != newValue.javascriptMode) { javascriptMode = newValue.javascriptMode; @@ -454,7 +454,7 @@ class _PlatformCallbacksHandler implements WebViewPlatformCallbacksHandler { required String url, required bool isForMainFrame, }) async { - final NavigationRequest request = NavigationRequest._( + final request = NavigationRequest._( url: url, isForMainFrame: isForMainFrame, ); diff --git a/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.dart index 8a8967dc2e1..5932bfe4613 100644 --- a/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.dart @@ -41,7 +41,7 @@ void main() { gestureRecognizers: anyNamed('gestureRecognizers'), ), ).thenAnswer((Invocation invocation) { - final WebViewPlatformCreatedCallback onWebViewPlatformCreated = + final onWebViewPlatformCreated = invocation.namedArguments[const Symbol('onWebViewPlatformCreated')] as WebViewPlatformCreatedCallback; return TestPlatformWebView( @@ -65,7 +65,7 @@ void main() { testWidgets('Initial url', (WidgetTester tester) async { await tester.pumpWidget(const WebView(initialUrl: 'https://youtube.com')); - final CreationParams params = + final params = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -77,7 +77,7 @@ void main() { const WebView(javascriptMode: JavascriptMode.unrestricted), ); - final CreationParams unrestrictedparams = + final unrestrictedparams = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -88,7 +88,7 @@ void main() { await tester.pumpWidget(const WebView()); - final CreationParams disabledparams = + final disabledparams = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -256,7 +256,7 @@ void main() { expect(controller, isNotNull); - final CreationParams params = + final params = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -278,7 +278,7 @@ void main() { expect(controller, isNotNull); - final Map headers = { + final headers = { 'CACHE-CONTROL': 'ABC', }; await controller!.loadUrl('https://flutter.io', headers: headers); @@ -302,7 +302,7 @@ void main() { ); expect(controller, isNotNull); - final WebViewRequest req = WebViewRequest( + final req = WebViewRequest( uri: Uri.parse('https://flutter.dev'), method: WebViewRequestMethod.post, headers: {'foo': 'bar'}, @@ -549,20 +549,20 @@ void main() { testWidgets('Cookies can be cleared once', (WidgetTester tester) async { await tester.pumpWidget(const WebView(initialUrl: 'https://flutter.io')); - final CookieManager cookieManager = CookieManager(); + final cookieManager = CookieManager(); final bool hasCookies = await cookieManager.clearCookies(); expect(hasCookies, true); }); testWidgets('Cookies can be set', (WidgetTester tester) async { - const WebViewCookie cookie = WebViewCookie( + const cookie = WebViewCookie( name: 'foo', value: 'bar', domain: 'flutter.dev', ); await tester.pumpWidget(const WebView(initialUrl: 'https://flutter.io')); - final CookieManager cookieManager = CookieManager(); + final cookieManager = CookieManager(); await cookieManager.setCookie(cookie); expect(mockWebViewCookieManagerPlatform.setCookieCalls, [ cookie, @@ -586,7 +586,7 @@ void main() { ), ); - final CreationParams params = + final params = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -671,7 +671,7 @@ void main() { ), ); - final JavascriptChannelRegistry channelRegistry = + final channelRegistry = captureBuildArgs( mockWebViewPlatform, javascriptChannelRegistry: true, @@ -717,7 +717,7 @@ void main() { ), ); - final JavascriptChannelRegistry channelRegistry = + final channelRegistry = captureBuildArgs( mockWebViewPlatform, javascriptChannelRegistry: true, @@ -728,8 +728,8 @@ void main() { }); testWidgets('JavaScript channel messages', (WidgetTester tester) async { - final List ttsMessagesReceived = []; - final List alarmMessagesReceived = []; + final ttsMessagesReceived = []; + final alarmMessagesReceived = []; await tester.pumpWidget( WebView( initialUrl: 'https://youtube.com', @@ -750,7 +750,7 @@ void main() { ), ); - final JavascriptChannelRegistry channelRegistry = + final channelRegistry = captureBuildArgs( mockWebViewPlatform, javascriptChannelRegistry: true, @@ -779,7 +779,7 @@ void main() { ), ); - final WebViewPlatformCallbacksHandler handler = + final handler = captureBuildArgs( mockWebViewPlatform, webViewPlatformCallbacksHandler: true, @@ -794,7 +794,7 @@ void main() { testWidgets('onPageStarted is null', (WidgetTester tester) async { await tester.pumpWidget(const WebView(initialUrl: 'https://youtube.com')); - final WebViewPlatformCallbacksHandler handler = + final handler = captureBuildArgs( mockWebViewPlatform, webViewPlatformCallbacksHandler: true, @@ -825,7 +825,7 @@ void main() { ), ); - final WebViewPlatformCallbacksHandler handler = + final handler = captureBuildArgs( mockWebViewPlatform, webViewPlatformCallbacksHandler: true, @@ -850,7 +850,7 @@ void main() { ), ); - final WebViewPlatformCallbacksHandler handler = + final handler = captureBuildArgs( mockWebViewPlatform, webViewPlatformCallbacksHandler: true, @@ -864,7 +864,7 @@ void main() { testWidgets('onPageFinished is null', (WidgetTester tester) async { await tester.pumpWidget(const WebView(initialUrl: 'https://youtube.com')); - final WebViewPlatformCallbacksHandler handler = + final handler = captureBuildArgs( mockWebViewPlatform, webViewPlatformCallbacksHandler: true, @@ -894,7 +894,7 @@ void main() { ), ); - final WebViewPlatformCallbacksHandler handler = + final handler = captureBuildArgs( mockWebViewPlatform, webViewPlatformCallbacksHandler: true, @@ -919,7 +919,7 @@ void main() { ), ); - final WebViewPlatformCallbacksHandler handler = + final handler = captureBuildArgs( mockWebViewPlatform, webViewPlatformCallbacksHandler: true, @@ -933,7 +933,7 @@ void main() { testWidgets('onLoadingProgress is null', (WidgetTester tester) async { await tester.pumpWidget(const WebView(initialUrl: 'https://youtube.com')); - final WebViewPlatformCallbacksHandler handler = + final handler = captureBuildArgs( mockWebViewPlatform, webViewPlatformCallbacksHandler: true, @@ -963,7 +963,7 @@ void main() { ), ); - final WebViewPlatformCallbacksHandler handler = + final handler = captureBuildArgs( mockWebViewPlatform, webViewPlatformCallbacksHandler: true, @@ -979,7 +979,7 @@ void main() { testWidgets('hasNavigationDelegate', (WidgetTester tester) async { await tester.pumpWidget(const WebView(initialUrl: 'https://youtube.com')); - final CreationParams params = + final params = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -993,7 +993,7 @@ void main() { ), ); - final WebSettings updateSettings = + final updateSettings = verify( mockWebViewPlatformController.updateSettings(captureAny), ).captured.single @@ -1003,7 +1003,7 @@ void main() { }); testWidgets('Block navigation', (WidgetTester tester) async { - final List navigationRequests = []; + final navigationRequests = []; await tester.pumpWidget( WebView( @@ -1024,10 +1024,10 @@ void main() { webViewPlatformCallbacksHandler: true, ); - final CreationParams params = args[0] as CreationParams; + final params = args[0] as CreationParams; expect(params.webSettings!.hasNavigationDelegate, true); - final WebViewPlatformCallbacksHandler handler = + final handler = args[1] as WebViewPlatformCallbacksHandler; // The navigation delegate only allows navigation to https://flutter.dev @@ -1058,7 +1058,7 @@ void main() { testWidgets('enable debugging', (WidgetTester tester) async { await tester.pumpWidget(const WebView(debuggingEnabled: true)); - final CreationParams params = + final params = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -1068,7 +1068,7 @@ void main() { testWidgets('defaults to false', (WidgetTester tester) async { await tester.pumpWidget(const WebView()); - final CreationParams params = + final params = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -1081,7 +1081,7 @@ void main() { await tester.pumpWidget(WebView(key: key, debuggingEnabled: true)); - final WebSettings enabledSettings = + final enabledSettings = verify( mockWebViewPlatformController.updateSettings(captureAny), ).captured.last @@ -1090,7 +1090,7 @@ void main() { await tester.pumpWidget(WebView(key: key)); - final WebSettings disabledSettings = + final disabledSettings = verify( mockWebViewPlatformController.updateSettings(captureAny), ).captured.last @@ -1103,7 +1103,7 @@ void main() { testWidgets('Enable zoom', (WidgetTester tester) async { await tester.pumpWidget(const WebView()); - final CreationParams params = + final params = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -1113,7 +1113,7 @@ void main() { testWidgets('defaults to true', (WidgetTester tester) async { await tester.pumpWidget(const WebView()); - final CreationParams params = + final params = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -1126,7 +1126,7 @@ void main() { await tester.pumpWidget(WebView(key: key)); - final WebSettings enabledSettings = + final enabledSettings = verify( mockWebViewPlatformController.updateSettings(captureAny), ).captured.last @@ -1136,7 +1136,7 @@ void main() { await tester.pumpWidget(WebView(key: key, zoomEnabled: false)); - final WebSettings disabledSettings = + final disabledSettings = verify( mockWebViewPlatformController.updateSettings(captureAny), ).captured.last @@ -1149,7 +1149,7 @@ void main() { testWidgets('Defaults to null', (WidgetTester tester) async { await tester.pumpWidget(const WebView()); - final CreationParams params = + final params = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -1157,11 +1157,11 @@ void main() { }); testWidgets('Can be transparent', (WidgetTester tester) async { - const Color transparentColor = Color(0x00000000); + const transparentColor = Color(0x00000000); await tester.pumpWidget(const WebView(backgroundColor: transparentColor)); - final CreationParams params = + final params = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -1185,7 +1185,7 @@ void main() { ), ); - final MyWebViewPlatform builder = WebView.platform as MyWebViewPlatform; + final builder = WebView.platform as MyWebViewPlatform; final MyWebViewPlatformController platform = builder.lastPlatformBuilt!; expect( @@ -1217,10 +1217,10 @@ void main() { ), ); - final MyWebViewPlatform builder = WebView.platform as MyWebViewPlatform; + final builder = WebView.platform as MyWebViewPlatform; final MyWebViewPlatformController platform = builder.lastPlatformBuilt!; - final Map headers = {'header': 'value'}; + final headers = {'header': 'value'}; await controller.loadUrl('https://google.com', headers: headers); @@ -1237,7 +1237,7 @@ void main() { ), ); - final CreationParams params = + final params = captureBuildArgs(mockWebViewPlatform, creationParams: true).single as CreationParams; @@ -1251,7 +1251,7 @@ void main() { ), ); - final WebSettings settings = + final settings = verify( mockWebViewPlatformController.updateSettings(captureAny), ).captured.last diff --git a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart index 9ca4f52ab3c..70a723f081c 100644 --- a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart @@ -25,7 +25,7 @@ void main() { return NavigationDecision.navigate; } - final NavigationDelegate delegate = NavigationDelegate( + final delegate = NavigationDelegate( onNavigationRequest: onNavigationRequest, ); @@ -37,7 +37,7 @@ void main() { void onPageStarted(String url) {} - final NavigationDelegate delegate = NavigationDelegate( + final delegate = NavigationDelegate( onPageStarted: onPageStarted, ); @@ -49,7 +49,7 @@ void main() { void onPageFinished(String url) {} - final NavigationDelegate delegate = NavigationDelegate( + final delegate = NavigationDelegate( onPageFinished: onPageFinished, ); @@ -61,7 +61,7 @@ void main() { void onProgress(int progress) {} - final NavigationDelegate delegate = NavigationDelegate( + final delegate = NavigationDelegate( onProgress: onProgress, ); @@ -73,7 +73,7 @@ void main() { void onWebResourceError(WebResourceError error) {} - final NavigationDelegate delegate = NavigationDelegate( + final delegate = NavigationDelegate( onWebResourceError: onWebResourceError, ); @@ -85,7 +85,7 @@ void main() { void onUrlChange(UrlChange change) {} - final NavigationDelegate delegate = NavigationDelegate( + final delegate = NavigationDelegate( onUrlChange: onUrlChange, ); @@ -97,7 +97,7 @@ void main() { void onHttpAuthRequest(HttpAuthRequest request) {} - final NavigationDelegate delegate = NavigationDelegate( + final delegate = NavigationDelegate( onHttpAuthRequest: onHttpAuthRequest, ); @@ -109,7 +109,7 @@ void main() { void onHttpError(HttpResponseError error) {} - final NavigationDelegate delegate = NavigationDelegate( + final delegate = NavigationDelegate( onHttpError: onHttpError, ); @@ -119,20 +119,20 @@ void main() { test('onSslAuthError', () async { WebViewPlatform.instance = TestWebViewPlatform(); - final NavigationDelegate delegate = NavigationDelegate( + final delegate = NavigationDelegate( onSslAuthError: expectAsync1((SslAuthError error) { error.proceed(); }), ); - final void Function(PlatformSslAuthError) callback = + final callback = verify( (delegate.platform as MockPlatformNavigationDelegate) .setOnSSlAuthError(captureAny), ).captured.single as void Function(PlatformSslAuthError); - final MockPlatformSslAuthError mockPlatformError = + final mockPlatformError = MockPlatformSslAuthError(); callback(mockPlatformError); diff --git a/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart b/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart index 2dc225ba6bc..fef39627828 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart @@ -16,10 +16,10 @@ import 'webview_controller_test.mocks.dart'; @GenerateMocks([PlatformWebViewController, PlatformNavigationDelegate]) void main() { test('loadFile', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -28,10 +28,10 @@ void main() { }); test('loadFlutterAsset', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -40,10 +40,10 @@ void main() { }); test('loadHtmlString', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -54,10 +54,10 @@ void main() { }); test('loadRequest', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -68,7 +68,7 @@ void main() { body: Uint8List(0), ); - final LoadRequestParams params = + final params = verify( mockPlatformWebViewController.loadRequest(captureAny), ).captured[0] @@ -80,13 +80,13 @@ void main() { }); test('currentUrl', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); when( mockPlatformWebViewController.currentUrl(), ).thenAnswer((_) => Future.value('https://dart.dev')); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -97,13 +97,13 @@ void main() { }); test('canGoBack', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); when( mockPlatformWebViewController.canGoBack(), ).thenAnswer((_) => Future.value(false)); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -111,13 +111,13 @@ void main() { }); test('canGoForward', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); when( mockPlatformWebViewController.canGoForward(), ).thenAnswer((_) => Future.value(true)); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -125,10 +125,10 @@ void main() { }); test('goBack', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -137,10 +137,10 @@ void main() { }); test('goForward', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -149,10 +149,10 @@ void main() { }); test('reload', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -161,10 +161,10 @@ void main() { }); test('clearCache', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -173,10 +173,10 @@ void main() { }); test('clearLocalStorage', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -185,10 +185,10 @@ void main() { }); test('runJavaScript', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -197,13 +197,13 @@ void main() { }); test('runJavaScriptReturningResult', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); when( mockPlatformWebViewController.runJavaScriptReturningResult('1 + 1'), ).thenAnswer((_) => Future.value('2')); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -214,10 +214,10 @@ void main() { }); test('addJavaScriptChannel', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -227,7 +227,7 @@ void main() { onMessageReceived: onMessageReceived, ); - final JavaScriptChannelParams params = + final params = verify( mockPlatformWebViewController.addJavaScriptChannel(captureAny), ).captured[0] @@ -237,10 +237,10 @@ void main() { }); test('removeJavaScriptChannel', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -249,13 +249,13 @@ void main() { }); test('getTitle', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); when( mockPlatformWebViewController.getTitle(), ).thenAnswer((_) => Future.value('myTitle')); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -263,10 +263,10 @@ void main() { }); test('scrollTo', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -275,10 +275,10 @@ void main() { }); test('scrollBy', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -287,10 +287,10 @@ void main() { }); test('setVerticalScrollBarEnabled', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -299,10 +299,10 @@ void main() { }); test('setHorizontalScrollBarEnabled', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -311,13 +311,13 @@ void main() { }); test('supportsSetScrollBarsEnabled', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); when( mockPlatformWebViewController.supportsSetScrollBarsEnabled(), ).thenReturn(true); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -326,13 +326,13 @@ void main() { }); test('getScrollPosition', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); when( mockPlatformWebViewController.getScrollPosition(), ).thenAnswer((_) => Future.value(const Offset(2, 3))); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -343,10 +343,10 @@ void main() { }); test('enableZoom', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -355,10 +355,10 @@ void main() { }); test('setBackgroundColor', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -367,10 +367,10 @@ void main() { }); test('setJavaScriptMode', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -381,10 +381,10 @@ void main() { }); test('setUserAgent', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -393,15 +393,15 @@ void main() { }); test('setNavigationDelegate', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); - final MockPlatformNavigationDelegate mockPlatformNavigationDelegate = + final mockPlatformNavigationDelegate = MockPlatformNavigationDelegate(); - final NavigationDelegate navigationDelegate = + final navigationDelegate = NavigationDelegate.fromPlatform(mockPlatformNavigationDelegate); await webViewController.setNavigationDelegate(navigationDelegate); @@ -413,9 +413,9 @@ void main() { }); test('onPermissionRequest', () async { - bool permissionRequestCallbackCalled = false; + var permissionRequestCallbackCalled = false; - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); WebViewController.fromPlatform( mockPlatformWebViewController, @@ -424,8 +424,7 @@ void main() { }, ); - final void Function(PlatformWebViewPermissionRequest request) - requestCallback = + final requestCallback = verify( mockPlatformWebViewController.setOnPlatformPermissionRequest( captureAny, @@ -438,10 +437,10 @@ void main() { }); test('setConsoleLogCallback', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -453,10 +452,10 @@ void main() { }); test('setOnJavaScriptAlertDialog', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -475,10 +474,10 @@ void main() { }); test('setOnJavaScriptConfirmDialog', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -499,10 +498,10 @@ void main() { }); test('setOnJavaScriptTextInputDialog', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -523,26 +522,26 @@ void main() { }); test('getUserAgent', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - const String userAgent = 'str'; + const userAgent = 'str'; when( mockPlatformWebViewController.getUserAgent(), ).thenAnswer((_) => Future.value(userAgent)); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); await expectLater(webViewController.getUserAgent(), completion(userAgent)); }); test('setOnScrollPositionChange', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); @@ -558,10 +557,10 @@ void main() { }); test('setOverScrollMode', () async { - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = WebViewController.fromPlatform( + final webViewController = WebViewController.fromPlatform( mockPlatformWebViewController, ); diff --git a/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.dart b/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.dart index 68dc869ae1c..ec5b3590fea 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.dart @@ -14,26 +14,26 @@ import 'webview_cookie_manager_test.mocks.dart'; void main() { group('WebViewCookieManager', () { test('clearCookies', () async { - final MockPlatformWebViewCookieManager mockPlatformWebViewCookieManager = + final mockPlatformWebViewCookieManager = MockPlatformWebViewCookieManager(); when( mockPlatformWebViewCookieManager.clearCookies(), ).thenAnswer((_) => Future.value(false)); - final WebViewCookieManager cookieManager = + final cookieManager = WebViewCookieManager.fromPlatform(mockPlatformWebViewCookieManager); await expectLater(cookieManager.clearCookies(), completion(false)); }); test('setCookie', () async { - final MockPlatformWebViewCookieManager mockPlatformWebViewCookieManager = + final mockPlatformWebViewCookieManager = MockPlatformWebViewCookieManager(); - final WebViewCookieManager cookieManager = + final cookieManager = WebViewCookieManager.fromPlatform(mockPlatformWebViewCookieManager); - const WebViewCookie cookie = WebViewCookie( + const cookie = WebViewCookie( name: 'name', value: 'value', domain: 'domain', @@ -41,7 +41,7 @@ void main() { await cookieManager.setCookie(cookie); - final WebViewCookie capturedCookie = + final capturedCookie = verify( mockPlatformWebViewCookieManager.setCookie(captureAny), ).captured.single diff --git a/packages/webview_flutter/webview_flutter/test/webview_widget_test.dart b/packages/webview_flutter/webview_flutter/test/webview_widget_test.dart index fba3a56ff95..34cd03b42ad 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_widget_test.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_widget_test.dart @@ -19,7 +19,7 @@ void main() { group('WebViewWidget', () { testWidgets('build', (WidgetTester tester) async { - final MockPlatformWebViewWidget mockPlatformWebViewWidget = + final mockPlatformWebViewWidget = MockPlatformWebViewWidget(); when(mockPlatformWebViewWidget.build(any)).thenReturn(Container()); @@ -35,12 +35,12 @@ void main() { (WidgetTester tester) async { WebViewPlatform.instance = TestWebViewPlatform(); - final MockPlatformWebViewController mockPlatformWebViewController = + final mockPlatformWebViewController = MockPlatformWebViewController(); - final WebViewController webViewController = + final webViewController = WebViewController.fromPlatform(mockPlatformWebViewController); - final WebViewWidget webViewWidget = WebViewWidget( + final webViewWidget = WebViewWidget( key: GlobalKey(), controller: webViewController, layoutDirection: TextDirection.rtl, diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index 1579e6a8d0c..5d3805fa536 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -41,7 +41,7 @@ Future main() async { } else if (request.uri.path == '/favicon.ico') { request.response.statusCode = HttpStatus.notFound; } else if (request.uri.path == '/http-basic-authentication') { - final bool isAuthenticating = request.headers['Authorization'] != null; + final isAuthenticating = request.headers['Authorization'] != null; if (isAuthenticating) { request.response.writeln('Authorized'); } else { @@ -57,19 +57,19 @@ Future main() async { request.response.close(); }), ); - final String prefixUrl = 'http://${server.address.address}:${server.port}'; - final String primaryUrl = '$prefixUrl/hello.txt'; - final String secondaryUrl = '$prefixUrl/secondary.txt'; - final String headersUrl = '$prefixUrl/headers'; - final String basicAuthUrl = '$prefixUrl/http-basic-authentication'; + final prefixUrl = 'http://${server.address.address}:${server.port}'; + final primaryUrl = '$prefixUrl/hello.txt'; + final secondaryUrl = '$prefixUrl/secondary.txt'; + final headersUrl = '$prefixUrl/headers'; + final basicAuthUrl = '$prefixUrl/http-basic-authentication'; testWidgets('loadRequest', (WidgetTester tester) async { - final Completer pageFinished = Completer(); + final pageFinished = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageFinished.complete()); @@ -95,8 +95,8 @@ Future main() async { testWidgets( 'withWeakRefenceTo allows encapsulating class to be garbage collected', (WidgetTester tester) async { - final Completer gcCompleter = Completer(); - final android_webkit.PigeonInstanceManager instanceManager = + final gcCompleter = Completer(); + final instanceManager = android_webkit.PigeonInstanceManager( onWeakReferenceRemoved: gcCompleter.complete, ); @@ -122,10 +122,10 @@ Future main() async { testWidgets( 'WebView is released by garbage collection', (WidgetTester tester) async { - final Completer webViewGCCompleter = Completer(); + final webViewGCCompleter = Completer(); - const int webViewToken = -1; - final Finalizer finalizer = Finalizer((int token) { + const webViewToken = -1; + final finalizer = Finalizer((int token) { if (token == webViewToken) { webViewGCCompleter.complete(); } @@ -150,7 +150,7 @@ Future main() async { )? onScrollChanged, }) { - final android_webkit.WebView webView = + final webView = android_webkit.WebView( onScrollChanged: onScrollChanged, ); @@ -197,13 +197,13 @@ Future main() async { ); testWidgets('runJavaScriptReturningResult', (WidgetTester tester) async { - final Completer pageFinished = Completer(); + final pageFinished = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageFinished.complete()); @@ -229,17 +229,17 @@ Future main() async { }); testWidgets('loadRequest with headers', (WidgetTester tester) async { - final Map headers = { + final headers = { 'test_header': 'flutter_test_header', }; - final StreamController pageLoads = StreamController(); + final pageLoads = StreamController(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((String url) => pageLoads.add(url)); @@ -260,7 +260,7 @@ Future main() async { await pageLoads.stream.firstWhere((String url) => url == headersUrl); - final String content = + final content = await controller.runJavaScriptReturningResult( 'document.documentElement.innerText', ) @@ -269,19 +269,19 @@ Future main() async { }); testWidgets('JavascriptChannel', (WidgetTester tester) async { - final Completer pageFinished = Completer(); + final pageFinished = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageFinished.complete()); await controller.setPlatformNavigationDelegate(delegate); - final Completer channelCompleter = Completer(); + final channelCompleter = Completer(); await controller.addJavaScriptChannel( JavaScriptChannelParams( name: 'Echo', @@ -312,11 +312,11 @@ Future main() async { }); testWidgets('resize webview', (WidgetTester tester) async { - final Completer initialResizeCompleter = Completer(); - final Completer buttonTapResizeCompleter = Completer(); - final Completer onPageFinished = Completer(); + final initialResizeCompleter = Completer(); + final buttonTapResizeCompleter = Completer(); + final onPageFinished = Completer(); - bool resizeButtonTapped = false; + var resizeButtonTapped = false; await tester.pumpWidget( ResizableWebView( onResize: () { @@ -346,14 +346,14 @@ Future main() async { }); testWidgets('set custom userAgent', (WidgetTester tester) async { - final Completer pageFinished = Completer(); + final pageFinished = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setUserAgent('Custom_User_Agent1'); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageFinished.complete()); @@ -388,7 +388,7 @@ Future main() async { final String base64VideoData = base64Encode( Uint8List.view(videoData.buffer), ); - final String videoTest = + final videoTest = ''' Video auto play @@ -448,14 +448,14 @@ Future main() async { }); testWidgets('Auto media playback', (WidgetTester tester) async { - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); - AndroidWebViewController controller = AndroidWebViewController( + var controller = AndroidWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setMediaPlaybackRequiresUserGesture(false); - AndroidNavigationDelegate delegate = AndroidNavigationDelegate( + var delegate = AndroidNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -481,7 +481,7 @@ Future main() async { await pageLoaded.future; - bool isPaused = + var isPaused = await controller.runJavaScriptReturningResult('isPaused();') as bool; expect(isPaused, false); @@ -522,15 +522,15 @@ Future main() async { }); testWidgets('Video plays inline', (WidgetTester tester) async { - final Completer pageLoaded = Completer(); - final Completer videoPlaying = Completer(); + final pageLoaded = Completer(); + final videoPlaying = Completer(); - final AndroidWebViewController controller = AndroidWebViewController( + final controller = AndroidWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setMediaPlaybackRequiresUserGesture(false); - final AndroidNavigationDelegate delegate = AndroidNavigationDelegate( + final delegate = AndroidNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -584,16 +584,16 @@ Future main() async { }); testWidgets('Video plays fullscreen', (WidgetTester tester) async { - final Completer fullscreenEntered = Completer(); - final Completer fullscreenExited = Completer(); - final Completer pageLoaded = Completer(); + final fullscreenEntered = Completer(); + final fullscreenExited = Completer(); + final pageLoaded = Completer(); - final AndroidWebViewController controller = AndroidWebViewController( + final controller = AndroidWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setMediaPlaybackRequiresUserGesture(false); - final AndroidNavigationDelegate delegate = AndroidNavigationDelegate( + final delegate = AndroidNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -656,7 +656,7 @@ Future main() async { final String base64AudioData = base64Encode( Uint8List.view(audioData.buffer), ); - final String audioTest = + final audioTest = ''' Audio auto play @@ -682,14 +682,14 @@ Future main() async { }); testWidgets('Auto media playback', (WidgetTester tester) async { - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); - AndroidWebViewController controller = AndroidWebViewController( + var controller = AndroidWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); await controller.setMediaPlaybackRequiresUserGesture(false); - AndroidNavigationDelegate delegate = AndroidNavigationDelegate( + var delegate = AndroidNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -715,7 +715,7 @@ Future main() async { await pageLoaded.future; - bool isPaused = + var isPaused = await controller.runJavaScriptReturningResult('isPaused();') as bool; expect(isPaused, false); @@ -756,7 +756,7 @@ Future main() async { }); testWidgets('getTitle', (WidgetTester tester) async { - const String getTitleTest = ''' + const getTitleTest = ''' Some title @@ -767,13 +767,13 @@ Future main() async { final String getTitleTestBase64 = base64Encode( const Utf8Encoder().convert(getTitleTest), ); - final Completer pageLoaded = Completer(); + final pageLoaded = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -813,7 +813,7 @@ Future main() async { testWidgets('setAndGetAndListenScrollPosition', ( WidgetTester tester, ) async { - const String scrollTestPage = ''' + const scrollTestPage = ''' @@ -838,13 +838,13 @@ Future main() async { const Utf8Encoder().convert(scrollTestPage), ); - final Completer pageLoaded = Completer(); + final pageLoaded = Completer(); ScrollPositionChange? recordedPosition; - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -880,8 +880,8 @@ Future main() async { Offset scrollPos = await controller.getScrollPosition(); // Check scrollTo() - const int X_SCROLL = 123; - const int Y_SCROLL = 321; + const X_SCROLL = 123; + const Y_SCROLL = 321; // Get the initial position; this ensures that scrollTo is actually // changing something, but also gives the native view's scroll position // time to settle. @@ -907,19 +907,19 @@ Future main() async { }); group('NavigationDelegate', () { - const String blankPage = ''; - final String blankPageEncoded = + const blankPage = ''; + final blankPageEncoded = 'data:text/html;charset=utf-8;base64,' '${base64Encode(const Utf8Encoder().convert(blankPage))}'; testWidgets('can allow requests', (WidgetTester tester) async { - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -957,14 +957,14 @@ Future main() async { }); testWidgets('onWebResourceError', (WidgetTester tester) async { - final Completer errorCompleter = + final errorCompleter = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnWebResourceError((WebResourceError error) { @@ -996,15 +996,15 @@ Future main() async { testWidgets('onWebResourceError is not called with valid url', ( WidgetTester tester, ) async { - final Completer errorCompleter = + final errorCompleter = Completer(); - final Completer pageFinishCompleter = Completer(); + final pageFinishCompleter = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageFinishCompleter.complete()); @@ -1035,14 +1035,14 @@ Future main() async { }); testWidgets('onHttpError', (WidgetTester tester) async { - final Completer errorCompleter = + final errorCompleter = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnHttpError((HttpResponseError error) { @@ -1072,7 +1072,7 @@ Future main() async { testWidgets('onHttpError is not called when no HTTP error is received', ( WidgetTester tester, ) async { - const String testPage = ''' + const testPage = ''' @@ -1080,15 +1080,15 @@ Future main() async { '''; - final Completer errorCompleter = + final errorCompleter = Completer(); - final Completer pageFinishCompleter = Completer(); + final pageFinishCompleter = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnHttpError((HttpResponseError error) { @@ -1113,13 +1113,13 @@ Future main() async { }); testWidgets('can block requests', (WidgetTester tester) async { - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -1165,13 +1165,13 @@ Future main() async { }); testWidgets('supports asynchronous decisions', (WidgetTester tester) async { - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -1211,13 +1211,13 @@ Future main() async { }); testWidgets('can receive url changes', (WidgetTester tester) async { - final Completer pageLoaded = Completer(); + final pageLoaded = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -1239,7 +1239,7 @@ Future main() async { await pageLoaded.future; await delegate.setOnPageFinished((_) {}); - final Completer urlChangeCompleter = Completer(); + final urlChangeCompleter = Completer(); await delegate.setOnUrlChange((UrlChange change) { urlChangeCompleter.complete(change.url); }); @@ -1252,13 +1252,13 @@ Future main() async { testWidgets('can receive updates to history state', ( WidgetTester tester, ) async { - final Completer pageLoaded = Completer(); + final pageLoaded = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -1280,7 +1280,7 @@ Future main() async { await pageLoaded.future; await delegate.setOnPageFinished((_) {}); - final Completer urlChangeCompleter = Completer(); + final urlChangeCompleter = Completer(); await delegate.setOnUrlChange((UrlChange change) { urlChangeCompleter.complete(change.url); }); @@ -1296,12 +1296,12 @@ Future main() async { testWidgets('can receive HTTP basic auth requests', ( WidgetTester tester, ) async { - final Completer authRequested = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final authRequested = Completer(); + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); - final PlatformNavigationDelegate navigationDelegate = + final navigationDelegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); @@ -1334,12 +1334,12 @@ Future main() async { testWidgets('can reply to HTTP basic auth requests', ( WidgetTester tester, ) async { - final Completer pageFinished = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final pageFinished = Completer(); + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); - final PlatformNavigationDelegate navigationDelegate = + final navigationDelegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); @@ -1375,13 +1375,13 @@ Future main() async { testWidgets('target _blank opens in same window', ( WidgetTester tester, ) async { - final Completer pageLoaded = Completer(); + final pageLoaded = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -1404,13 +1404,13 @@ Future main() async { }); testWidgets('can open new window and go back', (WidgetTester tester) async { - Completer pageLoaded = Completer(); + var pageLoaded = Completer(); - final PlatformWebViewController controller = PlatformWebViewController( + final controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - final PlatformNavigationDelegate delegate = PlatformNavigationDelegate( + final delegate = PlatformNavigationDelegate( const PlatformNavigationDelegateCreationParams(), ); await delegate.setOnPageFinished((_) => pageLoaded.complete()); @@ -1445,7 +1445,7 @@ Future main() async { testWidgets('JavaScript does not run in parent window', ( WidgetTester tester, ) async { - const String iframe = ''' + const iframe = '''