Location class
Represents a geographical location with latitude and longitude coordinates.
This model is used to store precise location data for mosquito observations, supporting both the submission of new observations and the retrieval of existing observation data from external sources.
Usage Example
// Create a location for New York City
final location = Location(lat: 40.7128, lng: -74.0060);
// Serialize to JSON for API transmission
final json = location.toJson();
// {'lat': 40.7128, 'lng': -74.0060}
// Deserialize from JSON
final locationFromJson = Location.fromJson(json);
Coordinate System
Uses the WGS84 coordinate system (EPSG:4326) which is standard for GPS and web mapping applications. Coordinates are in decimal degrees.
Validation
- Latitude must be between -90.0 and 90.0 degrees
- Longitude must be between -180.0 and 180.0 degrees
See also:
- Observation which uses this model for location data
- Flutter's
geolocatorpackage for obtaining device location
Constructors
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this Location to a JSON map.
-
toString(
) → String -
Returns a string representation of this location.
override
Operators
-
operator ==(
Object other) → bool -
Checks if two Location instances are equal.
override