Location constructor

Location({
  1. required double lat,
  2. required double lng,
})

Creates a new Location instance.

Validates that coordinates are within valid ranges.

Throws ArgumentError if coordinates are outside valid ranges.

Implementation

Location({required this.lat, required this.lng})
    : assert(lat >= -90.0 && lat <= 90.0,
             'Latitude must be between -90.0 and 90.0'),
      assert(lng >= -180.0 && lng <= 180.0,
             'Longitude must be between -180.0 and 180.0');