Update README
This commit is contained in:
parent
d1da61ba64
commit
7c1735c113
1 changed files with 8 additions and 3 deletions
11
README.md
11
README.md
|
@ -37,7 +37,10 @@ with a call to `watch`. They take the same parameters.
|
||||||
# Models
|
# Models
|
||||||
There are a few changes opposed to normal Model classes. You need to add a `@serializable` annotation to your model
|
There are a few changes opposed to normal Model classes. You need to add a `@serializable` annotation to your model
|
||||||
class to have it serialized, and a serializable model class's name should also start
|
class to have it serialized, and a serializable model class's name should also start
|
||||||
with a leading underscore. In addition, you may consider using an `abstract` class.
|
with a leading underscore.
|
||||||
|
|
||||||
|
In addition, you may consider using an `abstract` class to ensure immutability
|
||||||
|
of models.s
|
||||||
|
|
||||||
Rather you writing the public class, `angel_serialize` does it for you. This means that the main class can have
|
Rather you writing the public class, `angel_serialize` does it for you. This means that the main class can have
|
||||||
its constructors automatically generated, in addition into serialization functions.
|
its constructors automatically generated, in addition into serialization functions.
|
||||||
|
@ -53,8 +56,10 @@ part 'book.g.dart';
|
||||||
|
|
||||||
@serializable
|
@serializable
|
||||||
abstract class _Book extends Model {
|
abstract class _Book extends Model {
|
||||||
String author, title, description;
|
String get author;
|
||||||
int pageCount;
|
String get title;
|
||||||
|
String get description;
|
||||||
|
int get pageCount;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue