Skip to content

[google_maps_flutter_web] Can't get Screen Coordinates. Throws error typeerror: cannot read property 'x' of undefined #80710

@ahsanalidev

Description

@ahsanalidev

Here is a repository you can test yourself if there is a workaround then please share it.

https://github.com/ahsanalidev/info_window_test

The desired behavior is that on tapping the marker, the marker will pass its LatLng and give the screen coordinates so that info window could be shown at that place.
Any help will be greatly appreciated.

Here is my flutter run -d chrome --verbose

logs
PS C:\Users\AhsanAli\Developer\Repositories\in
fo_window_test> flutter run -d chrome --verbose
[ +115 ms] executing:
[C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter/] git -c log.showSignature=false log -n 1      
--pretty=format:%H
[ +107 ms] Exit code 0 from: git -c
log.showSignature=false log -n 1   
--pretty=format:%H
[   +2 ms]
b1395592de68cc8ac4522094ae59956dd21a91db
[   +2 ms] executing:
[C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter/] git tag --points-at
b1395592de68cc8ac4522094ae59956dd21a91db
[  +90 ms] Exit code 0 from: git tag --points-at
b1395592de68cc8ac4522094ae59956dd21a91db
[   +1 ms] 2.0.4
[  +71 ms] executing:
[C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter/] git rev-parse --abbrev-ref --symbolic @{u}   
[  +76 ms] Exit code 0 from: git rev-parse
--abbrev-ref --symbolic @{u}
[   +2 ms] origin/stable
[        ] executing:
[C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter/] git ls-remote --get-url origin
[  +59 ms] Exit code 0 from: git ls-remote
--get-url origin
[   +2 ms] https://github.com/flutter/flutter.git
[ +105 ms] executing:
[C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter/] git rev-parse --abbrev-ref HEAD
[  +68 ms] Exit code 0 from: git rev-parse
--abbrev-ref HEAD
[   +1 ms] stable
[ +122 ms] Artifact Instance of
'AndroidGenSnapshotArtifacts' is not required,    
skipping update.
[   +2 ms] Artifact Instance of
'AndroidInternalBuildArtifacts' is not required,  
skipping update.
[   +1 ms] Artifact Instance of
'IOSEngineArtifacts' is not required, skipping    
update.
[   +3 ms] Artifact Instance of 'FlutterWebSdk' isnot required, skipping update.
[   +8 ms] Artifact Instance of
'WindowsEngineArtifacts' is not required, skippingupdate.
[   +3 ms] Artifact Instance of
'MacOSEngineArtifacts' is not required, skipping  
update.
[  +16 ms] Artifact Instance of
'LinuxEngineArtifacts' is not required, skipping  
update.
[   +8 ms] Artifact Instance of
'LinuxFuchsiaSDKArtifacts' is not required,       
skipping update.
[   +4 ms] Artifact Instance of
'MacOSFuchsiaSDKArtifacts' is not required,       
skipping update.
[   +5 ms] Artifact Instance of
'FlutterRunnerSDKArtifacts' is not required,      
skipping update.
[   +7 ms] Artifact Instance of
'FlutterRunnerDebugSymbols' is not required,      
skipping update.
[ +128 ms] executing:
C:\Users\AhsanAli\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +81 ms] Artifact Instance of
'AndroidGenSnapshotArtifacts' is not required,    
skipping update.
[   +2 ms] Artifact Instance of
'AndroidInternalBuildArtifacts' is not required,  
skipping update.
[   +2 ms] Artifact Instance of
'IOSEngineArtifacts' is not required, skipping    
update.
[  +15 ms] Artifact Instance of
'WindowsEngineArtifacts' is not required, skippingupdate.
[   +2 ms] Artifact Instance of
'MacOSEngineArtifacts' is not required, skipping  
update.
[   +6 ms] Artifact Instance of
'LinuxEngineArtifacts' is not required, skipping  
update.
[   +2 ms] Artifact Instance of
'LinuxFuchsiaSDKArtifacts' is not required,       
skipping update.
[   +2 ms] Artifact Instance of
'MacOSFuchsiaSDKArtifacts' is not required,       
skipping update.
[   +3 ms] Artifact Instance of
'FlutterRunnerSDKArtifacts' is not required,      
skipping update.
[   +3 ms] Artifact Instance of
'FlutterRunnerDebugSymbols' is not required,      
skipping update.
[ +121 ms] executing:
C:\Users\AhsanAli\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +32 ms] Skipping pub get: version match.
[  +69 ms] Found plugin
flutter_plugin_android_lifecycle at
C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-2.0.1\
[  +20 ms] Found plugin google_maps_flutter at
C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter-2.0.3\
[  +13 ms] Found plugin google_maps_flutter_web atC:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter_web-0.3.0\
[ +217 ms] Found plugin
flutter_plugin_android_lifecycle at
C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-2.0.1\
[   +9 ms] Found plugin google_maps_flutter at
C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter-2.0.3\
[  +13 ms] Found plugin google_maps_flutter_web atC:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter_web-0.3.0\
[  +63 ms] Generating
C:\Users\AhsanAli\Developer\Repositories\info_window_test\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[ +114 ms] List of devices attached
[ +132 ms] Launching lib\main.dart on Chrome in
debug mode...
[  +14 ms] List of devices attached
[ +177 ms] Updating assets
[ +319 ms] Waiting for connection from debug
service on
                    Chrome...
