From 8cdf71bea5f994e37a993024d644d4890a0c1bb6 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 4 Jul 2019 13:54:17 -0400 Subject: [PATCH] Update custom serializer doc --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4edf099c..c4175321 100644 --- a/README.md +++ b/README.md @@ -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. 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 -`dynamic`. +They are typically used together. Note that the argument to `deserializer` will always be +`dynamic`, while `serializer` can receive the data type in question. 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 @@ -268,7 +268,7 @@ and validations. ```dart 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 abstract class _HttpRequest {