Please how do I use google maps in flutter desktop?

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/Runnerdirectory

import 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

Upvotes: 7

Views: 5256

Answers (1)

jamesblasco
jamesblasco

Reputation: 1882

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.

Upvotes: 6

Related Questions