mapbox_search 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 78

mapbox_search #

Pub Awesome Flutter

PR ? You're most welcomed.... #

MapBox Search and Static Image pure Dart Implementation #

A Flutter package for place search using MapBox Api, Reverse Geocoding and for Static map image. #

Reverse Geocoding displays the nearby places based on the feeded Location data. #

I made this package because google place search was not working that much efficiently(daily quota limit) and MapBox offers plenty of free search requests. #

Way more useful than google if you want static map images... #

Installing #

Add the following to your pubspec.yaml file:

dependencies:
  mapbox_search: any

Example #

Static Image #

MapBoxStaticImage staticImage = MapBoxStaticImage(
    apiKey:
        "API Key");

Image With Polyline #

String getStaticImageWithPolyline() => staticImage.getStaticUrlWithPolyline(
  point1: Location(lat: 37.77343, lng: -122.46589),
  point2: Location(lat: 37.75965, lng: -122.42816),
  marker1: MapBoxMarker( markerColor: Colors.black, markerLetter: 'p', markerSize: MarkerSize.LARGE),
  msrker2: MapBoxMarker(
      markerColor: Colors.redAccent,
      markerLetter: 'q',
      markerSize: MarkerSize.SMALL),
  height: 300,
  width: 600,
  zoomLevel: 16,
  style: MapBoxStyle.Mapbox_Dark,
  path: MapBoxPath(pathColor: Colors.red, pathOpacity: 0.5,     pathWidth: 5),
  render2x: true);

Image with Marker #

String getStaticImageWithMarker() => staticImage.getStaticUrlWithMarker(
  center: Location(lat: 37.77343, lng: -122.46589),
  marker: MapBoxMarker(
      markerColor: Colors.black, markerLetter: 'p', markerSize: MarkerSize.LARGE),
  height: 300,
  width: 600,
  zoomLevel: 16,
  style: MapBoxStyle.Mapbox_Streets,
  render2x: true,
);

Image without Marker #

String getStaticImageWithoutMarker() => staticImage.getStaticUrlWithoutMarker(
    center: Location(lat: 37.75965, lng: -122.42816),
    height: 300,
    width: 600,
    zoomLevel: 16,
    style: MapBoxStyle.Mapbox_Outdoors,
    render2x: true,
  );

Search Widget #

MapBoxPlaceSearchWidget(
      popOnSelect: true,
      apiKey:
          "API KEY",
      limit: 10,
      onSelected: (place) {},
      context: context,
)

Reverse GeoCoding #

ReverseGeoCoding reverseGeoCoding = ReverseGeoCoding(
    apiKey: 'API Key',
    limit: 5,
);
Future<List<MapBoxPlace>> getPlaces() async =>
  await reverseGeoCoding.getAddress(
    Location(lat: 72.0, lng: 76.00),
);

Screenshots #

Static Map Image #

Static Map Image

Search Widget #

DemoDemo

[1.0.0] - 26 August 2019.

Initial release.

Feature:

  • Places Search with prediction
  • Static Image with marker
  • Static Image without Marker
  • Static Image with Polyline path

[1.0.1] - 27 August 2019.

Feature:

  • add defaultPathPolyline and add assert(Merge Request)

[1.0.2] - 30 August 2019.

Feature:

  • Reverse Geooding Added

[1.0.3] - 10 September 2019.

  • Reverse Geooding returning empty list bug Solved

example/README.md

example #

A new Flutter project.

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:
  mapbox_search: ^1.0.3

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

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

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

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

line 273 col 56: Avoid using braces in interpolation when not needed.

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

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

line 8 col 15: Name non-constant identifiers using lowerCamelCase.

Format lib/mapbox_search.dart.

Run flutter format to format lib/mapbox_search.dart.

Format lib/src/Location.dart.

Run flutter format to format lib/src/Location.dart.

Maintenance issues and suggestions

Use constrained dependencies. (-20 points)

The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: http.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
flutter 0.0.0
http any 0.12.0+2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
http_parser 3.1.3
meta 1.1.7
path 1.6.4
pedantic 1.8.0+1
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test