A Flutter plugin for integrating Google Maps in iOS, Android and Web applications

Overview

flutter_google_maps

Build Pub GitHub GitHub stars

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

Getting Started

  • Get an API key at https://cloud.google.com/maps-platform/.

  • Enable Google Map SDK for each platform.

    • Go to Google Developers Console.
    • Choose the project that you want to enable Google Maps on.
    • Select the navigation menu and then select "Google Maps".
    • Select "APIs" under the Google Maps menu.
    • To enable Google Maps for Android, select "Maps SDK for Android" in the "Additional APIs" section, then select "ENABLE".
    • To enable Google Maps for iOS, select "Maps SDK for iOS" in the "Additional APIs" section, then select "ENABLE".
    • Make sure the APIs you enabled are under the "Enabled APIs" section.
  • You can also find detailed steps to get start with Google Maps Platform here.

Web

">
<body>
  <script src="https://maps.googleapis.com/maps/api/js?key=API_KEY">script>
  <script src="main.dart.js" type="application/javascript">script>
body>

Android

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

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

iOS

Specify your API key in the application delegate ios/Runner/AppDelegate.m:

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GMSServices provideAPIKey:@"YOUR KEY HERE"];
  [GeneratedPluginRegistrant registerWithRegistry:self];
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end

Or in your swift code, specify your API key in the application delegate ios/Runner/AppDelegate.swift:

import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GMSServices.provideAPIKey("YOUR KEY HERE")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Opt-in to 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.

Android/iOS Directions API

Add in your main.dart within main function GoogleMap.init('API_KEY'); before running the app.

void main() {
  GoogleMap.init('API_KEY');
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
}

For more info about mobile map setup, view google_maps_flutter plugin.

Add GoogleMap Widget

import 'package:flutter/material.dart';
import 'package:flutter_google_maps/flutter_google_maps.dart';

...
GlobalKey<GoogleMapStateBase> _key = GlobalKey<GoogleMapStateBase>();

@override
Widget build(BuildContext context) => GoogleMap(
  key: _key,
),
...

And now you're ready to go.

Examples

GoogleMap widget can be configured with:

Property Type Description
initialPosition GeoCoord The initial position of the map's camera
initialZoom double The initial zoom of the map's camera
mapType MapType Type of map tiles to be rendered
minZoom double The preferred minimum zoom level or null, if unbounded from below
maxZoom double The preferred maximum zoom level or null, if unbounded from above
mapStyle String Sets the styling of the base map
mobilePreferences MobileMapPreferences Set of mobile map preferences
webPreferences WebMapPreferences Set of web map preferences
interactive bool Defines whether map is interactive or not
onTap ValueChanged Called every time a GoogleMap is tapped
onLongPress ValueChanged Called every time a GoogleMap is long pressed (for web when right mouse clicked)
markers Set Markers to be placed on the map

MapType is one of following variants:

  • none -> do not display map tiles
  • roadmap -> normal tiles (traffic and labels, subtle terrain information)
  • satellite -> satellite imaging tiles (aerial photos)
  • terrain -> terrain tiles (indicates type and height of terrain)
  • hybrid -> hybrid tiles (satellite images with some labels/overlays)

MobileMapPreferences can be configured with:

Property Type Description
compassEnabled bool True if the map should show a compass when rotated
mapToolbarEnabled bool True if the map should show a toolbar when you interact with the map. Android only
myLocationEnabled bool True if a "My Location" layer should be shown on the map
myLocationButtonEnabled bool Enables or disables the my-location button
indoorViewEnabled bool Enables or disables the indoor view from the map
trafficEnabled bool Enables or disables the traffic layer of the map
buildingsEnabled bool Enables or disables showing 3D buildings where available
padding EdgeInsets Padding to be set on mapdetails
rotateGesturesEnabled bool True if the map view should respond to rotate gestures
scrollGesturesEnabled bool True if the map view should respond to scroll gestures
zoomGesturesEnabled bool True if the map view should respond to zoom gestures
tiltGesturesEnabled bool True if the map view should respond to tilt gestures

WebMapPreferences can be configured with:

