platform/test/shared.dart

27 lines
606 B
Dart
Raw Normal View History

2017-02-22 22:20:30 +00:00
import "package:angel_framework/common.dart";
2016-06-24 21:06:57 +00:00
2017-02-22 22:20:30 +00:00
class Postcard extends Model {
2016-06-24 21:06:57 +00:00
String location;
String message;
2017-02-22 22:20:30 +00:00
Postcard({String id, this.location, this.message}) {
this.id = id;
}
factory Postcard.fromJson(Map data) => new Postcard(
id: data['id'], location: data['location'], message: data['message']);
2016-06-24 21:06:57 +00:00
@override
bool operator ==(other) {
2016-12-10 17:28:24 +00:00
if (!(other is Postcard)) return false;
2016-06-24 21:06:57 +00:00
2016-12-10 17:28:24 +00:00
return id == other.id &&
location == other.location &&
2016-06-24 21:06:57 +00:00
message == other.message;
}
2016-12-10 17:28:24 +00:00
Map toJson() {
return {'id': id, 'location': location, 'message': message};
}
}