ModelRef<T extends Model> class final

Reference to a model stored in a payload by key (SerializesModels). The model is reloaded fresh when the job runs; a missing row throws ModelNotFoundException, failing the job without retry.

Constructors

ModelRef(ModelDefinition<T> definition(), Object id)
A reference to the model with id, serialized as the id and loaded again when the job runs (Laravel's SerializesModels).
const
ModelRef.of(T model)
Builds a reference from a loaded model.
factory

Properties

definition → ModelDefinition<T> Function()
The model's definition.
final
hashCode → int
The hash code for this object.
no setterinherited
id → Object
The model's primary key.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve() → Future<T>
The model, loaded fresh; a 404 when it was deleted meanwhile.
toJson() → Object
The id, as stored in the payload.
toString() → String
A string representation of this object.
inherited

Operators

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