RestSerializable class

An annotation used to specify a class to generate code for.

Creates a serialize/deserialize function for JSON.

Heavily borrowed/inspired by JsonSerializable

Constructors

RestSerializable({String? endpoint, FieldRename? fieldRename, String? fromKey, bool? nullable, String? toKey})
Creates a new RestSerializable instance.
const

Properties

endpoint String?
Callback to produce a REST path from a Query. An instance argument is provided only when it is available to the invoking repository method (i.e. upsert or delete).
final
fieldRename FieldRename
Defines the automatic naming strategy when converting class field names into JSON map keys.
final
fromKey String?
When deserializing from REST, the response may be nested within a top level key. If no key is defined, the first value will be returned. This configuration is overriden when a query specifies providerArgs['topLevelKey'].
final
hashCode int
The hash code for this object.
no setterinherited
nullable bool
When true (the default), null fields are handled gracefully when decoding null and nonexistent values from JSON. This indicates that the fields from REST could be null and is not related to Dart nullability.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toKey String?
When serializing to REST, the payload may need to be nested within a top level key.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaults → const RestSerializable
An instance of RestSerializable with all fields set to their default values.