1.0.1
This commit is contained in:
parent
7658217d05
commit
eb1c5f7df2
5 changed files with 34 additions and 7 deletions
|
@ -1,2 +1,5 @@
|
||||||
|
# 1.0.1
|
||||||
|
* Add `idAsInt`.
|
||||||
|
|
||||||
# 1.0.0+1
|
# 1.0.0+1
|
||||||
* Update constraint to work with Dart 2.
|
* Update constraint to work with Dart 2.
|
||||||
|
|
|
@ -2,11 +2,7 @@
|
||||||
Angel's basic data model class, no longer with the added weight of the whole framework.
|
Angel's basic data model class, no longer with the added weight of the whole framework.
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
// Old: import 'package:angel_framework/common.dart' show Model;
|
|
||||||
|
|
||||||
// The new way!!!
|
|
||||||
import 'package:angel_model/angel_model.dart';
|
import 'package:angel_model/angel_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.
|
||||||
`framework/common` will continue to export this class.
|
|
20
example/main.dart
Normal file
20
example/main.dart
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import 'package:angel_model/angel_model.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
var todo = Todo(id: '34', isComplete: false);
|
||||||
|
print(todo.idAsInt == 34);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Todo extends Model {
|
||||||
|
String text;
|
||||||
|
|
||||||
|
bool isComplete;
|
||||||
|
|
||||||
|
Todo(
|
||||||
|
{String id,
|
||||||
|
this.text,
|
||||||
|
this.isComplete,
|
||||||
|
DateTime createdAt,
|
||||||
|
DateTime updatedAt})
|
||||||
|
: super(id: id, createdAt: createdAt, updatedAt: updatedAt);
|
||||||
|
}
|
|
@ -1,8 +1,16 @@
|
||||||
/// 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.
|
||||||
String id;
|
String id;
|
||||||
|
|
||||||
|
/// The time at which this item was created.
|
||||||
DateTime createdAt;
|
DateTime createdAt;
|
||||||
|
|
||||||
|
/// The last time at which this item was updated.
|
||||||
DateTime updatedAt;
|
DateTime updatedAt;
|
||||||
|
|
||||||
Model({this.id, this.createdAt, this.updatedAt});
|
Model({this.id, this.createdAt, this.updatedAt});
|
||||||
}
|
|
||||||
|
/// Returns the [id], parsed as an [int].
|
||||||
|
int get idAsInt => int.parse(id);
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_model
|
name: angel_model
|
||||||
version: 1.0.0+1
|
version: 1.0.1
|
||||||
description: Angel's basic data model class, no longer with the added weight of the whole framework.
|
description: Angel's basic data model class, no longer with the added weight of the whole framework.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/model
|
homepage: https://github.com/angel-dart/model
|
||||||
|
|
Loading…
Reference in a new issue