platform/packages/client/test/shared.dart

29 lines
652 B
Dart
Raw Normal View History

2017-09-24 04:12:53 +00:00
import 'package:angel_model/angel_model.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(
2018-08-26 22:41:01 +00:00
id: data['id'].toString(),
location: data['location'].toString(),
message: data['message'].toString());
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};
}
}