Skip to content
pubscout

geocode

1.0.3, released 3 years ago by imanol.dev

Package to translate coordinates into locations and addresses into coordinates.

WASM-ready
$ flutter pub add geocode
Source repository

What it does

It provides a basic implementation of the geocode.xyz API in Dart. It exposes two main methods: forward geocoding to translate an address into latitude and longitude coordinates, and reverse geocoding to translate coordinates into a real address.

AI-written summary of version 1.0.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to convert a physical street address into geographic coordinates.
  • You need to look up a street address or location details from latitude and longitude coordinates.

Skip it when

  • You require an offline geocoding solution, as this package makes network requests to geocode.xyz.
  • You need high-volume requests without considering the rate limits and pricing plans of the underlying API.

Strengths

  • Simple and straightforward API for forward and reverse geocoding.
  • Includes helpful typed exceptions for handling common error states like throttled requests or empty results.

Weaknesses

  • Relies on a third-party web service (geocode.xyz) which has strict free-tier rate limits.
  • Not documented for offline use.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1

Not documented

import 'package:geocode/geocode.dart';

void main() async {
  GeoCode geoCode = GeoCode();

  try {
    Coordinates coordinates = await geoCode.forwardGeocoding(
        address: "532 S Olive St, Los Angeles, CA 90013");

    print("Latitude: ${coordinates.latitude}");
    print("Longitude: ${coordinates.longitude}");
  } catch (e) {
    print(e);
  }
}

Alternatives

Packages that do the same job and could replace geocode.