map 0.1.0+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 90

map #

pub package

A flutter package to view a map widget on mobile apps. Supports Android, iOS, Web and Desktop.

Getting Started #

In your pubspec.yaml file add:

dependencies:
  map: any

Then, in your code import:

import 'package:map/map.dart';

Features #

Currently these basic features are implemented:

  • Drag panning
  • Pinch-zoom
  • Double click zoom

More features are yet to come.

Screenshot #

Map Screenshot

[0.1.0+1] - March 04, 2020 #

  • Fixed the library name.

[0.1.0] - Feb 25, 2020 #

  • Re-write of the example project.
  • Quality of the screenshot has improved.
  • Example project now works in release mode (Needed internet access permission).

[0.0.2+1] - Feb 23, 2020 #

  • The package latlong is depricated. Stop using it.

[0.0.2] - Feb 23, 2020 #

  • This is an early preview version of map.

[0.0.1] - May 1, 2018. #

  • This is an early preview version of map.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:latlng/latlng.dart';
import 'package:map/map.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Map Demo',
      theme: ThemeData(
        primarySwatch: Colors.purple,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final controller = MapController(
    location: LatLng(35.68, 51.41),
  );

  void _incrementCounter() {
    controller.location = LatLng(35.68, 51.41);
  }

  @override
  Widget build(BuildContext context) {
    final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
    controller.tileSize = 256 / devicePixelRatio;

    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text('Map Demo'),
      ),
      body: Map(
        controller: controller,
        provider: const CachedGoogleMapProvider(),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'My Location',
        child: Icon(Icons.my_location),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

/// You can enable caching by using [CachedNetworkImageProvider] from cached_network_image package.
class CachedGoogleMapProvider extends MapProvider {
  const CachedGoogleMapProvider();

  @override
  ImageProvider getTile(int x, int y, int z) {
    //Can also use CachedNetworkImageProvider.
    return NetworkImage(
        'https://www.google.com/maps/vt/pb=!1m4!1m3!1i$z!2i$x!3i$y!2m3!1e0!2sm!3i420120488!3m7!2sen!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e0!5m1!1e0!23i4111425');
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  map: ^0.1.0+1

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:map/map.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
79
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]
90
Learn more about scoring.

We analyzed this package on Jul 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • map that is a package requiring null.

Health issues and suggestions

Document public APIs. (-0.00 points)

28 out of 29 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
latlng ^0.0.2 0.0.2
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test