mapir_gl 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • new76

Map.ir Flutter Plugin based on Mapbox GL #

This Flutter plugin for Map.ir Map SDKs enables embedded interactive and customizable vector maps inside a Flutter widget by embedding Android and iOS views.

screenshot.png

Install #

This project is available on pub.dartlang, follow the instructions to integrate a package into your flutter application.

Running example app #

  • Install Flutter and validate its installation with flutter doctor
  • Clone this repository with git clone git@github.com:map-ir/mapir-flutter-map-sdk.git
  • Run the app with cd mapir-flutter-map-sdk/example && flutter run

Mapir Api Key #

This project uses Map.ir vector tiles, which requires a Map.ir account and an API key. Obtain a free access token on Map.ir App Registration.

Android #

Add Mapi.ir read token value in the application manifest android/app/src/main/AndroidManifest.xml:

  <application ...
    <meta-data android:name="ir.map.apikey" android:value="YOUR_TOKEN_HERE" />

iOS #

Add these lines to your Info.plist

<key>io.flutter.embedded_views_preview</key>
<true/>
<key>MapirAPIKey</key>
<string>YOUR_TOKEN_HERE</string>

Supported API #

FeatureAndroidiOS
Style
Camera
Gesture
User Location
Symbol
Circle
Line
Fill

Offline Sideloading #

Support for offline maps is available by "side loading" the required map tiles and including them in your assets folder.

  • Place the tiles.db file generated in step one in your assets directory and add a reference to it in your pubspec.yml file.
   assets:
     - assets/cache.db
  • Call installOfflineMapTiles when your application starts to copy your tiles into the location where Mapir can access them. NOTE: This method should be called before the Map widget is loaded to prevent collisions when copying the files into place.
    try {
      await installOfflineMapTiles(join("assets", "cache.db"));
    } catch (err) {
      print(err);
    }

Documentation #

Please visit Map.ir Support for this flutter plugin, iOS Maps SDK docs and Android Maps SDK docs for more info about native SDKs.

Visit Map.ir/developers/android if you'd like more information about the Mapir Maps SDK for Android and Map.ir/ios-sdk for more information about the Mapir Maps SDK for iOS.

Getting Help #

  • Need help with your code?: Look for previous questions on the #mapir tag — or ask a new question.
  • Have a bug to report? Open an issue. If possible, include a full log and information which shows the issue.
  • Have a feature request? Open an issue. Tell us what the feature should do and why you want the feature.

Sample code #

This repository's example library is currently the best place for you to find reference code for this project. See other samples at Flutter docs.

1.0.2, January 04, 2020 #

  • Update to the latest flutter Mapbox
  • Added Mapir Vector Style

0.0.7, December 21, 2019 #

  • iOS support for annotation extensions (circle, symbol, line)
  • Update SDK to 8.5.0 (Android) and 5.5.0 (iOS)
  • Integrate style loaded callback api
  • Add Map click event (iOS)
  • Cache management API (Android/iOS)
  • Various fixes to showing user location and configurations (Android/iOS)
  • Last location API (Android)
  • Throttle max FPS of user location component (Android)
  • Fix for handling permission handling of the test application (Android)
  • Support for loading symbol images from assets (iOS/Android)

0.0.5, December 21, 2019 #

  • iOS support for annotation extensions (circle, symbol, line)
  • Update SDK to 8.5.0 (Android) and 5.5.0 (iOS)
  • Integrate style loaded callback api
  • Add Map click event (iOS)
  • Cache management API (Android/iOS)
  • Various fixes to showing user location and configurations (Android/iOS)
  • Last location API (Android)
  • Throttle max FPS of user location component (Android)
  • Fix for handling permission handling of the test application (Android)
  • Support for loading symbol images from assets (iOS/Android)

v0.0.4, Nov 2, 2019 #

  • Update SDK to 8.4.0 (Android) and 5.4.0 (iOS)
  • Add support for sideloading offline maps (Android/iOS)
  • Add user tracking mode (iOS)
  • Invert compassView.isHidden logic (iOS)
  • Specific swift version (iOS)

v0.0.3, Mar 30, 2019 #

  • Camera API (iOS)
  • Line API (Android)
  • Update codebase to AndroidX
  • Update Mapbox Maps SDK for Android to v7.3.0

v0.0.2, Mar 23, 2019 #

  • Support for iOS
  • Migration to embedded Android and iOS SDK View system
  • Style URL API
  • Style JSON API (Android)
  • Gesture support
  • Gesture restrictions (Android)
  • Symbol API (Android)
  • Location component (Android)
  • Camera API (Android)

v0.0.1, May 7, 2018 #

  • Initial Android surface rendering POC

example/README.md

mapbox_gl_example #

Demonstrates how to use the mapbox_gl plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  mapir_gl: ^1.0.2

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:mapir_gl/mapir_gl.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
52
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

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

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Fix lib/src/bitmap.dart. (-0.50 points)

Analysis of lib/src/bitmap.dart reported 1 hint:

line 48 col 11: The declaration '_toJson' isn't referenced.

Fix lib/src/controller.dart. (-0.50 points)

Analysis of lib/src/controller.dart reported 1 hint:

line 109 col 13: The value of the field '_id' isn't used.

Format lib/mapir_gl.dart.

Run flutter format to format lib/mapir_gl.dart.

Fix additional 6 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/camera.dart (Run flutter format to format lib/src/camera.dart.)
  • lib/src/circle.dart (Run flutter format to format lib/src/circle.dart.)
  • lib/src/line.dart (Run flutter format to format lib/src/line.dart.)
  • lib/src/mapbox_map.dart (Run flutter format to format lib/src/mapbox_map.dart.)
  • lib/src/symbol.dart (Run flutter format to format lib/src/symbol.dart.)
  • lib/src/ui.dart (Run flutter format to format lib/src/ui.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8