From 308cd94c783dcf884d88c1e6660bc86510616387 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Fri, 26 Apr 2019 09:50:07 -0400 Subject: [PATCH] 1.0.3 --- CHANGELOG.md | 3 +++ lib/angel_model.dart | 2 +- pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e28d4188..f1c86f13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.0.3 +* `idAsInt` returns `null` when `id` is `null`. + # 1.0.2 * `idAsInt` now uses `int.tryParse`. diff --git a/lib/angel_model.dart b/lib/angel_model.dart index 0694c33a..d179fa54 100644 --- a/lib/angel_model.dart +++ b/lib/angel_model.dart @@ -12,5 +12,5 @@ class Model { Model({this.id, this.createdAt, this.updatedAt}); /// Returns the [id], parsed as an [int]. - int get idAsInt => int.tryParse(id); + int get idAsInt => id == null ? null : int.tryParse(id); } diff --git a/pubspec.yaml b/pubspec.yaml index e751fa00..22040435 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: angel_model -version: 1.0.2 +version: 1.0.3 description: Angel's basic data model class, no longer with the added weight of the whole framework. author: Tobe O homepage: https://github.com/angel-dart/model