serializers top-level property

  1. @SerializersFor([NetworkState, ApiError, Endpoint])
Serializers serializers
final

Example of how to use built_value serialization.

Declare a top level Serializers field called serializers. Annotate it with SerializersFor and provide a const List of types you want to be serializable.

The built_value code generator will provide the implementation. It will contain serializers for all the types asked for explicitly plus all the types needed transitively via fields.

You usually only need to do this once per project.

Implementation

@SerializersFor([
  // ErrorState,
  NetworkState,
  ApiError,
  Endpoint,
])
final Serializers serializers =
    (_$serializers.toBuilder()..addPlugin(new StandardJsonPlugin())).build();