请问如何在 flutter 桌面中使用 google 地图?
Please how do I use google maps in flutter desktop?
我到处搜索有关如何在 flutter 桌面应用程序中包含 google 地图的指南。我尝试按照 iOS 指南进行操作,但没有成功。
我在 macos/Runner
目录
的 AppDelegate.swift 中做了以下操作
import Cocoa
import FlutterMacOS
import GoogleMaps
@NSApplicationMain
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
GMSServices.provideAPIKey("MY_API_KEY")
return true
}
}
但我总是得到以下错误
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
插件 google_maps_flutter,仅适用于 iOS 和 Android。它基于 iOS 和 Android 的原生 SDK。据我所知,没有官方的 Google Maps SDK for MacOS,因此无法在 flutter 插件中实现它。
我到处搜索有关如何在 flutter 桌面应用程序中包含 google 地图的指南。我尝试按照 iOS 指南进行操作,但没有成功。
我在 macos/Runner
目录
import Cocoa
import FlutterMacOS
import GoogleMaps
@NSApplicationMain
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
GMSServices.provideAPIKey("MY_API_KEY")
return true
}
}
但我总是得到以下错误
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
插件 google_maps_flutter,仅适用于 iOS 和 Android。它基于 iOS 和 Android 的原生 SDK。据我所知,没有官方的 Google Maps SDK for MacOS,因此无法在 flutter 插件中实现它。