Please how do I use google maps in flutter desktop?
2,065
The plugin google_maps_flutter, is only for iOS and Android. It is based on the native SDK for iOS and Android. As far as I know there is no official Google Maps SDK for MacOS, therefore is not posible to implement it inside the flutter plugin.
Author by
AbdulGafar Olamide Ajao
A Fullstack (Web, Mobile, Desktop, Backend) developer, with so much love for VueJs and Flutter.
Updated on December 18, 2022Comments
-
AbdulGafar Olamide Ajao over 1 year
I have searched everywhere for a guide on how to include google maps in flutter desktop application. I tried to follow the iOS guide but didn't work. I did the following in the AppDelegate.swift in the
macos/Runner
directoryimport Cocoa import FlutterMacOS import GoogleMaps @NSApplicationMain class AppDelegate: FlutterAppDelegate { override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { GMSServices.provideAPIKey("MY_API_KEY") return true } }
But I always get the following error
The following build commands failed: CompileSwift normal x86_64 /Users/xxxxx/xxxxx/xxxxxx/xxxxx/macos/Runner/AppDelegate.swift CompileSwift normal x86_64 /Users/xxxxxxx/xxxxxx/xxxxxx/xxxxxx/macos/Flutter/GeneratedPluginRegistrant.swift CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (3 failures) Finished with error: Build process failed
-
AbdulGafar Olamide Ajao about 4 yearsThank you very much for your response. Can you please give me an idea of how I can implement it though. I'm thinking of webview, does that make sense?
-
jamesblasco about 4 years@AbdulGafarAjao It does completely sense, unfortunately native embedded views are not supported yet on MacOS desktop. You are going to have to wait for it. You can subscribe here to follow the request github.com/flutter/flutter/issues/41725
-
AbdulGafar Olamide Ajao about 4 yearsOk, thank you so much @JaimeBlasco... I'm actually working on a school project so I think its best I fully use web mode pending the time that there will be a solution, I'm just bothered about compatibility issues