2021-07-25 10:47:41 +00:00
|
|
|
# Angel3 Serialize Generator
|
|
|
|
|
2021-09-25 06:32:32 +00:00
|
|
|
![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_serialize_generator?include_prereleases)
|
2021-05-15 14:37:52 +00:00
|
|
|
[![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)
|
2023-12-25 03:45:10 +00:00
|
|
|
[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/serialize/angel_serialize_generator/LICENSE)
|
2021-05-15 14:37:52 +00:00
|
|
|
|
2023-09-23 03:31:46 +00:00
|
|
|
The builder for Angel3 serialization.
|
2021-05-15 14:37:52 +00:00
|
|
|
|
2023-09-23 03:31:46 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
1. Create a model class in `todo.dart` and annotate it with `@serializable`
|
|
|
|
|
|
|
|
```dart
|
|
|
|
import 'package:angel3_serialize/angel3_serialize.dart';
|
|
|
|
part 'todo.g.dart';
|
|
|
|
|
|
|
|
@serializable
|
|
|
|
class _Todo {
|
|
|
|
String? text;
|
|
|
|
bool? completed;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Run the following command to generate the associated `todo.g.dart` file for serialization.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
dart run build_runner build
|
|
|
|
```
|