Location edition
This commit is contained in:
parent
e55edce3d4
commit
87718b7ad5
15 changed files with 138 additions and 75 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:bson_objectid/bson_objectid.dart';
|
||||
import 'package:comunes_flutter/comunes_flutter.dart';
|
||||
import 'package:fires_flutter/models/yourLocation.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
|
|
|||
|
|
@ -39,6 +39,24 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
if (this.id == null) this.id = new ObjectId();
|
||||
}
|
||||
|
||||
YourLocation copyWith(
|
||||
{id,
|
||||
lat,
|
||||
lon,
|
||||
description,
|
||||
distance,
|
||||
subscribed}) {
|
||||
return new YourLocation(
|
||||
id: id?? this.id,
|
||||
lat: lat?? this.lat,
|
||||
lon: lon?? this.lon,
|
||||
description: description?? this.description,
|
||||
distance: distance?? this.distance,
|
||||
subscribed: subscribed?? this.subscribed
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
|
|
|
|||
|
|
@ -19,23 +19,16 @@ YourLocation _$YourLocationFromJson(Map<String, dynamic> json) =>
|
|||
|
||||
abstract class _$YourLocationSerializerMixin {
|
||||
ObjectId get id;
|
||||
|
||||
double get lat;
|
||||
|
||||
double get lon;
|
||||
|
||||
String get description;
|
||||
|
||||
bool get subscribed;
|
||||
|
||||
int get distance;
|
||||
|
||||
Map<String, dynamic> toJson() => new _$YourLocationJsonMapWrapper(this);
|
||||
}
|
||||
|
||||
class _$YourLocationJsonMapWrapper extends $JsonMapWrapper {
|
||||
final _$YourLocationSerializerMixin _v;
|
||||
|
||||
_$YourLocationJsonMapWrapper(this._v);
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ Future<List<YourLocation>> loadYourLocations() async {
|
|||
}
|
||||
|
||||
persistYourLocations(List<YourLocation> yl) {
|
||||
print('Persisting $yl');
|
||||
globals.prefs.then((prefs) {
|
||||
List<String> ylAsString = [];
|
||||
yl.forEach((location) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue