matanshukry / flutter_google_places_sdk

Flutter plugin for google places native sdk
36 stars 75 forks source link

Google Maps JavaScript API has been loaded directly without loading=async #76

Open francescovgg opened 8 months ago

francescovgg commented 8 months ago

Hi,

Thank you for this awesome plugin!

I see a warning message in the console: Google Maps JavaScript API has been loaded directly without loading=async. This can result in suboptimal performance. For best-practice loading patterns please see https://goo.gle/js-api-loading

I think a solution would be to add &loading=async&callback=initMap when initializing the plugin, to improve performance

<script async
    src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&loading=async&callback=initMap">
</script>
matanshukry commented 3 months ago

@francescovgg that part already exists actually; the current line is

https://maps.googleapis.com/maps/api/js?key=${apiKey}&loading=async&libraries=places&callback=initMap

Not sure why that's happening then. Can you create a small reproducible example? Also, does this happen to you on multiple different browsers?