[  +28 ms] Found plugin
flutter_plugin_android_lifecycle at
C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-2.0.1\
[   +9 ms] Found plugin google_maps_flutter at
C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter-2.0.3\
[   +6 ms] Found plugin google_maps_flutter_web atC:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter_web-0.3.0\
[  +53 ms] Found plugin
flutter_plugin_android_lifecycle at
C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-2.0.1\
[   +9 ms] Found plugin google_maps_flutter at
C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter-2.0.3\
[   +6 ms] Found plugin google_maps_flutter_web atC:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter_web-0.3.0\
[ +135 ms] <- reset
[  +20 ms]
C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\bin\cache\dart-sdk\bin\dart.exe
--disable-dart-dev
C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root
C:\flutter_windows_v1.12.13+hotfix.5-stable\flutter\bin\cache\flutter_web_sdk/ --incremental        
--target=dartdevc --debugger-module-names
--experimental-emit-debug-metadata
-DFLUTTER_WEB_AUTO_DETECT=true --output-dill      
C:\Users\AhsanAli\AppData\Local\Temp\flutter_tools.8ec86981\flutter_tool.67bee1e4\app.dill
--libraries-spec
file:///C:/flutter_windows_v1.12.13+hotfix.5-stable/flutter/bin/cache/flutter_web_sdk/libraries.json--packages
C:\Users\AhsanAli\Developer\Repositories\info_window_test\.dart_tool\package_config.json
-Ddart.vm.profile=false -Ddart.vm.product=false   
--enable-asserts --track-widget-creation
--filesystem-root
C:\Users\AhsanAli\AppData\Local\Temp\flutter_tools.8ec86981\flutter_tools.2f5860ff
--filesystem-scheme org-dartlang-app
--initialize-from-dill
build\c7922d95bf4a2462b75c84a97c312edb.cache.dill.track.dill --platform
file:///C:/flutter_windows_v1.12.13+hotfix.5-stable/flutter/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk.dill --no-sound-null-safety
[  +50 ms] <- compile
org-dartlang-app:/web_entrypoint.dart
[+27112 ms] Waiting for connection from debug
service on Chrome... (completed in 27.4s)
[   +2 ms] Synced 32.0MB.
[   +1 ms] <- accept
[   +1 ms] Caching compiled dill
[+1087 ms] Using Opening in existing browser
session.

[ +833 ms] [CHROME]:
[  +27 ms] [CHROME]:DevTools listening on
ws://127.0.0.1:52078/devtools/browser/e34d2976-a6aa-4aa4-87d7-16309c4b2b31
[+3003 ms] DwdsInjector: Received request for
entrypoint at
http://localhost:52013/main_module.bootstrap.js   
[  +19 ms] MetadataProvider: Loading debug
metadata...
[  +25 ms] MetadataProvider: Loaded debug metadata[  +22 ms] DwdsInjector: Injected debugging
metadata for entrypoint at
http://localhost:52013/main_module.bootstrap.js   
[+10551 ms] DevHandler: Debug service listening onws://127.0.0.1:52167/85mO4r0eTSE=/ws

[  +35 ms] Debug service listening on
           ws://127.0.0.1:52167/85mO4r0eTSE=/ws   
[   +2 ms] Running with unsound null safety
[  +12 ms] For more information see

https://dart.dev/null-safety/unsound-null-safety  
[  +18 ms]   To hot restart changes while
running, press
           "r" or "R".
[   +4 ms] For a more detailed help message, press"h". To
           quit, press "q".
