platform/packages/model/lib/angel3_model.dart

19 lines
487 B
Dart
Raw Normal View History

2021-05-14 07:23:53 +00:00
//library angel3_model;
2017-07-11 20:46:12 +00:00
/// Represents arbitrary data, with an associated ID and timestamps.
class Model {
2018-12-31 00:30:23 +00:00
/// A unique identifier corresponding to this item.
2021-08-08 02:45:56 +00:00
String? id;
2018-12-31 00:30:23 +00:00
/// The time at which this item was created.
2021-03-18 00:15:01 +00:00
DateTime? createdAt;
2018-12-31 00:30:23 +00:00
/// The last time at which this item was updated.
2021-03-18 00:15:01 +00:00
DateTime? updatedAt;
2017-07-11 20:46:12 +00:00
2021-08-08 02:45:56 +00:00
Model({this.id, this.createdAt, this.updatedAt});
2018-12-31 00:30:23 +00:00
/// Returns the [id], parsed as an [int].
2021-08-08 02:45:56 +00:00
int get idAsInt => id != null ? int.tryParse(id!) ?? -1 : -1;
2018-12-31 00:30:23 +00:00
}