Rest class

An annotation used to specify how a field is serialized for a RestAdapter. Heavily inspired by JsonKey

Implemented types

Constructors

Rest({String defaultValue, bool enumAsString, String fromGenerator, bool ignore, bool ignoreFrom, bool ignoreTo, String name, bool nullable, String toGenerator})
Creates a new Rest instance. [...]
const

Properties

defaultValue String
The value to use if the source does not contain this key or if the value is null. Only applicable during deserialization. [...]
final
enumAsString bool
By default, all enums from REST are assumed to be delivered as int. For APIs that deliver enums as String (e.g. {"party", "baseball", ...}). Works for Iterable and single field types of enum. [...]
final
fromGenerator String
Manipulates output for the field in the deserialize generator. The instance's field name is automatically defined. While the build method is ultimately responsible for how the output is applied, it is most often directly injected as the value of the field in the deserialize adapter. [...]
final
hashCode int
The hash code for this object. [...]
read-only, inherited
ignore bool
true if the generator should ignore this field completely. When true, takes precedence over ignoreFrom and ignoreTo. Defaults to false.
final
ignoreFrom bool
true if this field should be ignored only during deserializization (when remote data is converted to Dart code). Defaults to false.
final
ignoreTo bool
true if this field should be ignored only during serializization (when Dart code is sent to a remote source). Defaults to false.
final
name String
The key name to use when reading and writing values corresponding to the annotated field. [...]
final
nullable bool
When true, null fields are handled gracefully when encoding from JSON. Defaults to false.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
toGenerator String
Manipulates output for the field in the serialize generator. The serializing key is defined from name or the default naming of the field. While the build method is ultimately responsible for how the output is applied, it is most often directly injected as the value of the field in the serialize adapter. [...]
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited

Constants

defaults → const Rest
An instance of Rest with all fields set to their default values.
const Rest(enumAsString: false, ignore: false, ignoreFrom: false, ignoreTo: false, nullable: false)