google_maps_flutter 0.5.10

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 100

Google Maps for Flutter (Developers Preview) #

pub package

A Flutter plugin that provides a Google Maps widget.

Developers Preview Status #

The plugin relies on Flutter's new 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.

Known issues are tagged with the platform-views and/or maps labels.

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.

The API exposed by this plugin is not yet stable, and we expect some breaking changes to land soon.

Usage #

To use this plugin, add google_maps_flutter as a dependency in your pubspec.yaml file.

Getting Started #

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

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

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: [UIApplicationLaunchOptionsKey: 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.

Both #

You can now add a GoogleMap widget to your widget tree.

The map view can be controlled with the GoogleMapController that is passed to the GoogleMap's onMapCreated callback.

Sample Usage #

import 'dart:async';

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Google Maps Demo',
      home: MapSample(),
    );
  }
}

class MapSample extends StatefulWidget {
  @override
  State<MapSample> createState() => MapSampleState();
}

class MapSampleState extends State<MapSample> {
  Completer<GoogleMapController> _controller = Completer();

  static final CameraPosition _kGooglePlex = CameraPosition(
    target: LatLng(37.42796133580664, -122.085749655962),
    zoom: 14.4746,
  );

  static final CameraPosition _kLake = CameraPosition(
      bearing: 192.8334901395799,
      target: LatLng(37.43296265331129, -122.08832357078792),
      tilt: 59.440717697143555,
      zoom: 19.151926040649414);

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: GoogleMap(
        mapType: MapType.hybrid,
        initialCameraPosition: _kGooglePlex,
        onMapCreated: (GoogleMapController controller) {
          _controller.complete(controller);
        },
      ),
      floatingActionButton: FloatingActionButton.extended(
        onPressed: _goToTheLake,
        label: Text('To the lake!'),
        icon: Icon(Icons.directions_boat),
      ),
    );
  }

  Future<void> _goToTheLake() async {
    final GoogleMapController controller = await _controller.future;
    controller.animateCamera(CameraUpdate.newCameraPosition(_kLake));
  }
}

See the example directory for a complete sample app.

0.5.10 #

  • Support Color's alpha channel when converting to UIColor on iOS.

0.5.9 #

  • BitmapDescriptor#fromBytes accounts for screen scale on ios.

0.5.8 #

  • Remove some unused variables and rename method

0.5.7 #

  • Add a BitmapDescriptor that is aware of scale.

0.5.6 #

  • Add support for Polylines on GoogleMap.

0.5.5 #

  • Enable iOS accessibility.

0.5.4 #

  • Add method getVisibleRegion for get the latlng bounds of the visible map area.

0.5.3 #

  • Added support setting marker icons from bytes.

0.5.2 #

  • Added onTap for callback for GoogleMap.

0.5.1 #

  • Update Android gradle version.
  • Added infrastructure to write integration tests.

0.5.0 #

  • Add a key parameter to the GoogleMap widget.

0.4.0 #

  • Change events are call backs on GoogleMap widget.
  • GoogleMapController no longer handles change events.
  • trackCameraPosition is inferred from GoogleMap.onCameraMove being set.

0.3.0+3 #

  • Update Android play-services-maps to 16.1.0

0.3.0+2 #

  • Address an issue on iOS where icons were not loading.
  • Add apache http library required false for Android.

0.3.0+1 #

  • Add NSNull Checks for markers controller in iOS.
  • Also address an issue where initial markers are set before initialization.

0.3.0 #

  • Breaking change. Changed the Marker API to be widget based, it was controller based. Also changed the example app to account for the same.

0.2.0+6 #

  • Updated the sample app in README.md.

0.2.0+5 #

0.2.0+4 #

  • Fixed a crash when the plugin is registered by a background FlutterView.

0.2.0+3 #

  • Fixed a memory leak on Android - the map was not properly disposed.

0.2.0+2 #

  • Log a more detailed warning at build time about the previous AndroidX migration.

0.2.0+1 #

0.2.0 #

  • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.

0.1.0 #

  • Move the map options from the GoogleMapOptions class to GoogleMap widget parameters.

0.0.3+3 #

  • Relax Flutter version requirement to 0.11.9.

0.0.3+2 #

  • Update README to recommend using the package from pub.

0.0.3+1 #

  • Bug fix: custom marker images were not working on iOS as we were not keeping a reference to the plugin registrar so couldn't fetch assets.

0.0.3 #

  • Don't export dart:async.
  • Update the minimal required Flutter SDK version to one that supports embedding platform views.

0.0.2 #

  • Initial developers preview release.

example/README.md

google_maps_flutter_example #

Demonstrates how to use the google_maps_flutter plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  google_maps_flutter: ^0.5.10

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:google_maps_flutter/google_maps_flutter.dart';
  
Version Uploaded Documentation Archive
0.5.17 Jun 17, 2019 Go to the documentation of google_maps_flutter 0.5.17 Download google_maps_flutter 0.5.17 archive
0.5.16 Jun 5, 2019 Go to the documentation of google_maps_flutter 0.5.16 Download google_maps_flutter 0.5.16 archive
0.5.15+1 Jun 3, 2019 Go to the documentation of google_maps_flutter 0.5.15+1 Download google_maps_flutter 0.5.15+1 archive
0.5.15 May 30, 2019 Go to the documentation of google_maps_flutter 0.5.15 Download google_maps_flutter 0.5.15 archive
0.5.14+1 May 28, 2019 Go to the documentation of google_maps_flutter 0.5.14+1 Download google_maps_flutter 0.5.14+1 archive
0.5.13 May 6, 2019 Go to the documentation of google_maps_flutter 0.5.13 Download google_maps_flutter 0.5.13 archive
0.5.12 May 3, 2019 Go to the documentation of google_maps_flutter 0.5.12 Download google_maps_flutter 0.5.12 archive
0.5.11+1 May 1, 2019 Go to the documentation of google_maps_flutter 0.5.11+1 Download google_maps_flutter 0.5.11+1 archive
0.5.11 May 1, 2019 Go to the documentation of google_maps_flutter 0.5.11 Download google_maps_flutter 0.5.11 archive
0.5.10 Apr 29, 2019 Go to the documentation of google_maps_flutter 0.5.10 Download google_maps_flutter 0.5.10 archive

All 35 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
99
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
100
Learn more about scoring.

We analyzed this package on May 29, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.1
  • pana: 0.12.17
  • Flutter: 1.5.4-hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.47.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_driver
flutter_test
test ^1.6.0