serializers top-level property

  1. @SerializersFor([DeviceInfo, DeviceLocator, OperatingSystems])
Serializers serializers
final

Can add additional plugins that will serialize types like DateTime

  • It is also possible to write your own Serializer plugins for type that are not supported by default.
  • For Example: https://github.com/google/built_value.dart/issues/543 implements SerializerPlugin and writes a serializer for Firebase Datetime that converts TimeStamp or DateTime to integers.

Implementation

@SerializersFor([
  // Add the built values that require serialization
  DeviceInfo,
  DeviceLocator,
  OperatingSystems
])

/// Can add additional plugins that will serialize types like [DateTime]
///   - It is also possible to write your own Serializer plugins for type that
///   are not supported by default.
///   - For Example: https://github.com/google/built_value.dart/issues/543
///   implements [SerializerPlugin] and writes a serializer for Firebase
///   Datetime that converts TimeStamp or DateTime to integers.
final Serializers serializers = (_$serializers.toBuilder()
      ..addPlugin(StandardJsonPlugin())
      ..add(Iso8601DateTimeSerializer()))
    .build();