macos - 请问如何在 flutter 桌面中使用谷歌地图?

标签 macos google-maps flutter desktop-application

我到处搜索有关如何在 flutter 桌面应用程序中包含谷歌地图的指南。我尝试按照 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。据我所知,没有适用于 MacOS 的官方 Google Maps SDK,因此无法在 flutter 插件中实现它。

关于macos - 请问如何在 flutter 桌面中使用谷歌地图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60428690/

相关文章:

c - 在 OSX 和 Ubuntu 上构建打补丁的 64 位 OpenSSL

macos - mac 上删除了 PostgreSQL 用户,如何恢复?

macos - 将 ".app"(应用程序包)中的脚本作为主要可执行文件运行

macos - OSX El Capitan 上的 crontab 坏了吗?

android - 如何在 Android 中顺利平移 GoogleMap?

flutter - URI 的目标不存在 'package:flutter/material.dart'

google-maps - 谷歌地图和knockoutjs

javascript - 谷歌地图 API v3 中的复杂多边形

flutter - 在Flutter中是否有类似PostfixIcon的TextField之类的东西

flutter - Dart 中的空安全性是什么?