Repository: flutter
Issue: Google Maps plugin seemingly doesn't apply device pixel ratio on the web (or applies it twice?)
Labels: p: maps,platform-web,package,has reproducible steps,team-web,found in release: 3.27,found in release: 3.28

### Steps to reproduce

1. Write (or use a preexisting) Flutter app that uses `pkg:google_maps_flutter`.
2. In the `GoogleMap` widget, provide an initial camera position with a set zoom level
  ```dart
    return GoogleMap(
      initialCameraPosition: CameraPosition(target: LatLng(0, 0), zoom: 0),
    );
  ```
3. Add code to print out the resolution-independent size of the screen: `debugPrint(MediaQuery.sizeOf(context));`
4. Run the app on Android or iOS first, to see how it looks there.
5. Now run the app on the web

### Expected results

When the resolution-independent size of the screen is roughly the same, I expect the map to show roughly the same area (the zoom is the same, the viewport size is the same).

### Actual results

iPhone landscape (with `Size(932.0, 430.0)`)

![Image](https://github.com/user-attachments/assets/39e17a8a-7aa8-4168-bdca-6f3d29a11bce)

iPad landscape

![Image](https://github.com/user-attachments/assets/32af76c2-fa6a-4817-91c1-ef143b490c77)


Chrome window on macOS (with `Size(1200.0, 698.0)`)

![Image](https://github.com/user-attachments/assets/04216341-65b8-4ad5-bba3-ce969661fb1d)

When you compare iPhone with the Chrome window, the size is comparable (+28% horizontal, +62% vertical) but the zoom seems to be more than 3x off.

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

class BasicStaticSample extends StatelessWidget {
  const BasicStaticSample({super.key});

  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.sizeOf(context);
    double deviceWidth = size.width * MediaQuery.devicePixelRatioOf(context);
    double deviceHeight = size.height * MediaQuery.devicePixelRatioOf(context);
    debugPrint("$size");
    debugPrint("$deviceWidth");
    debugPrint("$deviceHeight");

    return GoogleMap(
      initialCameraPosition: CameraPosition(target: LatLng(0, 0), zoom: 0),
    );
  }
}

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

See above.

</details>


### Logs

<details open><summary>Logs</summary>

```console
% flutter run -d chrome --verbose
[   +5 ms] executing: sw_vers -productName
[  +18 ms] Exit code 0 from: sw_vers -productName
[        ] macOS
[        ] executing: sw_vers -productVersion
[   +8 ms] Exit code 0 from: sw_vers -productVersion
[        ] 14.7
[        ] executing: sw_vers -buildVersion
[   +7 ms] Exit code 0 from: sw_vers -buildVersion
[        ] 23H124
[        ] executing: uname -m
[   +2 ms] Exit code 0 from: uname -m
[        ] arm64
[   +3 ms] executing: sysctl hw.optional.arm64
[   +4 ms] Exit code 0 from: sysctl hw.optional.arm64
[        ] hw.optional.arm64: 1
[  +57 ms] executing: sysctl hw.optional.arm64
[   +7 ms] Exit code 0 from: sysctl hw.optional.arm64
[        ] hw.optional.arm64: 1
[        ] executing: /usr/bin/arch -arm64e xcrun xcodebuild -version
[  +69 ms] Exit code 0 from: /usr/bin/arch -arm64e xcrun xcodebuild -version
[        ] Xcode 16.2
           Build version 16C5032a
[   +1 ms] executing: /usr/bin/arch -arm64e xcrun xcdevice list --timeout 5
[   +2 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +25 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +8 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +44 ms] Skipping pub get: version match.
[  +27 ms] Found plugin flutter_plugin_android_lifecycle at /Users/filiph/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.24/
[   +8 ms] Found plugin google_maps_flutter at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter-2.10.0/
[   +2 ms] Found plugin google_maps_flutter_android at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.14.11/
[   +1 ms] Found plugin google_maps_flutter_ios at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.13.2/
[   +4 ms] Found plugin google_maps_flutter_web at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_web-0.5.10/
[  +42 ms] Found plugin flutter_plugin_android_lifecycle at /Users/filiph/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.24/
[   +1 ms] Found plugin google_maps_flutter at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter-2.10.0/
[   +1 ms] Found plugin google_maps_flutter_android at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.14.11/
[   +1 ms] Found plugin google_maps_flutter_ios at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.13.2/
[   +1 ms] Found plugin google_maps_flutter_web at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_web-0.5.10/
[  +28 ms] Found plugin flutter_plugin_android_lifecycle at /Users/filiph/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.24/
[        ] Found plugin google_maps_flutter at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter-2.10.0/
[        ] Found plugin google_maps_flutter_android at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.14.11/
[        ] Found plugin google_maps_flutter_ios at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.13.2/
[   +1 ms] Found plugin google_maps_flutter_web at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_web-0.5.10/
[  +11 ms] Generating /Users/filiph/dev/flutter-maps-samples/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +173 ms] Launching lib/main.dart on Chrome in debug mode...
[  +51 ms] Initializing file store
[   +5 ms] Skipping target: gen_localizations
[   +1 ms] Skipping target: gen_dart_plugin_registrant
[        ] Skipping target: _composite
[        ] complete
[        ] Updating assets
[  +64 ms] Waiting for connection from debug service on Chrome...
[   +4 ms] Found plugin flutter_plugin_android_lifecycle at /Users/filiph/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.24/
[        ] Found plugin google_maps_flutter at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter-2.10.0/
[        ] Found plugin google_maps_flutter_android at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.14.11/
[        ] Found plugin google_maps_flutter_ios at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.13.2/
[        ] Found plugin google_maps_flutter_web at /Users/filiph/.pub-cache/hosted/pub.dev/google_maps_flutter_web-0.5.10/
[  +17 ms] shaderc command: [/Users/filiph/fvm/versions/stable/bin/cache/artifacts/engine/darwin-x64/impellerc, --sksl, --iplr, --json,
--sl=build/flutter_assets/shaders/ink_sparkle.frag, --spirv=build/flutter_assets/shaders/ink_sparkle.frag.spirv,
--input=/Users/filiph/fvm/versions/stable/packages/flutter/lib/src/material/shaders/ink_sparkle.frag, --input-type=frag,
--include=/Users/filiph/fvm/versions/stable/packages/flutter/lib/src/material/shaders,
--include=/Users/filiph/fvm/versions/stable/bin/cache/artifacts/engine/darwin-x64/shader_lib]
[ +167 ms] <- reset
[   +2 ms] /Users/filiph/fvm/versions/stable/bin/cache/dart-sdk/bin/dartaotruntime
/Users/filiph/fvm/versions/stable/bin/cache/dart-sdk/bin/snapshots/frontend_server_aot.dart.snapshot --sdk-root
/Users/filiph/fvm/versions/stable/bin/cache/flutter_web_sdk/ --incremental --target=dartdevc --experimental-emit-debug-metadata --output-dill
/var/folders/54/z2sqwtn97y1ftg9plxgrqrv00000gn/T/flutter_tools.arQKG8/flutter_tool.zAnCVn/app.dill --packages
/Users/filiph/dev/flutter-maps-samples/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts
--track-widget-creation --filesystem-root /var/folders/54/z2sqwtn97y1ftg9plxgrqrv00000gn/T/flutter_tools.arQKG8/flutter_tools.ouF050
--filesystem-scheme org-dartlang-app --initialize-from-dill build/80b1a4cf4e7b90e1ab5f72022a0bc624.cache.dill.track.dill --platform
file:///Users/filiph/fvm/versions/stable/bin/cache/flutter_web_sdk/kernel/ddc_outline_sound.dill --verbosity=error --sound-null-safety
[   +6 ms] <- compile org-dartlang-app:/web_entrypoint.dart
[+5380 ms] [
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "18.0 (22A3351)",
                        "available" : true,

...


[+5090 ms] Waiting for connection from debug service on Chrome... (completed in 10.9s)
[        ] Synced 50.7MB.
[        ] <- accept
[        ] Caching compiled dill
[  +30 ms] Launching Chromium (url = http://localhost:59204, headless = false, skipCheck = false, debugPort = null)
[        ] Will use Chromium executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[  +87 ms] Using Google Chrome 131.0.6778.265 

[  +39 ms] executing: sysctl hw.optional.arm64
[   +3 ms] Exit code 0 from: sysctl hw.optional.arm64
[        ] hw.optional.arm64: 1
[   +7 ms] Found ARM Chrome installation at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome, forcing native launch.
[ +758 ms] [CHROME]: 
[   +2 ms] [CHROME]: DevTools listening on ws://127.0.0.1:59229/devtools/browser/24ae571b-61a0-436a-89b7-4d3bdcc81e25
[+1100 ms] DwdsInjector: Received request for entrypoint at http://localhost:59204/main_module.bootstrap.js
[  +13 ms] MetadataProvider: Loading debug metadata...

....

[        ] MetadataProvider: Loaded debug metadata for module: packages/flutter_maps_samples/locations.dart
[        ] MetadataProvider: Loaded debug metadata (sound null safety)
[  +12 ms] DwdsInjector: Injected debugging metadata for entrypoint at http://localhost:59204/main_module.bootstrap.js
[+3197 ms] ChromeProxyService: Initializing expression compiler for main_module.bootstrap.js with sound null safety: true
[  +85 ms] ChromeProxyService: Caching package:flutter/src/widgets/widget_inspector.dart in expression compiler worker
[  +90 ms] DevHandler: Debug service listening on ws://127.0.0.1:59258/uG_PFtrhXcM=/ws

[   +6 ms] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 10, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers,
           id: 10, params: {streamId: Stdout, includePrivateMembers: false}}}}
[   +4 ms] This app is linked to the debug service: ws://127.0.0.1:59258/uG_PFtrhXcM=/ws
[        ] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 11, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers,
           id: 11, params: {streamId: Stderr, includePrivateMembers: false}}}}
[   +5 ms] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 13, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers,
           id: 13, params: {streamId: Isolate, includePrivateMembers: false}}}}
[   +1 ms] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 14, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers,
           id: 14, params: {streamId: Extension, includePrivateMembers: false}}}}
[   +2 ms] Debug service listening on ws://127.0.0.1:59258/uG_PFtrhXcM=/ws
[   +5 ms] 🔥  To hot restart changes while running, press "r" or "R".
[        ] For a more detailed help message, press "h". To quit, press "q".
[        ] A Dart VM Service on Chrome is available at: http://127.0.0.1:59258/uG_PFtrhXcM=
[ +132 ms] ExpressionEvaluator: Evaluating "() { return true; }" at packages/flutter/src/widgets/unique_widget.dart
[ +102 ms] ExpressionEvaluator: Evaluating JS: "function () {
                      try {
                        return   (function() {
                            const dart_sdk = require('dart_sdk');
                            const dart_rti = dart_sdk.dart_rti;
                            const dart = dart_sdk.dart;
                            return dart.fn(() => true, dart_rti._Universe.eval(dart_rti._theUniverse(), "core|bool()", true));
                          }(

                          ))();
                      } catch (error) {
                        return error.name + ": " + error.message;
                      }
                    }" with scope: {}
[ +274 ms] ExpressionEvaluator: Evaluated "() { return true; }" to "{type: boolean, value: true}"
[   +4 ms] The Flutter DevTools debugger and profiler on Chrome is available at: http://127.0.0.1:9106?uri=http://127.0.0.1:59258/uG_PFtrhXcM=

```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.27.1, on macOS 14.7 23H124 darwin-arm64, locale en-US)
    • Flutter version 3.27.1 on channel stable at /Users/filiph/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (4 weeks ago), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/filiph/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.3.1.1)
    • IntelliJ at /Users/filiph/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 83.0.4
    • Dart plugin version 243.23177

[✓] VS Code (version 1.92.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.84.0

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile)     • emulator-5554         • android-arm64  • Android 14 (API 34) (emulator)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.7 23H124 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.7 23H124 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 131.0.6778.265

[✓] Network resources
    • All expected network resources are available.

• No issues found!

```

</details>