GeoPoint class

A geographic point, given by its latitude and longitude in degrees.

Store a GeoPoint as a field value; a snapshot returns it for a geographic point field, also through DocumentSnapshot.getGeoPoint.

await firestore.doc('cities/SF').set(<String, Object?>{
  'location': const GeoPoint(37.7749, -122.4194),
});

Points are ordered by latitude, then by longitude, also in queries that order by or filter on such a field. Classic queries have no "near this point" filter.

Implemented types

Constructors

GeoPoint(double latitude, double longitude)
Creates a point at latitude (from -90 to 90) and longitude (from -180 to 180), both in degrees.
const
GeoPoint.fromJson(Map<String, Object?> json)
Builds a GeoPoint from a JSON map created by toJson.
factory

Properties

hashCode → int
The hash code for this object.
no setteroverride
latitude → double
The latitude, in degrees, between -90 and 90 inclusive.
final
longitude → double
The longitude, in degrees, between -180 and 180 inclusive.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

compareTo(GeoPoint other) → int
Compares this object to another object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object>
A JSON-serializable representation of this GeoPoint, in the same shape as the JS SDK's GeoPoint.toJSON(). Read it back with GeoPoint.fromJson.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Constants

jsonType → const String
The value of the type field written by toJson.