A Flutter package to provide the native maps to Android/iOS

Overview

platform_maps_flutter

A Flutter package that provides a native map to both Android and iOS devices.

The plugin relies on Flutter's mechanism for embedding Android and iOS views. As that mechanism is currently in a developers preview, this plugin should also be considered a developers preview.

This package combines the google_maps_flutter plugin with apple_maps_flutter to create a cross platform implementation of native maps for Android/iOS.

Screenshots

Android iOS
Example 1 Example 2
Example 1 Example 2

Current functionality

  • Camera movement including bearing, heading, tilt (also animated)
  • Markers, including custom marker images and Info windows
  • Different map types
  • Map manipulation, enable/disable gestures, show current location, show compass ...

iOS

To use this plugin on iOS you need to opt-in for the embedded views preview by adding a boolean property to the app's Info.plist file, with the key io.flutter.embedded_views_preview and the value YES. You will also have to add the key Privacy - Location When In Use Usage Description with the value of your usage description.

Android

Specify your API key in the application manifest android/app/src/main/AndroidManifest.xml:

<manifest ...
  <application ...
    <meta-data android:name="com.google.android.geo.API_KEY"
               android:value="YOUR KEY HERE"/>

Sample Usage

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PlatformMap(
        initialCameraPosition: CameraPosition(
          target: const LatLng(47.6, 8.8796),
          zoom: 16.0,
        ),
        markers: Set<Marker>.of(
          [
            Marker(
              markerId: MarkerId('marker_1'),
              position: LatLng(47.6, 8.8796),
              consumeTapEvents: true,
              infoWindow: InfoWindow(
                title: 'PlatformMarker',
                snippet: "Hi I'm a Platform Marker",
              ),
              onTap: () {
                print("Marker tapped");
              },
            ),
          ],
        ),
        myLocationEnabled: true,
        myLocationButtonEnabled: true,
        onTap: (location) => print('onTap: $location'),
        onCameraMove: (cameraUpdate) => print('onCameraMove: $cameraUpdate'),
        compassEnabled: true,
        onMapCreated: (controller) {
          Future.delayed(Duration(seconds: 2)).then(
            (_) {
              controller.animateCamera(
                CameraUpdate.newCameraPosition(
                  const CameraPosition(
                    bearing: 270.0,
                    target: LatLng(51.5160895, -0.1294527),
                    tilt: 30.0,
                    zoom: 18,
                  ),
                ),
              );
            },
          );
        },
      ),
    );
  }
}

Suggestions and PR's to make this plugin better are always welcome. Please notice that the features provided by this package depend on the apple_maps_flutter plugin, which will improve in the future.

