Updated model
This commit is contained in:
parent
8885a6b1c3
commit
9184dce6ab
5 changed files with 35 additions and 19 deletions
packages/model
|
@ -1,20 +1,34 @@
|
||||||
# 3.0.1
|
# Change Log
|
||||||
|
|
||||||
|
## 3.0.2
|
||||||
|
|
||||||
|
* Updated README
|
||||||
|
* Updated `id` to be `required`
|
||||||
|
|
||||||
|
## 3.0.1
|
||||||
|
|
||||||
* Updated README
|
* Updated README
|
||||||
|
|
||||||
# 3.0.0
|
## 3.0.0
|
||||||
|
|
||||||
* Migrated to support Dart SDK 2.12.x NNBD
|
* Migrated to support Dart SDK 2.12.x NNBD
|
||||||
|
|
||||||
# 2.0.0
|
## 2.0.0
|
||||||
|
|
||||||
* Migrated to work with Dart SDK 2.12.x Non NNBD
|
* Migrated to work with Dart SDK 2.12.x Non NNBD
|
||||||
|
|
||||||
# 1.0.3
|
## 1.0.3
|
||||||
|
|
||||||
* `idAsInt` returns `null` when `id` is `null`.
|
* `idAsInt` returns `null` when `id` is `null`.
|
||||||
|
|
||||||
# 1.0.2
|
## 1.0.2
|
||||||
|
|
||||||
* `idAsInt` now uses `int.tryParse`.
|
* `idAsInt` now uses `int.tryParse`.
|
||||||
|
|
||||||
# 1.0.1
|
## 1.0.1
|
||||||
|
|
||||||
* Add `idAsInt`.
|
* Add `idAsInt`.
|
||||||
|
|
||||||
# 1.0.0+1
|
## 1.0.0+1
|
||||||
|
|
||||||
* Update constraint to work with Dart 2.
|
* Update constraint to work with Dart 2.
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
# angel3_model
|
# Angel3 Basic Model
|
||||||
[](https://pub.dartlang.org/packages/angel3_model)
|
|
||||||
|
[](https://pub.dartlang.org/packages/angel3_model)
|
||||||
[](https://dart.dev/null-safety)
|
[](https://dart.dev/null-safety)
|
||||||
[](https://gitter.im/angel_dart/discussion)
|
[](https://gitter.im/angel_dart/discussion)
|
||||||
|
|
||||||
[](https://github.com/dukefirehawk/angel/tree/angel3/packages/model/LICENSE)
|
[](https://github.com/dukefirehawk/angel/tree/angel3/packages/model/LICENSE)
|
||||||
|
|
||||||
Angel's basic data model class, no longer with the added weight of the whole framework.
|
Angel3 basic data model class, no longer with the added weight of the whole framework.
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
import 'package:angel3_model/angel3_model.dart';
|
import 'package:angel3_model/angel3_model.dart';
|
||||||
|
|
|
@ -8,12 +8,12 @@ void main() {
|
||||||
class Todo extends Model {
|
class Todo extends Model {
|
||||||
String? text;
|
String? text;
|
||||||
|
|
||||||
bool? isComplete;
|
bool isComplete;
|
||||||
|
|
||||||
Todo(
|
Todo(
|
||||||
{String? id,
|
{required String id,
|
||||||
this.text,
|
this.text,
|
||||||
this.isComplete,
|
this.isComplete = false,
|
||||||
DateTime? createdAt,
|
DateTime? createdAt,
|
||||||
DateTime? updatedAt})
|
DateTime? updatedAt})
|
||||||
: super(id: id, createdAt: createdAt, updatedAt: updatedAt);
|
: super(id: id, createdAt: createdAt, updatedAt: updatedAt);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
/// Represents arbitrary data, with an associated ID and timestamps.
|
/// Represents arbitrary data, with an associated ID and timestamps.
|
||||||
class Model {
|
class Model {
|
||||||
/// A unique identifier corresponding to this item.
|
/// A unique identifier corresponding to this item.
|
||||||
String? id;
|
String id;
|
||||||
|
|
||||||
String? error;
|
String? error;
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ class Model {
|
||||||
/// The last time at which this item was updated.
|
/// The last time at which this item was updated.
|
||||||
DateTime? updatedAt;
|
DateTime? updatedAt;
|
||||||
|
|
||||||
Model({this.id, this.createdAt, this.updatedAt});
|
Model({required this.id, this.createdAt, this.updatedAt});
|
||||||
|
|
||||||
/// Returns the [id], parsed as an [int].
|
/// Returns the [id], parsed as an [int].
|
||||||
int? get idAsInt => id == null ? null : int.tryParse(id!);
|
int get idAsInt => int.tryParse(id) ?? 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
name: angel3_model
|
name: angel3_model
|
||||||
version: 3.0.1
|
version: 3.0.1
|
||||||
description: Angel's basic data model class, no longer with the added weight of the whole framework.
|
description: Angel3 basic data model class, no longer with the added weight of the whole framework.
|
||||||
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/model
|
homepage: https://angel3-framework.web.app/
|
||||||
|
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/model
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
Loading…
Reference in a new issue