Updated model
This commit is contained in:
parent
8885a6b1c3
commit
9184dce6ab
5 changed files with 35 additions and 19 deletions
|
@ -1,20 +1,34 @@
|
|||
# 3.0.1
|
||||
# Change Log
|
||||
|
||||
## 3.0.2
|
||||
|
||||
* Updated README
|
||||
* Updated `id` to be `required`
|
||||
|
||||
## 3.0.1
|
||||
|
||||
* Updated README
|
||||
|
||||
# 3.0.0
|
||||
## 3.0.0
|
||||
|
||||
* 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
|
||||
|
||||
# 1.0.3
|
||||
## 1.0.3
|
||||
|
||||
* `idAsInt` returns `null` when `id` is `null`.
|
||||
|
||||
# 1.0.2
|
||||
## 1.0.2
|
||||
|
||||
* `idAsInt` now uses `int.tryParse`.
|
||||
|
||||
# 1.0.1
|
||||
## 1.0.1
|
||||
|
||||
* Add `idAsInt`.
|
||||
|
||||
# 1.0.0+1
|
||||
## 1.0.0+1
|
||||
|
||||
* Update constraint to work with Dart 2.
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
# angel3_model
|
||||
[![version](https://img.shields.io/badge/pub-v3.0.1-brightgreen)](https://pub.dartlang.org/packages/angel3_model)
|
||||
# Angel3 Basic Model
|
||||
|
||||
[![version](https://img.shields.io/badge/pub-v3.0.2-brightgreen)](https://pub.dartlang.org/packages/angel3_model)
|
||||
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
|
||||
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
|
||||
|
||||
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](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
|
||||
import 'package:angel3_model/angel3_model.dart';
|
||||
```
|
||||
|
||||
This package was created to prevent dependency collisions with third-party packages.
|
||||
This package was created to prevent dependency collisions with third-party packages.
|
||||
|
|
|
@ -8,12 +8,12 @@ void main() {
|
|||
class Todo extends Model {
|
||||
String? text;
|
||||
|
||||
bool? isComplete;
|
||||
bool isComplete;
|
||||
|
||||
Todo(
|
||||
{String? id,
|
||||
{required String id,
|
||||
this.text,
|
||||
this.isComplete,
|
||||
this.isComplete = false,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt})
|
||||
: super(id: id, createdAt: createdAt, updatedAt: updatedAt);
|
||||
|
|
|
@ -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({this.id, this.createdAt, this.updatedAt});
|
||||
Model({required this.id, this.createdAt, this.updatedAt});
|
||||
|
||||
/// 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
|
||||
version: 3.0.1
|
||||
description: Angel's basic data model class, no longer with the added weight of the whole framework.
|
||||
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/model
|
||||
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
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
dev_dependencies:
|
||||
|
|
Loading…
Reference in a new issue