Angel3 Data Model
The basic data models for ORM used in Angel3 framework.
import 'package:angel3_model/angel3_model.dart';
Installation
In your pubspec.yaml:
dependencies:
angel3_model: ^10.0.0
The available data models are:
Modelclass- A basic data model
AuditableModelclass- A basic data model with audit log feature
Usage
import 'package:angel3_model/angel3_model.dart';
class Todo extends Model {
String? text;
bool isComplete;
Todo({
required String super.id,
this.text,
this.isComplete = false,
super.createdAt,
super.updatedAt,
});
}
void main() {
var todo = Todo(id: '34');
print(todo.idAsInt == 34); // true
}
Migrating from 9.x to 10.0.0
The breaking changes of each release are listed in the CHANGELOG. Those of 10.0.0 that may need changes in an app:
-
noneis an instance ofNone(const None()), sonone is Noneis true. Compare types withNone, asT == noneis now false:// 9.x if (T == none) { ... } // 10.0.0 if (T == None) { ... } -
Noneis afinal classwith aconstconstructor, and everyNoneequalsnone, which can no longer be in a constant set or be a constant map key.