Search packages, repositories and app categories

Package detailsv1.0.3

geocode

Package to make Geocode requests. It exposes two methods to translate coordinates into locations and addresses into coordinates.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
12.6K
Likes
124
Pub points
160

Install package

flutter pub add geocode

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The geocode package enables seamless conversion between geographic coordinates and physical addresses. It provides two core methods: one to reverse-geocode coordinates into human-readable locations, and another to forward-geocode addresses into latitude and longitude. Designed for cross-platform use, it supports Android, iOS, Web, macOS, Windows, and Linux. The package is lightweight and integrates easily with Flutter apps requiring location-based services. Built by imanol.dev, it simplifies geolocation tasks without external dependencies.

Use cases

  • Reverse geocoding for user location display
  • Address lookup from GPS coordinates
  • Location-based search features
  • Map pin placement from addresses
  • Geolocation in travel or delivery apps
  • Integrating maps with address input

Key features

  • Simple API for forward and reverse geocoding
  • Cross-platform compatibility
  • Lightweight and dependency-free
  • Supports all major platforms
  • Easy integration with Flutter
  • Clean, readable response structure

Suitable for

  • Developers building map-integrated apps
  • Apps needing address-to-coordinate translation
  • Location-aware applications on multiple platforms
  • Prototyping geolocation features
  • Projects requiring minimal geocoding overhead

Considerations

  • Relies on external geocoding services (e.g., Google Maps, OpenStreetMap)
  • Rate limits may apply depending on the backend
  • Requires internet connection for requests
  • Accuracy depends on the underlying geocoding provider
  • No built-in caching mechanism
  • May need API key configuration based on provider

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Geocode library

workflow name likes popularity pub points

Introduction

Package to make Geocode requests. It exposes two methods to translate coordinates into locations and addresses into coordinates.

It's a basic implementation of the most useful methods in the Dart language of the following API geocode.xyz.

It's free for one request per second quota. Register in the above site to get an API Key and increase the number of requests to 10 per second. These are paid plans that allow more requests per second. For more information, review the site.

Installation

dependecies:
  geocode: 1.0.3

Example

See example/main.dart

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);
  }
}

Methods

Constructor

Library GeoCode class constructor, includes an optional parameter to set the apiKey.

GeoCode({this.apiKey});
Reverse Geocode

Method to translate a pair of latitude and longitude coordinates into a real address.

Future<Address> reverseGeocoding({double latitude, double longitude})
Forward Geocode

Method to translate an address into a pair of latitude and longitudecoordinates.

Future<Coordinates> forwardGeocoding({String address})

Responses

Reverse Geocode
Attribute Type Description
elevation double The elevation in meters.
timezone String The timezone.
geoNumber int geocode is an alphanumeric string representing both latitude and longitude as one value. Nearby points will have similar geocodes.
streetNumber int The properly formated street address number to be returned.
streetAddress String The properly formated street address to be returned.
city String The properly formated city name to be returned.
countyCode String The properly formated country code to be returned.
countryName String The properly formated country name to be returned.
region String The properly formated region to be returned.
postal String The properly formated postal code to be returned.
distance double The distance of the result location from the input location.
Forward Geocode
Attribute Type Description
latitude double Latitude coordinate value.
longitude double Longitude coordinate value.

Exceptions

  • AccountOutOfCreditsException: auth has ran out of credits.
  • AuthTokenNotFoundException: authentication token: auth not found.
  • PostalCodeFormatException: postal Code is not in the proper Format.
  • RequestThrottledException: request Throttled.
  • InvalidQueryException: supply a valid query.
  • EmptyResultException: your request did not produce any results. Check your spelling and try again.
  • UnknownErrorException: unkown error.

Dependencies

http: '>=0.13.0 <2.0.0'

License

BSD 3-Clause License

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package