Comments
  • Unable to build app on dev channel

    Unable to build app on dev channel

    I am trying to switch over from using the google maps plugin to this one and I am unable to run my app after adding this plugin.

    Here is the output when running the app on my iPhone:

    Xcode's output:
    ↳
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/FlutterMapView.swift:117:48: error: 'UIButtonType' has been renamed to 'UIButton.ButtonType'
                   let locationButton = UIButton(type: UIButtonType.custom) as UIButton
                                                       ^~~~~~~~~~~~
                                                       UIButton.ButtonType
        UIKit.UIButtonType:2:18: note: 'UIButtonType' was obsoleted in Swift 4.2
        public typealias UIButtonType = UIButton.ButtonType
                         ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/FlutterMapView.swift:194:64: error: 'MKMapPointForCoordinate' has been replaced by 'MKMapPoint.init(_:)'
                            let distance: Float = Float(distanceOf(pt: MKMapPointForCoordinate(coord), toPoly: overlay as! MKPolyline))
                                                                       ^~~~~~~~~~~~~~~~~~~~~~~
                                                                       MKMapPoint
        MapKit.MKMapPointForCoordinate:3:13: note: 'MKMapPointForCoordinate' was obsoleted in Swift 3
        public func MKMapPointForCoordinate(_ coordinate: CLLocationCoordinate2D) -> MKMapPoint
                    ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/FlutterMapView.swift:249:29: error: 'MKMapPointMake' is unavailable in Swift
                        ptClosest = MKMapPointMake(ptA.x + u * xDelta, ptA.y + u * yDelta)
                                    ^~~~~~~~~~~~~~
        MapKit.MKMapPointMake:2:13: note: 'MKMapPointMake' has been explicitly marked unavailable here
        public func MKMapPointMake(_ x: Double, _ y: Double) -> MKMapPoint
                    ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/FlutterMapView.swift:252:38: error: 'MKMetersBetweenMapPoints' has been replaced by instance method 'MKMapPoint.distance(to:)'
                    distance = min(distance, MKMetersBetweenMapPoints(ptClosest, pt))
                                             ^~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
                                             ptClosest.distance                  to:
        MapKit.MKMetersBetweenMapPoints:3:13: note: 'MKMetersBetweenMapPoints' was obsoleted in Swift 3
        public func MKMetersBetweenMapPoints(_ a: MKMapPoint, _ b: MKMapPoint) -> CLLocationDistance
                    ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/FlutterMapView.swift:261:16: error: 'MKMetersBetweenMapPoints' has been replaced by instance method 'MKMapPoint.distance(to:)'
                return MKMetersBetweenMapPoints(MKMapPointForCoordinate(coordA), MKMapPointForCoordinate(coordB))
                       ^~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                       MKMapPointForCoordinate(coordA).distance                  to:
        MapKit.MKMetersBetweenMapPoints:3:13: note: 'MKMetersBetweenMapPoints' was obsoleted in Swift 3
        public func MKMetersBetweenMapPoints(_ a: MKMapPoint, _ b: MKMapPoint) -> CLLocationDistance
                    ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/FlutterMapView.swift:261:41: error: 'MKMapPointForCoordinate' has been replaced by 'MKMapPoint.init(_:)'
                return MKMetersBetweenMapPoints(MKMapPointForCoordinate(coordA), MKMapPointForCoordinate(coordB))
                                                ^~~~~~~~~~~~~~~~~~~~~~~
                                                MKMapPoint
        MapKit.MKMapPointForCoordinate:3:13: note: 'MKMapPointForCoordinate' was obsoleted in Swift 3
        public func MKMapPointForCoordinate(_ coordinate: CLLocationCoordinate2D) -> MKMapPoint
                    ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/FlutterMapView.swift:261:74: error: 'MKMapPointForCoordinate' has been replaced by 'MKMapPoint.init(_:)'
                return MKMetersBetweenMapPoints(MKMapPointForCoordinate(coordA), MKMapPointForCoordinate(coordB))
                                                                                 ^~~~~~~~~~~~~~~~~~~~~~~
                                                                                 MKMapPoint
        MapKit.MKMapPointForCoordinate:3:13: note: 'MKMapPointForCoordinate' was obsoleted in Swift 3
        public func MKMapPointForCoordinate(_ coordinate: CLLocationCoordinate2D) -> MKMapPoint
                    ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/MapViewExtension.swift:142:22: error: 'MKCoordinateRegionMake' is unavailable in Swift
                let region = MKCoordinateRegionMake(centerCoordinate, span)
                             ^~~~~~~~~~~~~~~~~~~~~~
        MapKit.MKCoordinateRegionMake:2:13: note: 'MKCoordinateRegionMake' has been explicitly marked unavailable here
        public func MKCoordinateRegionMake(_ centerCoordinate: CLLocationCoordinate2D, _ span: MKCoordinateSpan) -> MKCoordinateRegion
                    ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/MapViewExtension.swift:184:16: error: 'MKCoordinateSpanMake' is unavailable in Swift
                return MKCoordinateSpanMake(latitudeDelta, longitudeDelta)
                       ^~~~~~~~~~~~~~~~~~~~
        MapKit.MKCoordinateSpanMake:2:13: note: 'MKCoordinateSpanMake' has been explicitly marked unavailable here
        public func MKCoordinateSpanMake(_ latitudeDelta: CLLocationDegrees, _ longitudeDelta: CLLocationDegrees) -> MKCoordinateSpan
                    ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/MapViewExtension.swift:210:24: error: 'MKMetersBetweenMapPoints' has been replaced by instance method 'MKMapPoint.distance(to:)'
                let distance = MKMetersBetweenMapPoints(MKMapPointForCoordinate(centerCoordinate), MKMapPointForCoordinate(topBottom))
                               ^~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                               MKMapPointForCoordinate(centerCoordinate).distance                  to:
        MapKit.MKMetersBetweenMapPoints:3:13: note: 'MKMetersBetweenMapPoints' was obsoleted in Swift 3
        public func MKMetersBetweenMapPoints(_ a: MKMapPoint, _ b: MKMapPoint) -> CLLocationDistance
                    ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/MapViewExtension.swift:210:49: error: 'MKMapPointForCoordinate' has been replaced by 'MKMapPoint.init(_:)'
                let distance = MKMetersBetweenMapPoints(MKMapPointForCoordinate(centerCoordinate), MKMapPointForCoordinate(topBottom))
                                                        ^~~~~~~~~~~~~~~~~~~~~~~
                                                        MKMapPoint
        MapKit.MKMapPointForCoordinate:3:13: note: 'MKMapPointForCoordinate' was obsoleted in Swift 3
        public func MKMapPointForCoordinate(_ coordinate: CLLocationCoordinate2D) -> MKMapPoint
                    ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/MapViewExtension.swift:210:92: error: 'MKMapPointForCoordinate' has been replaced by 'MKMapPoint.init(_:)'
                let distance = MKMetersBetweenMapPoints(MKMapPointForCoordinate(centerCoordinate), MKMapPointForCoordinate(topBottom))
                                                                                                   ^~~~~~~~~~~~~~~~~~~~~~~
                                                                                                   MKMapPoint
        MapKit.MKMapPointForCoordinate:3:13: note: 'MKMapPointForCoordinate' was obsoleted in Swift 3
        public func MKMapPointForCoordinate(_ coordinate: CLLocationCoordinate2D) -> MKMapPoint
                    ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/PolylineController.swift:65:21: error: 'add' has been renamed to 'addOverlay(_:)'
                    mapView.add(polyline)
                            ^~~
                            addOverlay
        MapKit.MKMapView:66:15: note: 'add' was obsoleted in Swift 4.2
            open func add(_ overlay: MKOverlay)
                      ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/PolylineController.swift:91:29: error: 'remove' has been renamed to 'removeOverlay(_:)'
                            mapView.remove(polyline)
                                    ^~~~~~
                                    removeOverlay
        MapKit.MKMapView:13:15: note: 'remove' was obsoleted in Swift 4.2
            open func remove(_ overlay: MKOverlay)
                      ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/PolylineController.swift:98:17: error: 'remove' has been renamed to 'removeOverlay(_:)'
                mapView.remove(oldPolyline)
                        ^~~~~~
                        removeOverlay
        MapKit.MKMapView:13:15: note: 'remove' was obsoleted in Swift 4.2
            open func remove(_ overlay: MKOverlay)
                      ^
        /Users/adithya/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.0.6+1/ios/Classes/PolylineController.swift:99:17: error: 'add' has been renamed to 'addOverlay(_:)'
                mapView.add(newPolyline)
                        ^~~
                        addOverlay
        MapKit.MKMapView:66:15: note: 'add' was obsoleted in Swift 4.2
            open func add(_ overlay: MKOverlay)
                      ^
        Command MergeSwiftModule failed with a nonzero exit code
        note: Using new build system
        note: Planning build
        note: Constructing build description
    
    Could not build the precompiled application for the device.
    
    Error launching application on Adithya's iPhone XS Max.
    Exited (sigterm)
    

    Here is the output of flutter doctor:

    [✓] Flutter (Channel dev, v1.12.16, on Mac OS X 10.14.6 18G103, locale en-SG)
        • Flutter version 1.12.16 at /Users/adithya/Development/flutter
        • Framework revision 37f9c54116 (6 days ago), 2019-11-27 11:33:38 -0800
        • Engine revision fad1b23c42
        • Dart version 2.7.0
    
     
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
        • Android SDK at /Users/adithya/Library/Android/sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-29, build-tools 29.0.2
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 11.2.1, Build version 11B53
        • CocoaPods version 1.7.5
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 3.5)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 41.1.2
        • Dart plugin version 191.8593
        • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    
    [✓] VS Code (version 1.40.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.6.0
    
    [✓] Connected device (2 available)
        • Chrome     • chrome     • web-javascript • Google Chrome 78.0.3904.108
        • Web Server • web-server • web-javascript • Flutter Tools
    
    • No issues found!
    
    opened by adithyaxx 10
  • Custom markers not working on iOS

    Custom markers not working on iOS

    Hey again! I apologize if it seems like I'm opening an issue each time one closes - I appreciate your diligence!

    I upgraded to 0.1.4+1 and added custom markers, but they only seem to show up on Android devices. On iOS devices, the default marker is still used. This was verified on an iPhone 8 Plus (simulator) and iPhone 6s Plus (physical).

    Usage

    var _markerIcon;

    void _createMarkerFromImageAsset(BuildContext context) async {
        if(_markerIcon == null) {
          final ImageConfiguration imageConfiguration = createLocalImageConfiguration(context);
          var _markerBitmapDescriptor = await BitmapDescriptor.fromAssetImage(
            imageConfiguration, constants.markerImagePath
          ).catchError(print);
          setState(() {
            _markerIcon = _markerBitmapDescriptor;
          });
        }
      }
    

    In the build method: _createMarkerFromImageAsset(context);

    Called when a successful response from our API is obtained:

    void _addMarkers() {
        Set<Marker> _m = {};
        for(Store store in stores) {
          _m.add(
            Marker(
              icon: _markerIcon,
              markerId: MarkerId('$storeId'),
              position: LatLng(
                store.latitude, store.longitude
              ),
              consumeTapEvents: true,
              onTap: () => _toStoreDetails(store),
            ),
          );
        }
        setState(() {
          _markers = _m;
        });
    }
    

    Thanks!

    opened by lucascolli 7
  • Added the anchor parameter to markers

    Added the anchor parameter to markers

    I added the anchor parameter to the Marker class constructor. I need this parameter because I'm using a custom icon for my markers which have a different anchor than the default one.

    Fixes #16

    opened by janoschp 6
  • [iOS] Scroll becomes locked when using in combination with 'sliding_up_panel'

    [iOS] Scroll becomes locked when using in combination with 'sliding_up_panel'

    I have a strange behaviour when using a PlaformMap in a SlidingUpPanel (from sliding_up_panel package), the scroll works at first but then stop working after opening and closing the panel.

    import 'package:flutter/material.dart';
    import 'package:platform_maps_flutter/platform_maps_flutter.dart';
    import 'package:sliding_up_panel/sliding_up_panel.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: MyHomePage(),
        );
      }
    }
    
    class MyHomePage extends StatelessWidget {
      MyHomePage({
        Key key,
      }) : super(key: key);
    
      Widget _map() {
        return PlatformMap(
          initialCameraPosition: CameraPosition(
            target: const LatLng(47.6, 8.8796),
            zoom: 16.0,
          ),
          markers: Set<Marker>.of(
            [
              Marker(
                markerId: MarkerId('marker_1'),
                position: LatLng(47.6, 8.8796),
                consumeTapEvents: true,
                infoWindow: InfoWindow(
                  title: 'PlatformMarker',
                  snippet: "Hi I'm a Platform Marker",
                ),
                onTap: () {
                  print("Marker tapped");
                },
              ),
            ],
          ),
          myLocationEnabled: true,
          myLocationButtonEnabled: true,
          onTap: (location) => print('onTap: $location'),
          onCameraMove: (cameraUpdate) => print('onCameraMove: $cameraUpdate'),
          compassEnabled: true,
          onMapCreated: (controller) {
            Future.delayed(Duration(seconds: 2)).then(
              (_) {
                controller.animateCamera(
                  CameraUpdate.newCameraPosition(
                    const CameraPosition(
                      bearing: 270.0,
                      target: LatLng(51.5160895, -0.1294527),
                      tilt: 30.0,
                      zoom: 18,
                    ),
                  ),
                );
              },
            );
          },
        );
      }
    
      @override
      Widget build(BuildContext context) {
        return SlidingUpPanel(
          panel: Center(
            child: Text("This is the sliding Widget"),
          ),
          body: _map(), // <----
        );
      }
    }
    
    bug 
    opened by aloisdeniel 6
  • Custom marker icon placement point

    Custom marker icon placement point

    It seems like the marker icon is always placed by the center if you use a custom marker icon. I know there's a way to control the relative placement point for both Google maps API and IOS, so can we get that exposed via this API?

    enhancement 
    opened by fbazbo 4
  • IOS: onTap function never gets called for InfoWindow onTap

    IOS: onTap function never gets called for InfoWindow onTap

    Basically used the example with the controller Future removed and an onTap event added to InfoWindow

    
    import 'package:platform_maps_flutter/platform_maps_flutter.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: MyHomePage(),
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      MyHomePage({Key key}) : super(key: key);
    
      @override
      _MyHomePageState createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: Container(
    //        width: 300,
    //        height: 300,
            child: PlatformMap(
              initialCameraPosition: CameraPosition(
                target: const LatLng(47.6, 8.8796),
                zoom: 16.0,
              ),
              markers: Set<Marker>.of(
                [
                  Marker(
                    markerId: MarkerId('marker_1'),
                    position: LatLng(47.6, 8.8796),
                    consumeTapEvents: true,
                    infoWindow: InfoWindow(
                      title: 'PlatformMarker',
                      snippet: "Hi I'm a Platform Marker",
                      onTap: () {
                        print('InfoWindow tapped');
                      }
                    ),
                    onTap: () {
                      print("Marker tapped");
                    },
                  ),
                ],
              ),
              mapType: MapType.satellite,
              onTap: (location) => print('onTap: $location'),
              onCameraMove: (cameraUpdate) => print('onCameraMove: $cameraUpdate'),
              compassEnabled: true,
              onMapCreated: (controller) {
              },
            ),
          ),
        );
      }
    }
    

    Also, is there any way to display the InfoWindow programmatically? Or at least a property indicating if its displayed at render time or not... thanks... this is a really useful map plugin so keep up the good work...

    bug 
    opened by fbazbo 4
  • Cannot build with Dart 2.16 and Flutter 2.10.0 on Android

    Cannot build with Dart 2.16 and Flutter 2.10.0 on Android

    Cannot build with Dart 2.16 and Flutter 2.10.0 on Android When I updated to Dart 2.16 and Flutter 2.10.0 I cannot build my Flutter project which was working before .

    Could it be any depedency of apple_maps_flutter plugin which is not implemented on Android ?

    To Reproduce

    1. After flutter run I got: Launching lib\main.dart on JSN L21 in debug mode... Plugin project :apple_maps_flutter not found. Please update settings.gradle.

    FAILURE: Build failed with an exception.

    • Where: Script 'c:\install\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 421

    • What went wrong: A problem occurred evaluating root project 'android'.

    A problem occurred configuring project ':app'. Cannot invoke method afterEvaluate() on null object

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    • Get more help at https://help.gradle.org

    BUILD FAILED in 3s

    Exception: Gradle task assembleDebug failed with exit code 1

    flutter doctor [√] Flutter (Channel stable, 2.10.0, on Microsoft Windows [Version 10.0.19044.1466], locale cs-CZ) • Flutter version 2.10.0 at c:\install\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 5f105a6ca7 (6 days ago), 2022-02-01 14:15:42 -0800 • Engine revision 776efd2034 • Dart version 2.16.0 • DevTools version 2.9.2

    [√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at C:\Users\xxxxxxxx\AppData\Local\Android\sdk • Platform android-32, build-tools 32.1.0-rc1 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822) • All Android licenses accepted.

    [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.9) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.11.32106.194 • Windows 10 SDK version 10.0.18362.0

    [√] Android Studio (version 2021.1) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

    [√] Connected device (4 available) • JSN L21 (mobile) • MUENW19121002442 • android-arm64 • Android 10 (API 29) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1466] • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80 • Edge (web) • edge • web-javascript • Microsoft Edge 97.0.1072.76

    [√] HTTP Host Availability • All required HTTP hosts are available

    • No issues found!


    Part of app_plugin_loader.gradle:

    def object = new JsonSlurper().parseText(pluginsFile.text) assert object instanceof Map assert object.plugins instanceof Map assert object.plugins.android instanceof List // Includes the Flutter plugins that support the Android platform. object.plugins.android.each { androidPlugin -> assert androidPlugin.name instanceof String assert androidPlugin.path instanceof String def pluginDirectory = new File(androidPlugin.path, 'android') // issue ? assert pluginDirectory.exists() include ":${androidPlugin.name}" project(":${androidPlugin.name}").projectDir = pluginDirectory }

    bug 
    opened by kudelart 3
  • Platform exception - Android

    Platform exception - Android

    FAILURE: Build failed with an exception.

    • What went wrong: A problem occurred configuring root project 'apple_maps_flutter'.

    SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

    Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel master, 1.19.0-2.0.pre.34, on Mac OS X 10.15.4 19E287, locale en-US)

    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 11.4) [✓] Chrome - develop for the web [✓] Android Studio (version 3.5) [✓] VS Code (version 1.45.0) [✓] VS Code (version 1.24.1) [✓] Connected device (4 available)

    • No issues found!

    opened by JayPerfetto 3
  • PlatformException(error, Attempt to invoke virtual method 'float java.lang.Number.floatValue()' on a null object reference, null)

    PlatformException(error, Attempt to invoke virtual method 'float java.lang.Number.floatValue()' on a null object reference, null)

    Hello!

    After upgrading to 0.1.4, I am receiving a platform exception when the view is created. It appears to be Android only. Here is the stacktrace:

    E/MethodChannel#flutter/platform_views( 7589): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:87) E/MethodChannel#flutter/platform_views( 7589): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:51) E/MethodChannel#flutter/platform_views( 7589): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222) E/MethodChannel#flutter/platform_views( 7589): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96) E/MethodChannel#flutter/platform_views( 7589): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656) E/MethodChannel#flutter/platform_views( 7589): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#flutter/platform_views( 7589): at android.os.MessageQueue.next(MessageQueue.java:336) E/MethodChannel#flutter/platform_views( 7589): at android.os.Looper.loop(Looper.java:174) E/MethodChannel#flutter/platform_views( 7589): at android.app.ActivityThread.main(ActivityThread.java:7356) E/MethodChannel#flutter/platform_views( 7589): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#flutter/platform_views( 7589): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E/MethodChannel#flutter/platform_views( 7589): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) E/flutter ( 7589): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'float java.lang.Number.floatValue()' on a null object reference, null) E/flutter ( 7589): #0 StandardMethodCodec.decodeEnvelope package:flutter/…/services/message_codecs.dart:569 E/flutter ( 7589): #1 MethodChannel.invokeMethod package:flutter/…/services/platform_channel.dart:316 E/flutter ( 7589): E/flutter ( 7589): #2 AndroidViewController._create package:flutter/…/services/platform_views.dart:640 E/flutter ( 7589): E/flutter ( 7589): #3 AndroidViewController.setSize package:flutter/…/services/platform_views.dart:557 E/flutter ( 7589): E/flutter ( 7589): #4 RenderAndroidView._sizePlatformView package:flutter/…/rendering/platform_view.dart:174 E/flutter ( 7589): E/flutter ( 7589): #5 RenderAndroidView.performResize package:flutter/…/rendering/platform_view.dart:155 E/flutter ( 7589): #6 RenderObject.layout package:flutter/…/rendering/object.dart:1686 E/flutter ( 7589): #7 RenderStack.performLayout package:flutter/…/rendering/stack.dart:549 E/flutter ( 7589): #8 RenderObject.layout package:flutter/…/rendering/object.dart:1701 E/flutter ( 7589): #9 MultiChildLayoutDelegate.layoutChild package:flutter/…/rendering/custom_layout.dart:142 E/flutter ( 7589): #10 _ScaffoldLayout.performLayout package:flutter/…/material/scaffold.dart:444 E/flutter ( 7589): #11 MultiChildLayoutDelegate._callPerformLayout package:flutter/…/rendering/custom_layout.dart:212 E/flutter ( 7589): #12 RenderCustomMultiChildLayoutBox.performLayout package:flutter/…/rendering/custom_layout.dart:356 E/flutter ( 7589): #13 RenderObject.layout package:flutter/…/rendering/object.dart:1701 E/flutter ( 7589): #14 RenderProxyBoxMixin.performLayout package:flutter/…/rendering/proxy_box.dart:105 E/flutter ( 7589): #15 RenderObject.layout package:flutter/…/rendering/object.dart:17

    Thanks!

    opened by lucascolli 3
  • iOS Corner Radius

    iOS Corner Radius

    Attempting to clip using a border-radius does not work on iOS. I guess the only way to do so is by having the plugin expose the iOS's MKMapView.layer.cornerRadius as a property.

    Card(
      margin: EdgeInsets.all(2.0),
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(4.0),
      ),
      clipBehavior: Clip.antiAlias,
      color: Colors.black.withOpacity(0.35),
      child: Container(
        height: 200,
        child: PlatformMap(
          initialCameraPosition: CameraPosition(
            target: const LatLng(47.6, 8.8796),
            zoom: 16.0,
          ),
          markers: Set<Marker>.of(
            [
              Marker(
                markerId: MarkerId('marker_1'),
                position: LatLng(47.6, 8.8796),
                consumeTapEvents: true,
                infoWindow: InfoWindow(
                  title: 'PlatformMarker',
                  snippet: "Hi I'm a Platform Marker",
                ),
                onTap: () {
                  print("Marker tapped");
                },
              ),
            ],
          ),
          onTap: (location) => print('onTap: $location'),
          onCameraMove: (cameraUpdate) => print('onCameraMove: $cameraUpdate'),
          compassEnabled: true,
          onMapCreated: (controller) {
            Future.delayed(Duration(seconds: 2)).then(
              (_) {
                controller.animateCamera(
                  CameraUpdate.newCameraPosition(
                    const CameraPosition(
                      bearing: 270.0,
                      target: LatLng(51.5160895, -0.1294527),
                      tilt: 30.0,
                      zoom: 18,
                    ),
                  ),
                );
              },
            );
          },
        ),
      ),
    );
    
    opened by zgosalvez 2
  • IOS: getting errors in Xcode after upgrade

    IOS: getting errors in Xcode after upgrade

    Error output from Xcode build:
    ↳
        ** BUILD FAILED **
    
    
    Xcode's output:
    ↳
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:2: error: invalid component of Swift key path
        \(CGFloat(annotation.calloutOffset.y))")
         ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:1: error: expression type 'WritableKeyPath<_, _>' is ambiguous without more context
        \(CGFloat(annotation.calloutOffset.y))")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:119:68: error: extra argument 'whereSeparator' in call
                    let lines = annotation.subtitle?.split(whereSeparator: \.isNewline)
                                                                           ^~~~~~~~~~~
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        /Users/me/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/apple_maps_flutter-0.1.2+4/ios/Classes/Annotations/AnnotationController.swift:114:39: error: unterminated string literal
        \(CGFloat(annotation.calloutOffset.y))")
                                              ^
        note: Using new build system
        note: Planning build
        note: Constructing build description
    
    Could not build the application for the simulator.
    Error launching application on iPad Air (3rd generation).
    
    
    opened by fbazbo 2
  • Location When In Use Usage Description is required even when not using user's location

    Location When In Use Usage Description is required even when not using user's location

    Even though I am using the user's location, I am still required to enter Location Description. This should not be the case if the location is not used.

    bug 
    opened by badarovska 0
  • Map keeps crashing my app on Android

    Map keeps crashing my app on Android

    This component keeps crashing my app all the time on Android. On IOS it is crash-free.

    My app uses bottom navigation bar. When navigating by it, going back and forward between tabs, app crashed inexpectedly on a page that contains a Gooogle Maps map on Android by your component. It not consistant, sometimes it crashes, sometimes not, anyway it does it very often.

    StackTrace: E/AndroidRuntime(13799): FATAL EXCEPTION: GLThread 139 E/AndroidRuntime(13799): Process: com.x.y, PID: 13799 E/AndroidRuntime(13799): java.lang.NullPointerException: Attempt to get length of null array E/AndroidRuntime(13799): at java.nio.ByteBufferAsIntBuffer.put(ByteBufferAsIntBuffer.java:122) E/AndroidRuntime(13799): at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.i(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):2) E/AndroidRuntime(13799): at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.d(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):3) E/AndroidRuntime(13799): at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.d.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):2) E/AndroidRuntime(13799): at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):12) E/AndroidRuntime(13799): at com.google.maps.api.android.lib6.gmm6.vector.bz.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):29) E/AndroidRuntime(13799): at com.google.maps.api.android.lib6.gmm6.vector.bs.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):151) E/AndroidRuntime(13799): at com.google.maps.api.android.lib6.gmm6.vector.av.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):48) D/OpenGLRenderer(13799): setSurface called with nullptr D/OpenGLRenderer(13799): setSurface() destroyed EGLSurface D/OpenGLRenderer(13799): destroyEglSurface 3 D/OpenGLRenderer(13799): setSurface called with nullptr I/Process (13799): Sending signal. PID: 13799 SIG: 9 Lost connection to device.

    I tried it on 2 physical devices, it happens on both of them:

    • SM A520F (mobile), Android 8.0.0 (API 26)
    • SM A525F (mobile), Android 12 (API 31)

    Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-x64, locale hu-HU) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2020.3) [✓] VS Code (version 1.68.1) [✓] Connected device (5 available) [✓] HTTP Host Availability

    bug 
    opened by tmatrai 1
  • Made package work on Flutter >=2.10

    Made package work on Flutter >=2.10

    This commit simply updates the apple_maps_flutter version so that the app can build on Flutter 2.10 or greater. This fix was implemented in apple_maps_flutter release 1.0.2.

    I'm unsure if the changes are needed in

    • example/ios/Flutter/AppFrameworkInfo.plist
    • example/ios/Podfile.lock
    • example/ios/Runner.xcodeproj/project.pbxproj
    • or example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme.

    Pre-launch Checklist

    • [x] I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy].
    • [x] I updated CHANGELOG.md to add a description of the change.
    • [x] I updated/added relevant documentation (doc comments with ///).
    • [x] I added new tests to check the change I am making if a test is possible.
    • [x] All existing and new tests are passing.
    opened by ChopinDavid 0
  • opened zIndex parameter for Marker object of PlatformMap

    opened zIndex parameter for Marker object of PlatformMap

    Opened 'zIndex' parameter for PaltformMap which supplies the param to Annotations and Marker objects of appleMaps and googleMaps respectively.

    Related issue #31

    opened by SamvitChrungoo 0
  • Enhancement for Polyline::onTap

    Enhancement for Polyline::onTap

    Is your feature request related to a problem? Please describe. I use polylines to circumscribe a region (defined by markers) and when a user click on a Polyline I want to add a marker where they tap and insert the marker into my marker list. Currently, when a user taps on the Polyline, I have no way of telling where they selected. This requires me to calculate the midpoint and drop the marker there. The user then has to drag the marker to the final destination which is annoying for the user.

    Describe the solution you'd like I would like the Polyline onTap method to pass the the Polyline selected and the position on the map they tapped

    eg. line.onTap = process(Polyline polyline, LatLng position) => do stuff

    Providing the Polyline (that was tapped) allows generic functions to be used (not required, but nice to have) Providing the position allows an application to reason about where on the line the tap occurs. In may case, the position to drop the marker

    Describe alternatives you've considered Currently calculate the midpoint of the Polyline. This is annoying for the user as they have to reposition the marker

    enhancement 
    opened by kuzmycz 0
Releases(v1.0.2)
Owner
Luis Thein
Luis Thein
A migration of Google Maps Application with Flutter & Google Maps APIs including: Maps SDK for Android & IOS, Places API & polylines

google_maps A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

TAD 1 Mar 4, 2022
Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL

Mapbox GL Native A C++ library that powers customizable vector maps in native applications on multiple platforms by taking stylesheets that conform to

Mapbox 4.2k Jan 6, 2023
Flutter Maps A Flutter app using Google Maps SDK & Directions API

Flutter Maps A Flutter app using Google Maps SDK & Directions API Plugins The plugins used in this project are: google_maps_flutter geolocator flutter

Salsabil Mohamed Hemada 1 Jul 15, 2022
A Flutter plugin for integrating Google Maps in iOS, Android and Web applications

flutter_google_maps A Flutter plugin for integrating Google Maps in iOS, Android and Web applications. It is a wrapper of google_maps_flutter for Mobi

MarchDev Toolkit 86 Sep 26, 2022
This is a Flutter package that uses the Google Maps API to make a TextField that tries to autocomplete places as the user types, with simple smooth animations, making a nice UI and UX.

search_map_place This is a Flutter package that uses the Google Maps API to make a TextField that tries to autocomplete places as the user types, with

Lucas Bernardi 127 Oct 22, 2022
Here Maps Package for Flutter

here_maps_webservice About here_maps_webservice provides Here Maps Web Services API wrapper that serve different purposes from search, to geocoding. U

Ayush Bherwani 11 Dec 15, 2022
A Mapbox GL flutter package for creating custom maps

Flutter Mapbox GL Please note that this project is community driven and is not an official Mapbox product. We welcome feedback and contributions. This

flutter-mapbox-gl 917 Dec 31, 2022
Flutter package to enable clustering of location markers on Google Maps using widgets specific to each location.

flutter_google_maps_widget_cluster_markers This widget implements a very specific adaptation of google_maps_cluster_manager, allowing different ,marke

Kek Tech 2 Jan 6, 2023
Mapbox-flutter - A repository to demonstrate the use of Mapbox - it's Maps and Navigation SDKs in a Flutter application

MapBox Flutter This repository contains code corresponding to the Youtube video

AB Satyaprakash 39 Dec 30, 2022
A flutter plugin for Google Maps

IMPORTANT: This plugin is no longer under development Why? We initially built this plugin to fill an early gap in flutter. Since then, Google has made

AppTree Software, Inc 415 Dec 29, 2022
Flutter Google Maps Tutorial

Flutter Google Maps Tutorial YouTube Video Setup Get an API Key at https://cloud.google.com/maps-platform/ Enable Maps SDK for Android, Maps SDK for i

Marcus Ng 85 Nov 30, 2022
A Flutter app using Google Maps SDK & Directions API

Flutter Maps A Flutter app using Google Maps SDK & Directions API Plugins The plugins used in this project are: google_maps_flutter geolocator flutter

Youhaan bootwala 1 Mar 18, 2022
A Flutter app using Google Maps SDK & Directions API

Flutter Maps A Flutter app using Google Maps SDK & Directions API Plugins The plugins used in this project are: google_maps_flutter geolocator flutter

Varun CN 2 Apr 19, 2022
Easy Google Maps for Flutter

easy_google_maps Easy Google Maps for Flutter on Web and Mobile Getting Started Mobile Follow setup for Mobile Here Web Good to go! EasyGoogleMaps(

Rody Davis 69 Jul 19, 2022
Apple Maps Plugin for Flutter

apple_maps_flutter A Flutter plugin that provides an Apple Maps widget. The plugin relies on Flutter's mechanism for embedding Android and iOS views.

Luis Thein 50 Dec 31, 2022
Flutter plugin for launching maps

Map Launcher Map Launcher is a flutter plugin to find available maps installed on a device and launch them with a marker or show directions. Marker Na

Alex Miller 189 Dec 20, 2022
Place picker on Google Maps for Flutter

Google Maps Place Picker A Flutter plugin which provides 'Picking Place' using Google Maps widget. The project relies on below packages. Map using Flu

Terry Kwon 178 Dec 16, 2022
A car rental flutter application using firebase and google maps API

A car sharing & rental app using Flutter, Firebase & Google Maps APIs ?? About the App ?? hopOn is flutter based application for car sharing and renta

Shivani Singh 97 Dec 30, 2022
Simple flutter app demonstrating usage of Google Maps

flutter_maps_example Get an API key at GoogleCloud. Enable Google Map SDK for ea

Tornike Gogberashvili 0 Nov 23, 2022