[+11925 ms] TypeError: Cannot read property 'x' ofundefined
                         at _.sh.fromLatLngToPoint
(https://maps.googleapis.com/maps/api/js?key=A    

IzaSyDHZomR5ozaTualggVoaq5Z2fZIFC_03eQ:247:166    
                         5)
                         at

google_maps_flutter_web.GoogleMapController.ne    
                         w.getScreenCoordinate    

(http://localhost:52013/packages/google_maps_f    

lutter_web/src/types.dart.lib.js:718:221)
                         at
getScreenCoordinate.next (<anonymous>)
                         at runBody

(http://localhost:52013/dart_sdk.js:39051:34)     
                         at Object._async [as     
async]

(http://localhost:52013/dart_sdk.js:39082:7)      
                         at

google_maps_flutter_web.GoogleMapController.ne    
                         w.getScreenCoordinate    

(http://localhost:52013/packages/google_maps_f    

lutter_web/src/types.dart.lib.js:715:20)
                         at

google_maps_flutter_web.GoogleMapsPlugin.new.g    
                         etScreenCoordinate       

(http://localhost:52013/packages/google_maps_f    

lutter_web/src/types.dart.lib.js:378:32)
                         at

google_maps_flutter.GoogleMapController.__.get    
                         ScreenCoordinate

(http://localhost:52013/packages/google_maps_f    

lutter/google_maps_flutter.dart.lib.js:278:78)    
                         at

custom_info_window._CustomInfoWindowState.new.    
                         _updateInfoWindow        

(http://localhost:52013/packages/custom_window    

_info/custom_info_window.dart.lib.js:311:82)      
                         at _updateInfoWindow.next(<anonymous>)
                         at runBody

(http://localhost:52013/dart_sdk.js:39051:34)     
                         at Object._async [as     
async]

(http://localhost:52013/dart_sdk.js:39082:7)      
                         at

custom_info_window._CustomInfoWindowState.new.    
                         [_updateInfoWindow]      

(http://localhost:52013/packages/custom_window    

_info/custom_info_window.dart.lib.js:307:20)      
                         at

custom_info_window._CustomInfoWindowState.new.    
                         [_addInfoWindow]

(http://localhost:52013/packages/custom_window    

_info/custom_info_window.dart.lib.js:327:30)      
                         at

http://localhost:52013/packages/custom_window_    

info/main.dart.lib.js:670:14
                         at

google_maps_flutter._GoogleMapState.new.onMark    
                         erTap

(http://localhost:52013/packages/google_maps_f    

lutter/google_maps_flutter.dart.lib.js:873:9)     
                         at

http://localhost:52013/packages/google_maps_fl    

utter/google_maps_flutter.dart.lib.js:195:39      
                         at
_RootZone.runUnaryGuarded

(http://localhost:52013/dart_sdk.js:38814:11)     
                         at
_BroadcastSubscription.new.[_sendData]

(http://localhost:52013/dart_sdk.js:32431:22)     
                         at
_BroadcastSubscription.new.[_add]

(http://localhost:52013/dart_sdk.js:32377:26)     
                         at

_SyncBroadcastStreamController.new.[_sendData]    

(http://localhost:52013/dart_sdk.js:33097:34)     
                         at
_SyncBroadcastStreamController.new.add

(http://localhost:52013/dart_sdk.js:32891:24)     
                         at

http://localhost:52013/packages/stream_transfo    

rm/src/where.dart.lib.js:41:31
                         at

http://localhost:52013/packages/stream_transfo    

rm/src/from_handlers.dart.lib.js:60:52
                         at
_RootZone.runUnaryGuarded

(http://localhost:52013/dart_sdk.js:38814:11)     
                         at
_BroadcastSubscription.new.[_sendData]

(http://localhost:52013/dart_sdk.js:32431:22)     
                         at
_DelayedData.new.perform

(http://localhost:52013/dart_sdk.js:35846:28)     
                         at
_StreamImplEvents.new.handleNext

(http://localhost:52013/dart_sdk.js:35956:15)     
                         at
async._AsyncCallbackEntry.new.callback

(http://localhost:52013/dart_sdk.js:35708:16)     
                         at Object._microtaskLoop 

(http://localhost:52013/dart_sdk.js:39175:13)     
                         at _startMicrotaskLoop   

(http://localhost:52013/dart_sdk.js:39181:13)     
                         at
http://localhost:52013/dart_sdk.js:34688:9        
[+18436 ms] TypeError: Cannot read property 'x' ofundefined
                         at _.sh.fromLatLngToPoint
(https://maps.googleapis.com/maps/api/js?key=A    

IzaSyDHZomR5ozaTualggVoaq5Z2fZIFC_03eQ:247:166    
                         5)
                         at

google_maps_flutter_web.GoogleMapController.ne    
                         w.getScreenCoordinate    

(http://localhost:52013/packages/google_maps_f    

lutter_web/src/types.dart.lib.js:718:221)
                         at
getScreenCoordinate.next (<anonymous>)
                         at runBody

(http://localhost:52013/dart_sdk.js:39051:34)     
                         at Object._async [as     
async]

(http://localhost:52013/dart_sdk.js:39082:7)      
                         at

google_maps_flutter_web.GoogleMapController.ne    
                         w.getScreenCoordinate    

(http://localhost:52013/packages/google_maps_f    

lutter_web/src/types.dart.lib.js:715:20)
                         at

google_maps_flutter_web.GoogleMapsPlugin.new.g    
                         etScreenCoordinate       

(http://localhost:52013/packages/google_maps_f    

lutter_web/src/types.dart.lib.js:378:32)
                         at

google_maps_flutter.GoogleMapController.__.get    
                         ScreenCoordinate

(http://localhost:52013/packages/google_maps_f    

lutter/google_maps_flutter.dart.lib.js:278:78)    
                         at

custom_info_window._CustomInfoWindowState.new.    
                         _updateInfoWindow        

(http://localhost:52013/packages/custom_window    

_info/custom_info_window.dart.lib.js:311:82)      
                         at _updateInfoWindow.next(<anonymous>)
                         at runBody

(http://localhost:52013/dart_sdk.js:39051:34)     
                         at Object._async [as     
async]

(http://localhost:52013/dart_sdk.js:39082:7)      
                         at

custom_info_window._CustomInfoWindowState.new.    
                         [_updateInfoWindow]      

(http://localhost:52013/packages/custom_window    

_info/custom_info_window.dart.lib.js:307:20)      
                         at

custom_info_window._CustomInfoWindowState.new.    
                         [_addInfoWindow]

(http://localhost:52013/packages/custom_window    

_info/custom_info_window.dart.lib.js:327:30)      
                         at

http://localhost:52013/packages/custom_window_    

info/main.dart.lib.js:670:14
                         at

google_maps_flutter._GoogleMapState.new.onMark    
                         erTap

(http://localhost:52013/packages/google_maps_f    

lutter/google_maps_flutter.dart.lib.js:873:9)     
                         at

http://localhost:52013/packages/google_maps_fl    

utter/google_maps_flutter.dart.lib.js:195:39      
                         at
_RootZone.runUnaryGuarded

(http://localhost:52013/dart_sdk.js:38814:11)     
                         at
_BroadcastSubscription.new.[_sendData]

(http://localhost:52013/dart_sdk.js:32431:22)     
                         at
_BroadcastSubscription.new.[_add]

(http://localhost:52013/dart_sdk.js:32377:26)     
                         at

_SyncBroadcastStreamController.new.[_sendData]    

(http://localhost:52013/dart_sdk.js:33097:34)     
                         at
_SyncBroadcastStreamController.new.add

(http://localhost:52013/dart_sdk.js:32891:24)     
                         at

http://localhost:52013/packages/stream_transfo    

rm/src/where.dart.lib.js:41:31
                         at

http://localhost:52013/packages/stream_transfo    

rm/src/from_handlers.dart.lib.js:60:52
                         at
_RootZone.runUnaryGuarded

(http://localhost:52013/dart_sdk.js:38814:11)     
                         at
_BroadcastSubscription.new.[_sendData]

(http://localhost:52013/dart_sdk.js:32431:22)     
                         at
_DelayedData.new.perform

(http://localhost:52013/dart_sdk.js:35846:28)     
                         at
_StreamImplEvents.new.handleNext

(http://localhost:52013/dart_sdk.js:35956:15)     
                         at
async._AsyncCallbackEntry.new.callback

(http://localhost:52013/dart_sdk.js:35708:16)     
                         at Object._microtaskLoop 

(http://localhost:52013/dart_sdk.js:39175:13)     
                         at _startMicrotaskLoop   

(http://localhost:52013/dart_sdk.js:39181:13)     
                         at
http://localhost:52013/dart_sdk.js:34688:9        

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: crashStack traces logged to the consolefound in release: 2.1Found to occur in 2.1has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: mapsGoogle Maps pluginpackageflutter/packages repository. See also p: labels.platform-webWeb applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions