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 theLocationclass. It takes in values for thedate,latitude,locationDescription,locationId, andlongitudeproperties and assigns them to the corresponding properties of theLocationobject being created. This allows you to create a newLocationobject and initialize its properties in a single line of code.
Properties
- date ↔ int
-
int date;is declaring a property nameddateof typeintin theLocationclass. 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 namedlatitudeof typedoublein theLocationclass. This property will be used to store the latitude value of a location.getter/setter pair - locationDescription ↔ String
-
String locationDescription;is declaring a property namedlocationDescriptionof typeStringin theLocationclass. This property will be used to store the description of a location.getter/setter pair - locationId ↔ String
-
String locationId;is declaring a property namedlocationIdof typeStringin theLocationclass. This property will be used to store the ID of a location.getter/setter pair - longitude ↔ double
-
double longitude;is declaring a property namedlongitudeof typedoublein theLocationclass. 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.