platform/packages/client/test/shared.dart

29 lines
651 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 {
2021-04-10 13:22:20 +00:00
String? location;
String? message;
2016-06-24 21:06:57 +00:00
2021-04-10 13:22:20 +00:00
Postcard({String? id, this.location, this.message}) {
2017-02-22 22:20:30 +00:00
this.id = id;
}
2021-04-10 13:22:20 +00:00
factory Postcard.fromJson(Map data) => 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};
}
}