Property Type Description
streetViewControl bool Enables or disables streetViewControl
fullscreenControl bool Enables or disables fullscreenControl
mapTypeControl bool Enables or disables mapTypeControl
scrollwheel bool Enables or disables scrollwheel
panControl bool Enables or disables panControl
overviewMapControl bool Enables or disables overviewMapControl
rotateControl bool Enables or disables rotateControl
scaleControl bool Enables or disables scaleControl
zoomControl bool Enables or disables zoomControl
dragGestures bool Enables or disables flutter drag gestures

To prepare for interacting with GoogleMap you will need to:

Create a key and assign it to the GoogleMap widget.

GoogleMap widget has 2 static methods, they are:

  • MapOperations of(GlobalKey key);

    Gets [MapOperations] interface via provided key of [GoogleMapStateBase] state.

  • void init(String apiKey);

    Initializer of [GoogleMap]. Required if Directions API will be needed. For other cases, could be ignored.

To interact with GoogleMap you'll need to:

Use static of method

Here's list of interactions:

  • Move camera to the new bounds

    void moveCameraBounds(
      GeoCoordBounds newBounds, {
      double padding = 0,
      bool animated = true,
      bool waitUntilReady = true,
    });
  • Move camera to the new coordinates

    void moveCamera(
      GeoCoord latLng, {
      bool animated = true,
      bool waitUntilReady = true,
      double zoom,
    });
  • Zoom camera

    void zoomCamera(
      double zoom, {
      bool animated = true,
      bool waitUntilReady = true,
    });
  • Get center coordinates of the map

    FutureOr<GeoCoord> get center;
  • Change Map Style.

    The style string can be generated using map style tool. Also, refer iOS and Android style reference for more information regarding the supported styles.

    void changeMapStyle(String mapStyle);
  • Add marker to the map by given [position]

    void addMarkerRaw(
      GeoCoord position, {
      String label,
      String icon,
      String info,
      ValueChanged<String> onTap,
      VOidCallback onInfoWindowTap,
    });

Please note: [icon] could be a path to an image asset or it could be an instance of ByteString.

  • Add marker to the map by given [marker] object

    void addMarker(Marker marker);
  • Remove marker from the map by given [position]

    void removeMarker(GeoCoord position);
  • Remove all markers from the map

    void clearMarkers();
  • Add direction to the map by given [origin] and [destination] coordinates

    void addDirection(
      dynamic origin,
      dynamic destination, {
      String startLabel,
      String startIcon,
      String startInfo,
      String endLabel,
      String endIcon,
      String endInfo,
    });
  • Remove direction from the map by given [origin] and [destination] coordinates

    void removeDirection(dynamic origin, dynamic destination);
  • Remove all directions from the map

    void clearDirections();
  • Add polygon to the map by given [id] and [points]

    void addPolygon(
      String id,
      Iterable<GeoCoord> points, {
      ValueChanged<String> onTap,
      Color strokeColor = const Color(0x000000),
      double strokeOpacity = 0.8,
      double strokeWidth = 1,
      Color fillColor = const Color(0x000000),
      double fillOpacity = 0.35,
    });
  • Edit polygon on the map by given [id] and [points]

    void editPolygon(
      String id,
      Iterable<GeoCoord> points, {
      ValueChanged<String> onTap,
      Color strokeColor = const Color(0x000000),
      double strokeOpacity = 0.8,
      double strokeWeight = 1,
      Color fillColor = const Color(0x000000),
      double fillOpacity = 0.35,
    });
  • Remove polygon from the map by given [id].

    void removePolygon(String id);
  • Remove all polygones from the map.

    void clearPolygons();

Feature requests and Bug reports

Feel free to post a feature requests or report a bug here.

TODO

  • Add circles support
  • Add polyline support
