maps 0.2.0 copy "maps: ^0.2.0" to clipboard
maps: ^0.2.0 copied to clipboard

unlistedoutdated

A cross-platform geographic maps package. Supports Apple MapKit, Bing Maps, and Google Maps. Works in all platforms supported by Flutter, including browsers.

Pub Package Github Actions CI

Overview #

Geographic maps for Flutter applications. Licensed under the Apache License 2.0.

This package is:

  • Cross-platform
    • Android and iOS
    • Browsers
  • Multi-vendor
    • Apple
    • Bing
    • Google

This is an early-stage version and lots of things are still missing or broken. Pull requests are welcome!

Getting started #

1.Add dependency #

dependencies:
  maps: ^0.2.0

2.Use #

MapAppLauncher #

MapAppLauncher launches either:

  • A map website (such as Google Maps website)
  • A map application in the device (such as Google Maps for Android/iOS)
import 'package:maps/maps.dart';

Future<void> main() async {
  // Use default app
  await MapAppLauncher.defaultInstance.launch(query:'Eiffel Tower');

  // Use Google Maps
  await MapAppLauncher.googleMaps.launch(
    query:'Louvre Museum',
  );
}

MapWidget #

MapWidget shows a map:

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

void main() {
  runApp(const MaterialApp(
    home: Scaffold(
      body: MapWidget(
        size: Size(300, 500),
        camera: MapCamera(
          query: 'Paris',
        ),
        markers: [
          MapMarker(
            query: 'Eiffel Tower',
          ),
        ],
        // Bing Maps iframe API does not necessarily require API credentials
        // so we use it in the example.
        adapter: MapAdapter.platformSpecific(
          android: GoogleMapsNativeAdapter(),
          browser: BingMapsIframeAdapter(),
          ios: AppleNativeAdapter(),
        ),
      ),
    ),
  ));
}

Assuming that you have enabled Flutter for Web, you can run:

flutter run -d chrome

Recommended configuration file changes #

iOS #

In ios/Runner/Info.plist:

	<key>io.flutter.embedded_views_preview</key>
	<true/>
	<key>Privacy - Location When In Use Usage Description</key>
	<string>A description of your privacy policy.</string>

Supported map providers #

Apple Maps APIs #

iOS #

  • AppleMapsNativeAdapter enables you to use Apple MapKit. The current implementation depends on the Flutter package apple_maps_flutter, a package by a third-party developer.
  • The adapter doesn't require API credentials.
  • You need to edit ios/Runner/Info.plist (see "recommended configuration file changes").

Javascript #

Images #

Bing Maps APIs #

Javascript #

Iframes #

Images #

Google Maps APIs #

Android / iOS #

Javascript #

Iframes #

Images #

Tips #

Use images when you can #

Static images are rendered identically in all platforms and have the best performance.

31
likes
0
pub points
49%
popularity

Publisher

verified publisherdint.dev

A cross-platform geographic maps package. Supports Apple MapKit, Bing Maps, and Google Maps. Works in all platforms supported by Flutter, including browsers.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

apple_maps_flutter, collection, cryptography_flutter, database, flutter, js, meta, url_launcher, web_browser

More

Packages that depend on maps