Update custom serializer doc

This commit is contained in:
Tobe O 2019-07-04 13:54:17 -04:00
parent e5d9a0851e
commit 8cdf71bea5

View file

@ -259,8 +259,8 @@ abstract class _Foo extends Model {}
`package:angel_serialize` does not cover every known Dart data type; you can add support for your own. `package:angel_serialize` does not cover every known Dart data type; you can add support for your own.
Provide `serializer` and `deserializer` arguments to `@SerializableField()` as you see fit. Provide `serializer` and `deserializer` arguments to `@SerializableField()` as you see fit.
They are typically used together. Note that the argument to `serializer` will always be They are typically used together. Note that the argument to `deserializer` will always be
`dynamic`. `dynamic`, while `serializer` can receive the data type in question.
In such a case, you might want to also provide a `serializesTo` argument. In such a case, you might want to also provide a `serializesTo` argument.
This lets the generator, as well as the ORM, apply the correct (de)serialization rules This lets the generator, as well as the ORM, apply the correct (de)serialization rules
@ -268,7 +268,7 @@ and validations.
```dart ```dart
DateTime _dateFromString(s) => s is String ? HttpDate.parse(s) : null; DateTime _dateFromString(s) => s is String ? HttpDate.parse(s) : null;
String _dateToString(v) => v == null ? null : HttpDate.format(v); String _dateToString(DateTime v) => v == null ? null : HttpDate.format(v);
@serializable @serializable
abstract class _HttpRequest { abstract class _HttpRequest {