Comments
  • Unhandled Exception: NoSuchMethodError: The method 'animateCamera' was called on null.

    Unhandled Exception: NoSuchMethodError: The method 'animateCamera' was called on null.

    void fitCameraToMarkers(List<DbPhoto> entries)
      {
        var bounds = GeoCoordBounds(southwest: GeoCoord(entries.first.lat, entries.first.lng), northeast: GeoCoord(entries.first.lat, entries.first.lng));
        GoogleMap.of(_key).moveCamera(bounds, padding: 20, animated: true);
      }
    

    Launching on iOS simulator, map loads fine, markers add fine, but when I call this method, I get

    [VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method 'animateCamera' was called on null.
    Receiver: null
    Tried calling: animateCamera(Instance of 'CameraUpdate')
    #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
    #1      GoogleMapState.moveCamera (package:flutter_google_maps/src/mobile/google_map.state.dart:57:19)
    #2      _MapScreenState.fitCameraToMarkers (package:mapphotos/maincontent/map/MapScreen.dart:59:24)
    #3      new _MapScreenState.<anonymous closure> (package:mapphotos/maincontent/map/MapScreen.dart:32:9)
    #4      _rootRunUnary (dart:async/zone.dart:1134:38)
    #5      _CustomZone.runUnary (dart:async/zone.dart:1031:19)
    #6      _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7)
    #7      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
    #8      _DelayedData.perform (dart:async/stream_impl.dart:594:14)
    #9      _StreamImplEvents.handleNext (dart:async/stream_impl.dart:710:11)
    #10     _PendingEvents.schedule.<anonymous c<…>
    
    bug platform-ios 
    opened by Gintasz 8
  • The getter 'iterator' was called on null.

    The getter 'iterator' was called on null.

    I am getting this error when running in Android (Web is fine)

     ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
    I/flutter (14948): The following NoSuchMethodError was thrown building WebMap:
    I/flutter (14948): The getter 'iterator' was called on null.
    I/flutter (14948): Receiver: null
    I/flutter (14948): Tried calling: iterator
    I/flutter (14948): 
    I/flutter (14948): The relevant error-causing widget was:
    I/flutter (14948):   WebMap
    I/flutter (14948):   file:///home/techrova/Documents/flutter_projects/flutter_complete_guide/lib/selectservice.dart:165:65
    I/flutter (14948): 
    I/flutter (14948): When the exception was thrown, this was the stack:
    I/flutter (14948): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
    I/flutter (14948): #1      GoogleMapState.initState (package:flutter_google_maps/src/mobile/google_map.state.dart:420:31)
    I/flutter (14948): #2      StatefulElement._firstBuild 
    ..............................
    
    
    import 'package:flutter/material.dart';
    import 'package:flutter_google_maps/flutter_google_maps.dart';
    
    
    GlobalKey<GoogleMapStateBase> _key = GlobalKey<GoogleMapStateBase>();
    
    class WebMap extends StatelessWidget
    {
     @override
    Widget build(BuildContext context) => GoogleMap(
      key: _key,
      
    );
    
    }
    

    I added the API Key in Android Manifest . Even the google_maps_flutter plugin working perfectly

    But I am getting error when using this plugin

    please help me

    I am using latest beta channel of flutter .. Device is Android Pie

    opened by RageshAntony 6
  • On click marker listener?

    On click marker listener?

    Hey, I think the plugin has a great potential. I need to open a new screen after a marker on the map is tapped. How can I set a onTap listener? I don't see any parameter in addMarker method.

    proposal 
    opened by Gintasz 5
  • Zoom functions & animateCamera when moveCamera

    Zoom functions & animateCamera when moveCamera

    Proposal

    There are two proposals:

    **· When the camera move to new GeoCoords, it could do it smoothly and with zoom control.

    · Function to zoomCamera (so we could replace the originals buttons by my own buttons).**

    Example:

    GoogleMap.of(_key).moveCamera( bounds,
    animated: true, //Not working, the camera just appear in the new bounds without animation. zoom: 14 );

    GoogleMap.of(_key).zoomCamera( zoom: 14 );

    proposal 
    opened by Pizzacorn 4
  • Image on info window

    Image on info window

    Adding image of a Flutter's Image class on an infowindow, which opens after a marker is tapped, would be a nice feature. If you would add it, make sure lib accepts not a path of image but an object of class Image, so then network images can work too.

    proposal 
    opened by Gintasz 3
  • Crash on iOS: 'Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use'

    Crash on iOS: 'Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use'

    I'm using 3.2.0 and when I run the app I get:

    2020-03-18 21:56:51.171549+0200 Runner[3009:445768] *** Terminating app due to uncaught exception 'GMSServicesException', reason: 'Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use'
    *** First throw call stack:
    (0x21944d27c 0x2186279f8 0x2193574b0 0x1025f9b3c 0x1025f6a38 0x1025e68a8 0x1025e5f80 0x1025e5dc8 0x1029ed9d4 0x1029ed858 0x1052e1d1c 0x105368ed8 0x1052ff228 0x105359a40 0x10530fdec 0x105311be8 0x2193df650 0x2193df380 0x2193debb4 0x2193d9b04 0x2193d90b0 0x21b5d979c 0x245c0f978 0x10203b058 0x218e9e8e0)
    libc++abi.dylib: terminating with uncaught exception of type NSException
    

    Even though I do have the damn GoogleMap.init('IOS_KEY_HERE'); as 1st line in main()

    bug platform-ios 
    opened by Gintasz 3
  • Flutter web not working

    Flutter web not working

    The logs

    Unable to find modules for some sources, this is usually the result of either a                                    
    bad import, a missing dependency in a package (or possibly a dev_dependency
    needs to move to a real dependency), or a build failure (if importing a
    generated file).
    
    Please check the following imports:
    
    `import 'package:flutter_google_maps/flutter_google_maps.dart';` from mbungedash|lib/main.dart at 2:1
           
    

    Flutter doctor

    [✓] Flutter (Channel beta, v1.14.6, on Linux, locale en_US.UTF-8)
        • Flutter version 1.14.6 at /home/pato/development/flutter
        • Framework revision fabeb2a16f (6 weeks ago), 2020-01-28 07:56:51 -0800
        • Engine revision c4229bfbba
        • Dart version 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7)
    
     
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
        • Android SDK at /home/pato/Android/Sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-29, build-tools 29.0.3
        • Java binary at: /usr/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~16.04-b08)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • Chrome at google-chrome
    
    [!] Android Studio (not installed)
        • Android Studio not found; download from https://developer.android.com/studio/index.html
          (or visit https://flutter.dev/setup/#android-setup for detailed instructions).
    
    [✓] IntelliJ IDEA Community Edition (version 2019.3)
        • IntelliJ at /snap/intellij-idea-community/208
        • Flutter plugin version 44.0.3
        • Dart plugin version 193.6494.35
    
    [!] VS Code (version 1.42.1)
        • VS Code at /usr/share/code
        ✗ Flutter extension not installed; install from
          https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
    
    [✓] Connected device (2 available)
        • Chrome     • chrome     • web-javascript • Google Chrome 80.0.3987.122
        • Web Server • web-server • web-javascript • Flutter Tools
    
    
    invalid wontfix 
    opened by iampato 3
  • Error received after tap over any map area other than a marker

    Error received after tap over any map area other than a marker

    Environment: Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, v1.17.2, on Linux, locale es_CO.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [✓] Android Studio (version 3.5) [✓] IntelliJ IDEA Community Edition (version 2019.3) [!] VS Code (version 1.41.1) ✗ Flutter extension not installed; install from https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (1 available)

    Dart VM version: 2.7.0 (Unknown timestamp) on "linux_x64"

    Steps to Reproduce

    1. Add a marker
    2. Tap over the marker to display the information window.
    3. Tap over any other area over the map

    Expected results: No errors should be displayed after tap in a map area without markers or any other

    Actual results:

    W/perpesos.mobil(20772): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
    E/flutter (20772): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method 'call' was called on null.
    E/flutter (20772): Receiver: null
    E/flutter (20772): Tried calling: call()
    E/flutter (20772): #0      GoogleMapState.build.<anonymous closure>.<anonymous closure> (package:flutter_google_maps/src/mobile/google_map.state.dart:437:46)
    E/flutter (20772): #1      _GoogleMapState.onTap (package:google_maps_flutter/src/google_map.dart:352:19)
    E/flutter (20772): #2      GoogleMapController._connectStreams.<anonymous closure> (package:google_maps_flutter/src/controller.dart:90:52)
    E/flutter (20772): #3      _rootRunUnary (dart:async/zone.dart:1192:38)
    E/flutter (20772): #4      _CustomZone.runUnary (dart:async/zone.dart:1085:19)
    E/flutter (20772): #5      _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)
    E/flutter (20772): #6      CastStreamSubscription._onData (dart:_internal/async_cast.dart:83:11)
    E/flutter (20772): #7      _rootRunUnary (dart:async/zone.dart:1192:38)
    E/flutter (20772): #8      _CustomZone.runUnary (dart:async/zone.dart:1085:19)
    E/flutter (20772): #9      _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)
    E/flutter (20772): #10     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
    

    My widget code:

    import 'dart:core';
    import 'dart:async';
    import 'package:flutter/material.dart';
    import 'package:flutter_bloc/flutter_bloc.dart';
    import 'package:geolocator/geolocator.dart';
    import 'package:flutter_google_maps/flutter_google_maps.dart';
    import 'package:spmobile/src/bloc/map/map.dart';
    import 'package:spmobile/src/constants/navigation.dart';
    import 'package:spmobile/src/core_services/constants_provider.dart';
    import 'package:spmobile/src/models/Commerce.dart';
    
    class MapWidget extends StatefulWidget {
      @override
      _MapWidgetState createState() => _MapWidgetState();
    }
    
    class _MapWidgetState extends State<MapWidget> {
    
      Position position;
      final _key = GlobalKey<GoogleMapStateBase>();
    
      String _mapStyle;
    
      _setCurrentPosition() async {
        position = await _getCurrentPosition();
      }
    
      GeoCoordBounds boundsFromLatLngList(List<GeoCoord> list) {
        assert(list.isNotEmpty);
        double x0, x1, y0, y1;
        for (GeoCoord latLng in list) {
          if (x0 == null) {
            x0 = x1 = latLng.latitude;
            y0 = y1 = latLng.longitude;
          } else {
            if (latLng.latitude > x1) x1 = latLng.latitude;
            if (latLng.latitude < x0) x0 = latLng.latitude;
            if (latLng.longitude > y1) y1 = latLng.longitude;
            if (latLng.longitude < y0) y0 = latLng.longitude;
          }
        }
        return GeoCoordBounds(northeast: GeoCoord(x1, y1), southwest: GeoCoord(x0, y0));
      }
    
      Future<Position> _getCurrentPosition() async {
        Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
        if (position != null) {
          return position;
        }
      }
      
      @override
      void initState() {
        GoogleMap.init(ConstantsProvider.GOOGLE_API_KEY);
        WidgetsFlutterBinding.ensureInitialized();
        _setCurrentPosition();
      }
    
      @override
      Widget build(BuildContext context) {
        final MapBloc _mapBloc = BlocProvider.of<MapBloc>(context);
    
        return BlocListener(
          bloc: _mapBloc,
          listener: (context, state){
          },
          child: BlocBuilder(
            bloc: _mapBloc,
            builder: (context, state) {
              if(state is ShowCompaniesInMapState) {
                if(GoogleMap.of(_key) != null) {
                  GoogleMap.of(_key).clearMarkers();
                  List<GeoCoord> _positions = [];
                  /// Add current location coordinates
                  if (position != null) {
                    _positions.add(GeoCoord(position.latitude, position.longitude));
                  }
                  state.records.forEach((Commerce element) {
                  if (element != null) {
                    _positions.add(GeoCoord(element.location[1], element.location[0]));
                    GoogleMap.of(_key).addMarkerRaw(
                      GeoCoord(element.location[1], element.location[0]),
                      icon: 'assets/images/icons/sp_pin.png',
                      info: '${element.commerceName}',
                      infoSnippet: """Direccion: ${element.address}""",
                      label: ' NIT: ${element.nit}',
                      onInfoWindowTap: () async {
                        Navigator.of(context).pushNamed(companyDetail);
                      },
                    );
                  }
                });
                GoogleMap.of(_key).moveCamera(
                    boundsFromLatLngList(_positions), padding: 100, animated: false
                );
              }
            }
              return Center(
                child: Container(
                  child: GoogleMap(
                    key: _key,
                    initialZoom: 14,
                    initialPosition: GeoCoord(4.707756, -74.073209),
                    mapType: MapType.roadmap,
                    mapStyle: _mapStyle,
                    interactive: true,
                    mobilePreferences: const MobileMapPreferences(
                      trafficEnabled: false,
                    ),
                  ),
                ),
              );
            },
          ),
        );
      }
    }
    
    bug 
    opened by hackerunet 2
  • [BUG 🐞] GoogleMap widget listen/respond to touches even if there is another widget/dialog on top of it

    [BUG 🐞] GoogleMap widget listen/respond to touches even if there is another widget/dialog on top of it

    Steps to Reproduce

    1. Put GoogleMap widget in a stack`.
    2. put a small container in the stack together with the map widget to block clicks from reaching map widget at the area covered by the container

    Expected results: Clicks on container area should not be sent to map widget

    Actual results: map widget listens/responds to clicks on the container blocking it. which is not what we are expecting

    Code
    Stack(
       children: <Widget>[
           _mapWidget(),
           mapOverlay(),
       ],
    )
    
    _mapWidget() {
        var _loc = GeoCoord(
          14.659334,
          31.542844,
        );
        var _zoom = 11.0;
    
        return new GoogleMap(
          key: mapKey_newJob,
          // markers: markers,
          minZoom: 11, // how far camera is
          maxZoom: 18, // how close camara is
          initialPosition: _loc,
          initialZoom: _zoom,
          mapType: MapType.roadmap,
          mobilePreferences: MobileMapPreferences(
            tiltGesturesEnabled: false,
            rotateGesturesEnabled: false,
            mapToolbarEnabled: false,
            myLocationEnabled: false,
          ),
          webPreferences: WebMapPreferences(
            // fullscreenControl: false,
            mapTypeControl: false,
            rotateControl: false,
            streetViewControl: false,
            zoomControl: true,
            // overviewMapControl: false,
          ),
          onTap: (tapLoc) async {
            if (isFetchingAddress) {
              return;
            }
            GoogleMap.of(mapKey_newJob).clearMarkers();
            GoogleMap.of(mapKey_newJob).addMarkerRaw(
              tapLoc,
              icon: 'assets/imgs/requesterLocation_01.png',
              info: 'Lat:${tapLoc.latitude}, Lng:${tapLoc.latitude}',
            );
          },
        );
      }
    
      mapOverlay() {
        return Padding(
            padding: const EdgeInsets.all(10),
            child: Stack(
              children: <Widget>[
                // pickLocationTxtWgt(),
                // removeLocationBtn(),
                searchDisplayAddressWgt(),
              ],
            ),
          );
      }
    
    duplicate platform-web 
    opened by ramioooz 2
  • Marker Icon on android doesn't change

    Marker Icon on android doesn't change

    Hi all,

    I have been trying to change the default marker Icon on android application, but it doesn't work. I tried the same configuration on web and it worked.

    image

    Thanks in advanced,

    opened by dhs9004 2
  • Fixed bug when app crash, when there's no any marker on mobile map

    Fixed bug when app crash, when there's no any marker on mobile map

    Description

    Mobile app crash when there's no any markers. I did a change in mobile google_map_state where I'm checking if widget.markers != null

    Related Issues

    https://github.com/marchdev-tk/flutter_google_maps/issues/26

    Checklist

    Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

    • [x ] I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
    • [x ] I updated/added relevant documentation (doc comments with ///).
    • [ x] All existing and new tests are passing.
    • [x ] The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
    • [x ] I am willing to follow-up on review comments in a timely manner.

    Breaking Change

    Did any tests fail when you ran them?

    • [x ] No, no existing tests failed, so this is not a breaking change.
    • [ ] Yes, this is a breaking change. If not, delete the remainder of this section.
      • [ ] I wrote a design doc: https://flutter.dev/go/template Replace this with a link to your design doc's short link
      • [ ] I got input from the developer relations team, specifically from: Replace with the names of who gave advice
      • [ ] I wrote a migration guide: Replace with a link to your migration guide
    opened by Chojecki 2
  • Google map crash with size error

    Google map crash with size error

    here is the error:

    Creating a virtual display of size: [720, 2222222] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [720, 1440].

    opened by mostafasaadamin 0
  • Issue when using this for Flutter Web

    Issue when using this for Flutter Web

    Description

    crossplatform_google_maps-4.1.0/lib/src/web/utils.dart:46:3: Error: Type 'MapTypeStyleElementType' not found. crossplatform_google_maps-4.1.0/lib/src/web/utils.dart:146:3: Error: Type 'MapTypeStyler' not found.

    Related Issues

    Replace this paragraph with a list of issues related to this PR from our issue database. Indicate, which of these issues are resolved or fixed by this PR. There should be at least one issue listed here.

    Tests

    I added the following tests:

    Replace this with a list of the tests that you added as part of this PR. A change in behaviour with no test covering it will likely get reverted accidentally sooner or later. PRs must include tests for all changed/updated/fixed behaviors. See Test Coverage.

    Checklist

    Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

    • [ ] I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
    • [ ] I updated/added relevant documentation (doc comments with ///).
    • [ ] All existing and new tests are passing.
    • [ ] The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
    • [ ] I am willing to follow-up on review comments in a timely manner.

    Breaking Change

    Did any tests fail when you ran them?

    • [ ] No, no existing tests failed, so this is not a breaking change.
    • [ ] Yes, this is a breaking change. If not, delete the remainder of this section.
      • [ ] I wrote a design doc: https://flutter.dev/go/template Replace this with a link to your design doc's short link
      • [ ] I got input from the developer relations team, specifically from: Replace with the names of who gave advice
      • [ ] I wrote a migration guide: Replace with a link to your migration guide
    opened by ajayshilwant 0
  • [BREAKING CHANGE] update to null-safety

    [BREAKING CHANGE] update to null-safety

    Description

    • updated the code to null-safety
    • updated all dependencies to their latest versions
    • [BREAKING CHANGE] WebMapStyleExtension has been removed in the process due to being removed from the underlying package (google_maps) as well

    Related Issues

    • closes #66
    • closes #74
    • closes #76
    opened by IVLIVS-III 1
  • version solving failed.

    version solving failed.

    HI, i am trying to add this lib into my project but i am getting this below error, Pls see and guide me.

    Because image_picker >=0.8.2 depends on image_picker_platform_interface ^2.2.0 and no versions of image_picker_platform_interface match >2.2.0 <3.0.0, image_picker >=0.8.2 requires image_picker_platform_interface 2.2.0.
    And because image_picker_platform_interface 2.2.0 depends on http ^0.13.0 and flutter_google_maps >=3.8.0 depends on http ^0.12.1, image_picker >=0.8.2 is incompatible with flutter_google_maps >=3.8.0.
    So, because marketplace_service_provider depends on both flutter_google_maps ^4.0.0 and image_picker ^0.8.3+1, version solving failed.
    pub get failed (1; So, because marketplace_service_provider depends on both flutter_google_maps ^4.0.0 and image_picker ^0.8.3+1, version solving failed.)
    

    yaml file:

    environment:
      sdk: ">=2.7.0 <3.0.0"
    
    dependencies:
      flutter:
        sdk: flutter
      dio: ^4.0.0
      connectivity: ^3.0.6        #ANDROID IOS MACOS WEB
      shared_preferences: ^2.0.6  #ANDROID IOS LINUX MACOS WEB WINDOWS
      package_info_plus: ^1.0.4   #ANDROID IOS LINUX MACOS WEB WINDOWS
      device_info_plus: ^2.1.0    #ANDROID IOS LINUX MACOS WEB WINDOWS
      fluttertoast: ^8.0.8        #ANDROID IOS WEB
      get_it: ^7.1.3             #ANDROID IOS LINUX MACOS WEB WINDOWS
      rxdart: ^0.27.1            #ANDROID IOS LINUX MACOS WEB WINDOWS
      flutter_overlay_loader: ^0.1.1 #ANDROID IOS LINUX MACOS WEB WINDOWS
      badges: ^2.0.1                 #ANDROID IOS LINUX MACOS WEB WINDOWS
      html: ^0.15.0                 #ANDROID IOS LINUX MACOS WEB WINDOWS
      flutter_inner_drawer: ^1.0.0+1 #ANDROID IOS LINUX MACOS WEB WINDOWS
      smooth_page_indicator: ^0.2.3  #ANDROID IOS LINUX MACOS WEB WINDOWS
      url_launcher: ^6.0.9            #ANDROID IOS LINUX MACOS WEB WINDOWS
      whatsapp_unilink: ^2.0.0        #ANDROID IOS LINUX MACOS WEB WINDOWS
      pull_to_refresh: ^2.0.0         #ANDROID IOS LINUX MACOS WEB WINDOWS
      flutter_google_maps: ^4.0.0
      image_picker: ^0.8.3+1     #ANDROID IOS WEB
      intl: ^0.17.0              #ANDROID IOS LINUX MACOS WEB WINDOWS
      dotted_border: ^2.0.0      #ANDROID IOS LINUX MACOS WEB WINDOWS
      #google_maps_flutter: ^2.0.6 #ANDROID IOS
      event_bus: ^2.0.0          #ANDROID IOS LINUX MACOS WEB WINDOWS
      location: ^4.3.0           #ANDROID IOS MACOS WEB
      #flutter_html: ^2.0.0     #ANDROID IOS
      #firebase_messaging: ^10.0.4  #ANDROID IOS MACOS WEB
      flutter_local_notifications: ^8.1.1+1   #ANDROID IOS MACOS
      #firebase_core: ^1.4.0                   #ANDROID IOS MACOS WEB
      flutter_native_timezone: ^2.0.0          #ANDROID IOS MACOS WEB
      expandable: ^5.0.1         #ANDROID IOS MACOS WEB
      share_plus: ^2.1.4            #ANDROID IOS MACOS WEB
      video_player: ^2.1.14         #ANDROID IOS WEB
      universal_html: ^2.0.8          #ANDROID IOS WEB
      latlng: ^0.1.0                   #ANDROID IOS WEB
      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^1.0.2
    
    opened by achinverma 1
  • How to auto rotate map with compass?

    How to auto rotate map with compass?

    Is there a feature for auto rotate map with compass?

    Like, if you are in a car and, we turn a corner, theres a way to maps rotate with compass or other way?

    opened by romeumellobr 0
  • Add compatibility with UUID 3.0.4

    Add compatibility with UUID 3.0.4

    Error with the latest UUID package - 3.0.4

    Because <package name> depends on flutter_google_maps 4.0.0 which depends on uuid ^2.1.0, uuid ^2.1.0 is required.
    So, because <package name> depends on uuid 3.0.4, version solving failed.
    
    opened by pepie 3
Owner
MarchDev Toolkit
Code with ease via MarchDev Toolkit
MarchDev Toolkit
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
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
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
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
A flutter plugin that's decodes encoded google poly line string into list of geo-coordinates suitable for showing route/polyline on maps

flutter_polyline_points A flutter plugin that decodes encoded google polyline string into list of geo-coordinates suitable for showing route/polyline

Adeyemo Adedamola 75 Oct 25, 2022
A Flutter plugin which provides 'Picking Place' using Google Maps widget

Google Maps Places Picker Refractored This is a forked version of google_maps_place_picker package, with added custom styling and features.

Varun 5 Nov 13, 2022
A map tour guide mobile app based on Flutter, an AI travel notes product integrating map tour guide and UGC.

A map tour guide mobile app based on Flutter, an AI travel notes product integrating map tour guide and UGC. Through the combination of 5g + AI, colle

null 24 Jan 14, 2022
A Flutter package to provide the native maps to Android/iOS

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 embed

Luis Thein 70 Aug 13, 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
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
Aplications with google maps and geolocation

Aplications with google maps and geolocation

Richardson Tsavo 4 Jul 26, 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
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
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
Flutter Google Maps My Track

mytracker We invite you to subscribe to the Alpha flutter code channel on Youtub

NELSON YUNGA 6 Oct 31, 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

Tsenda LAB 1 Mar 28, 2022