flutter_map_arcgis 0.1.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 77

Flutter Map plugin for ArcGIS Esri #

Currently support feature layer(point, polygon, polyline coming soon) #

We are working on more features

A Dart implementation of Esri Leaflet for Flutter apps. This is a plugin for flutter_map package

Usage #

Add flutter_map, dio and flutter_map_arcgis to your pubspec:

dependencies:
  flutter_map: any
  flutter_map_arcgis: any # or the latest version on Pub
  dio: any # or the latest version on Pub

Add it in you FlutterMap and configure it using FeatureLayerOptions.

  Widget build(BuildContext context) {
      return MaterialApp(
        home: Scaffold(
          appBar: AppBar(title: Text('ArcGIS')),
          body: Padding(
            padding: EdgeInsets.all(8.0),
            child: Column(
              children: [
                Flexible(
                  child: FlutterMap(
                    options: MapOptions(
                      center: LatLng(32.91081899999999, -92.734876),
                      zoom: 11.0,
                      plugins: [EsriPlugin()],
  
                    ),
                    layers: [
                      TileLayerOptions(
                        urlTemplate:
                        'http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',
                        subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
                        tileProvider: CachedNetworkTileProvider(),
                      ),
                      FeatureLayerOptions(
                        url: "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Congressional_Districts/FeatureServer/0",
                        geometryType:"polygon",
                        onTap: (attributes, LatLng location) {
                          print(attributes);
                        },
                        render: (dynamic attributes){
                          // You can render by attribute
                          return PolygonOptions(
                              borderColor: Colors.blueAccent,
                              color: Colors.black12,
                              borderStrokeWidth: 2
                          );
                        },
  
                      ),
                      FeatureLayerOptions(
                        url: "https://services8.arcgis.com/1p2fLWyjYVpl96Ty/arcgis/rest/services/Forest_Service_Recreation_Opportunities/FeatureServer/0",
                        geometryType:"point",
                        render:(dynamic attributes){
                          // You can render by attribute
                          return Marker(
                            width: 30.0,
                            height: 30.0,
                            builder: (ctx) => Icon(Icons.pin_drop),
                          );
                        },
                        onTap: (attributes, LatLng location) {
                          print(attributes);
                        },
                      ),
  
                    ],
                  ),
                ),
              ],
            ),
          ),
        ),
      );
    }

Run the example #

See the example/ folder for a working example app.

0.0.1 #

  • TODO: Describe initial release.

0.0.2 #

  • Polygon layer element on tap support

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_map_arcgis/flutter_map_arcgis.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';



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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('ArcGIS')),
        body: Padding(
          padding: EdgeInsets.all(8.0),
          child: Column(
            children: [
              Flexible(
                child: FlutterMap(
                  options: MapOptions(
                    center: LatLng(32.91081899999999, -92.734876),
                    zoom: 9.0,
                    plugins: [EsriPlugin()],

                  ),
                  layers: [
                    TileLayerOptions(
                      urlTemplate:
                      'http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',
                      subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
                      tileProvider: CachedNetworkTileProvider(),
                    ),
                    FeatureLayerOptions(
                      url: "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Congressional_Districts/FeatureServer/0",
                      geometryType:"polygon",
                      onTap: (attributes, LatLng location) {
                        print(attributes);
                      },
                      render: (dynamic attributes){
                        // You can render by attribute
                        return PolygonOptions(
                            borderColor: Colors.blueAccent,
                            color: Colors.black12,
                            borderStrokeWidth: 2
                        );
                      },

                    ),
                    FeatureLayerOptions(
                      url: "https://services8.arcgis.com/1p2fLWyjYVpl96Ty/arcgis/rest/services/Forest_Service_Recreation_Opportunities/FeatureServer/0",
                      geometryType:"point",
                      render:(dynamic attributes){
                        // You can render by attribute
                        return Marker(
                          width: 30.0,
                          height: 30.0,
                          builder: (ctx) => Icon(Icons.pin_drop),
                        );
                      },
                      onTap: (attributes, LatLng location) {
                        print(attributes);
                      },
                    ),

                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_map_arcgis: ^0.1.5

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

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/layers/feature_layer.dart. (-6.31 points)

Analysis of lib/layers/feature_layer.dart reported 13 hints, including:

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

line 229 col 16: Name non-constant identifiers using lowerCamelCase.

line 257 col 11: Name non-constant identifiers using lowerCamelCase.

line 260 col 11: Name non-constant identifiers using lowerCamelCase.

line 261 col 90: Avoid using braces in interpolation when not needed.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dio 3.0.9 3.0.9
flutter 0.0.0
flutter_map ^0.8.2 0.8.2
Transitive dependencies
ansicolor 1.0.2
async 2.4.1
cached_network_image 2.0.0
charcode 1.1.3
collection 1.14.11 1.14.12
console_log_handler 1.1.6
convert 2.1.1
crypto 2.1.4
flutter_cache_manager 1.1.3
flutter_image 3.0.0
http 0.12.0+4
http_parser 3.1.4
intl 0.16.1
latlong 0.6.1
logging 0.11.4
matcher 0.12.6
meta 1.1.8
path 1.6.4
path_provider 1.6.5
path_provider_macos 0.0.4
path_provider_platform_interface 1.0.1
pedantic 1.9.0
platform 2.2.1
plugin_platform_interface 1.0.2
positioned_tap_detector 1.0.3
quiver 2.1.3
sky_engine 0.0.99
source_span 1.7.0
sqflite 1.3.0
sqflite_common 1.0.0+1
stack_trace 1.9.3
string_scanner 1.0.5
synchronized 2.2.0
term_glyph 1.1.0
transparent_image 1.0.0
tuple 1.0.3
typed_data 1.1.6
uuid 2.0.4
validate 1.7.0
vector_math 2.0.8
Dev dependencies
flutter_test