diff --git a/packages/model/CHANGELOG.md b/packages/model/CHANGELOG.md index 592a9f74..f5156317 100644 --- a/packages/model/CHANGELOG.md +++ b/packages/model/CHANGELOG.md @@ -3,7 +3,6 @@ ## 3.0.2 * Updated README -* Updated `id` to be `required` * Updated `idAsInt` to return `-1` instead of `null` for invalid id ## 3.0.1 diff --git a/packages/model/lib/angel3_model.dart b/packages/model/lib/angel3_model.dart index ab6c8393..07b00a50 100644 --- a/packages/model/lib/angel3_model.dart +++ b/packages/model/lib/angel3_model.dart @@ -3,7 +3,7 @@ /// Represents arbitrary data, with an associated ID and timestamps. class Model { /// A unique identifier corresponding to this item. - String id; + String? id; String? error; @@ -13,8 +13,8 @@ class Model { /// The last time at which this item was updated. DateTime? updatedAt; - Model({required this.id, this.createdAt, this.updatedAt}); + Model({this.id, this.createdAt, this.updatedAt}); /// Returns the [id], parsed as an [int]. - int get idAsInt => int.tryParse(id) ?? -1; + int get idAsInt => id != null ? int.tryParse(id!) ?? -1 : -1; } diff --git a/packages/model/pubspec.yaml b/packages/model/pubspec.yaml index d2ada2b5..2a45ca31 100644 --- a/packages/model/pubspec.yaml +++ b/packages/model/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_model -version: 3.0.1 +version: 3.0.2 description: Angel3 basic data model class, no longer with the added weight of the whole framework. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/model