geopoint 0.1.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new73

Geopoint #

pub package

Data structures and methods for the Geolocator Flutter plugin

Models #

Geopoint #

Datastructure:

   final String name; // required
   String slug;
   int timestamp;
   Position position; // from Geolocator
   Placemark placemark; // from Geolocator
   double latitude;
   double longitude;
   double altitude;
   double speed;
   double accuracy;
   double speedAccuracy;
   double heading;
   String number;
   String street;
   String locality;
   String sublocality;
   String postalCode;
   String subregion;
   String region;
   String country;
   List<File> images;

Constructors:

   // from a position
   var position = await Geolocator().getCurrentPosition(
      desiredAccuracy: locationAccuracy);
   String name = "My location";
   GeoPoint geoPoint = GeoPoint(name: name, position: position);

   // from json
   Map<String, dynamic> json = {
      "name": "Mylocation",
      "latitude": 0.0,
      // ...
      // uses all fields except [position] and [placemark]
   };
   GeoPoint geoPoint = GeoPoint.fromJson(json);

   // from LatLng
   GeoPoint.fromLatLng(name: "Position", point: LatLng(51.0,0.0));

Methods and getters:

   // get the current location as a GeoPoint
   GeoPoint geoPoint = await GeoPoint.getPosition(name: "Current position");;
   // get the formated address
   String address = geoPoint.address;

   // convert to json
   Map<String, String> json = geoPoint.toMap();

GeoSerie #

Datastructure:

   final String name; // required
   final int id;
   final GeoSerieType type;  // one of GeoSerieType.group
                             // GeoSerieType.line or
                             // GeoSerieType.polygon

Constructors:

   // ftom json
   Map<String, dynamic> json = {
       "name": "A polygon",
       "id":1,
       "type": "polygon",
   }
   GeoSerie geoSerie = GeoSerie.fromJson(json);

   // from strings
   GeoSerie geoSerie = GeoSerie.fromNameAndType(
       name: "A polygon",
       type: GeoSerieType.polygon,
       // or typeStr: "polygon"
   );

Methods and getters:

   // convert to json
   Map<String, String> json = geoSerie.toMap();

   // get the type as a string
   String type = geoSerie.typeStr;

Changelog #

0.1.1 #

  • Apply more strict linting rules
  • Improve docstrings

0.1.0 #

Initial release

example/README.md

Example #

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

class _MyHomePageState extends State<MyHomePage> {
  GeoPoint geoPoint;

  setGeoPoint() {
    GeoPoint.getPosition(verbose: true).then((p) {
      setState(() {
        geoPoint = p;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Padding(
          padding: EdgeInsets.all(25.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              RaisedButton(
                child: Text("Get current geopoint"),
                onPressed: () => setGeoPoint(),
              ),
              Text("$geoPoint"),
            ],
          )),
    );
  }
}

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

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

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

Use this package as a library

1. Depend on it

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


dependencies:
  geopoint: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:geopoint/geopoint.dart';
  
Version Uploaded Documentation Archive
0.1.1 Mar 15, 2019 Go to the documentation of geopoint 0.1.1 Download geopoint 0.1.1 archive
0.1.0 Feb 26, 2019 Go to the documentation of geopoint 0.1.0 Download geopoint 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
46
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]
73
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.3.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0-dev.9.4.flutter-f9ebf21297 <3.0.0
cupertino_icons ^0.1.2 0.1.2
flutter 0.0.0
geolocator ^3.0.1 3.0.1
latlong ^0.6.1 0.6.1
slugify2 ^0.2.0 0.2.1
Transitive dependencies
ansicolor 1.0.2
collection 1.14.11
console_log_handler 1.1.6
google_api_availability 2.0.0
intl 0.15.7
logging 0.11.3+2
meta 1.1.6 1.1.7
path 1.6.2
permission_handler 3.0.0
sky_engine 0.0.99
typed_data 1.1.6
validate 1.7.0
vector_math 2.0.8
Dev dependencies
flutter_test