2024-10-12 10:35:14 +00:00
|
|
|
# Protevus Serialize Generator
|
2021-07-25 10:47:41 +00:00
|
|
|
|
2024-10-13 01:45:27 +00:00
|
|
|
![Pub Version (including pre-releases)](https://img.shields.io/pub/v/protevus_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)
|
2024-07-07 15:02:49 +00:00
|
|
|
[![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM)
|
2024-10-12 10:35:14 +00:00
|
|
|
[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/serialize/angel_serialize_generator/LICENSE)
|
2021-05-15 14:37:52 +00:00
|
|
|
|
2024-10-12 10:35:14 +00:00
|
|
|
The builder for Protevus 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
|
2024-10-13 01:45:27 +00:00
|
|
|
import 'package:protevus_serialize/protevus_serialize.dart';
|
2023-09-23 03:31:46 +00:00
|
|
|
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
|
|
|
|
```
|