location_context 1.0.3+1

location_context #

Build Status

Helper functions to share location data using InheritedWidgets

This plugin is also available on pub

Getting Started #

For help getting started with Flutter, view our online documentation. You can also visit us at Flutter Institute

For help on editing package code, view the documentation.

[1.0.3+1] - 2018-08-24

  • Fixing version numbers in the changelog, because I forgot to save it.

[1.0.3] - 2018-08-24

  • Streamlining the Location dependency injection in context.dart
  • Fixing the compiler errors in context.dart related to dart 2
  • Adding an example application for how to use this
  • Updating quiver dependency to match the flutter sdk dependency

[1.0.2] - 2018-08-03

  • Optimizing the Postion class for better comparisons

[1.0.1] - 2018-07-18

  • Removing unused import from the test files

[1.0.0] - 2018-07-17

  • Initial release for sharing location data using InheritedWidget


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

const MAPS_API_KEY = 'AIzaSyB0vykgvACInKwdBKsrgvJwOVIvC2AHEdU';

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

class LocationContextExampleApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return LocationContext.around(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        home: MapViewPage(),

class MapViewPage extends StatelessWidget {
  Widget build(BuildContext context) {
    final LocationContext loc = LocationContext.of(context);
    final Size size = MediaQuery.of(context).size;

    final List<Widget> children = List();

    if (loc.error != null) {
        child: Text('Error ${loc.error}', style: TextStyle(color: Colors.red)),
    } else {
      final Position pos = loc.currentLocation;
      if (pos != null) {
        Uri uri = Uri.https('maps.googleapis.com', 'maps/api/staticmap', {
          'center': '${pos.latitude},${pos.longitude}',
          'zoom': '18',
          'size': '${size.width.floor()}x${size.height.floor()}',
          'key': MAPS_API_KEY,
          'markers': 'color:blue|size:small|${pos.latitude},${pos.longitude}',

            child: Image.network(uri.toString()),
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Expanded(child: Center(child: Text('Latitude: ${pos.latitude}'))),
              Expanded(child: Center(child: Text('Longitude: ${pos.longitude}'))),
      } else {
        children.add(Center(child: Text('Location Not Found')));

    return Scaffold(
      appBar: AppBar(
        title: Text('Location Context Example'),
      body: Column(
        children: children,

Use this package as a library

1. Depend on it

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

  location_context: ^1.0.3+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:location_context/location_context.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (location).


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <3.0.0
flutter 0.0.0
location ^1.3.4 1.4.1 2.3.5
quiver ^2.0.0+1 2.0.5
Transitive dependencies
collection 1.14.11 1.14.12
matcher 0.12.5
meta 1.1.6 1.1.7
path 1.6.4
sky_engine 0.0.99
stack_trace 1.9.3
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies