More fire stats
This commit is contained in:
parent
9dd8a7de97
commit
74b0d37839
6 changed files with 54 additions and 9 deletions
|
|
@ -16,18 +16,20 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
String description;
|
||||
bool subscribed;
|
||||
int distance;
|
||||
int currentNumFires;
|
||||
|
||||
factory YourLocation.fromJson(Map<String, dynamic> json) =>
|
||||
_$YourLocationFromJson(json);
|
||||
|
||||
static YourLocation noLocation = new YourLocation(lat: 0.0, lon: 0.0);
|
||||
|
||||
static const int withoutStats = null;
|
||||
YourLocation(
|
||||
{this.id,
|
||||
@required this.lat,
|
||||
@required this.lon,
|
||||
this.description,
|
||||
this.distance: 10,
|
||||
int currentNumFires: withoutStats,
|
||||
this.subscribed: false}) {
|
||||
if (this.description == null)
|
||||
this.description = 'Position: ${this.lat}, ${this.lon}';
|
||||
|
|
@ -40,6 +42,7 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
lon,
|
||||
description,
|
||||
distance,
|
||||
currentNumFires,
|
||||
subscribed}) {
|
||||
return new YourLocation(
|
||||
id: id?? this.id,
|
||||
|
|
@ -47,6 +50,7 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
lon: lon?? this.lon,
|
||||
description: description?? this.description,
|
||||
distance: distance?? this.distance,
|
||||
currentNumFires: currentNumFires ?? this.currentNumFires,
|
||||
subscribed: subscribed?? this.subscribed
|
||||
);
|
||||
}
|
||||
|
|
@ -62,6 +66,7 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
lon == other.lon &&
|
||||
description == other.description &&
|
||||
subscribed == other.subscribed &&
|
||||
currentNumFires == other.currentNumFires &&
|
||||
distance == other.distance;
|
||||
|
||||
@override
|
||||
|
|
@ -71,10 +76,11 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
lon.hashCode ^
|
||||
description.hashCode ^
|
||||
subscribed.hashCode ^
|
||||
currentNumFires.hashCode ^
|
||||
distance.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'YourLocation {id: $id, lat: $lat, lon: $lon, description: $description, subscribed: $subscribed, distance: $distance}';
|
||||
return 'YourLocation {id: $id, lat: $lat, lon: $lon, description: $description, subscribed: $subscribed, distance: $distance, currentNumFires: $currentNumFires}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue