Location class
The class Location
is defining a data model for a location. It has properties such as date
,
latitude
, locationDescription
, locationId
, and longitude
. It also has a constructor that
takes in values for these properties and assigns them. Additionally, it has a static method
jsonToObj
that takes in a JSON object and returns an instance of the Location
class with the
values extracted from the JSON object.
Constructors
- Location(int date, double latitude, String locationDescription, String locationId, double longitude)
-
The code
Location(this.date, this.latitude, this.locationDescription, this.locationId, this.longitude)
is a constructor for theLocation
class. It takes in values for thedate
,latitude
,locationDescription
,locationId
, andlongitude
properties and assigns them to the corresponding properties of theLocation
object being created. This allows you to create a newLocation
object and initialize its properties in a single line of code.
Properties
- date ↔ int
-
int date;
is declaring a property nameddate
of typeint
in theLocation
class. This property will be used to store the date value of a location.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
- latitude ↔ double
-
double latitude;
is declaring a property namedlatitude
of typedouble
in theLocation
class. This property will be used to store the latitude value of a location.getter/setter pair - locationDescription ↔ String
-
String locationDescription;
is declaring a property namedlocationDescription
of typeString
in theLocation
class. This property will be used to store the description of a location.getter/setter pair - locationId ↔ String
-
String locationId;
is declaring a property namedlocationId
of typeString
in theLocation
class. This property will be used to store the ID of a location.getter/setter pair - longitude ↔ double
-
double longitude;
is declaring a property namedlongitude
of typedouble
in theLocation
class. This property will be used to store the longitude value of a location.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
jsonToObj(
Map< String, dynamic> json) → Location - The function converts a JSON object into a Location object by extracting the necessary values from the JSON. @param {Map<String, dynamic>} json - A map containing key-value pairs where the keys are strings and the values can be of any type. @returns an instance of the Location class.