Skip to content

flutter_geo_hash 0.0.7

Latest

Choose a tag to compare

@miracle101000 miracle101000 released this 12 Sep 19:43

This release is backward compatible with 0.0.6: existing code keeps working, geohashes are unchanged, and query ranges only change where they used to miss results.

Added

  • decodeGeoHash and decodeGeoHashBounds, which decode a geohash into the center or the bounds (GeoHashBounds) of its cell.
  • geoHashNeighbors, which returns the cells adjacent to a geohash, keyed by GeoHashDirection.
  • isValidGeoHash, which checks a geohash without throwing.
  • isWithinRadius, which filters query results using a radius in meters, the same unit as geohashQueryBounds.
  • GeoHashPoint.toString, which makes error messages show the coordinates instead of Instance of 'GeoPoint'.
  • Data for dart fix, which migrates code to the renamed classes.

Changed

  • The package no longer depends on the Flutter SDK. It still works in Flutter apps, and can now also be used in any Dart project, such as a server.
  • Added explicit return types to log2, validateKey and validateLocation.
  • Documented the whole public API and rewrote the README, including a complete guide to querying Cloud Firestore by distance.
  • Added reference, property and regression tests, and continuous integration.

Deprecated

  • MyGeoHash is renamed to GeoHashUtils, and GeoPoint to GeoHashPoint. The new names don't clash with the classes of other packages, such as GeoPoint in cloud_firestore. The old names still work as deprecated aliases, and will be removed in a future breaking release. Run dart fix --apply to migrate.

Fixed

  • geohashQueryBounds missed locations within the radius when the search area reached towards a pole or spanned more than half of the globe's longitudes. Ranges for other queries are unchanged.
  • distanceBetween returned NaN for some nearly antipodal locations.
  • validateKey accepted keys containing ., #, $, /, [, ] or ASCII control characters, which the Firebase Realtime Database rejects. It now throws for them, as documented.
  • geohashQueryBounds threw an UnsupportedError for a negative, NaN or infinite radius. It now throws an ArgumentError describing the problem.