Search packages, repositories and app categories

Package detailsv8.3.0

google_maps

With that package you will be able to use Google Maps JavaScript API from Dart scripts.

Web
30-day downloads
1.1M
Likes
125
Pub points
160

Install package

flutter pub add google_maps

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The google_maps package enables Dart applications to integrate and interact with the Google Maps JavaScript API, primarily on web platforms. It provides a bridge between Dart code and Google Maps functionality, allowing developers to embed interactive maps, display markers, handle user interactions, and customize map views directly within Flutter web apps. The package is designed for use in web environments where access to the full Google Maps JavaScript API is required. It supports dynamic map rendering and event handling through Dart interfaces.

Use cases

  • Embedding interactive maps in web apps
  • Displaying location markers and info windows
  • Handling user map interactions like clicks and zooms
  • Customizing map styles and layers
  • Integrating geolocation features with maps

Key features

  • Web-only Google Maps integration
  • Dart interface for Google Maps JavaScript API
  • Support for markers, polygons, and overlays
  • Event-driven map interaction model
  • Map customization via API configuration

Suitable for

  • Flutter web applications requiring advanced map features
  • Developers using Google Maps JavaScript API in Dart
  • Projects needing interactive map visualizations on the web
  • Apps that require precise control over map behavior and styling

Considerations

  • Limited to web platform only
  • Requires valid Google Maps API key
  • Depends on external JavaScript library loading
  • May need additional configuration for production deployment
  • Not compatible with mobile platforms

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Dart Google Maps

This project is a library to use Google Maps JavaScript API v3 from dart scripts.

Usage

To use this library in your code:

  • add a dependency in your pubspec.yaml :

    dependencies:
      google_maps:
    
  • add import in your dart code:

    import 'package:google_maps/google_maps.dart';
    
  • Include the Maps API JavaScript using a script tag before your dart script.

    <script src="https://maps.googleapis.com/maps/api/js?key=API_KEY"></script>
    

Please see the Google Maps JavaScript API v3 Getting Started guide for information about obtaining an API Key.

A very simple example :

import 'package:google_maps/google_maps.dart';
import 'package:web/web.dart';

void main() {
  final mapOptions = MapOptions()
    ..zoom = 8
    ..center = LatLng(-34.397, 150.644);
  GMap(document.getElementById('map-canvas') as HTMLElement, mapOptions);
}

Coverage

The library covers all Google Maps JavaScript API v3 and its Libraries.

To use one or more Google Maps Library:

  • add import in your dart code:

    import 'package:google_maps/google_maps_LIBRARY1.dart';
    import 'package:google_maps/google_maps_LIBRARY2.dart';
    
  • Include the Maps API JavaScript using a script tag.

    <script src="http://maps.googleapis.com/maps/api/js?libraries=LIBRARY1,LIBRARY2"></script>
    

NB: This package doesn't support neither alpha or beta elements/libraries.

Examples

Examples found at https://google-developers.appspot.com/maps/documentation/javascript/examples/ are available in a dart version at https://github.com/a14n/dart-google-maps in the example directory.

License

Apache 2.0

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package