DwiPayload class final

Marks a class whose instances may be sent to and returned from a worker task (ADR-021).

dwi_builder generates the encoder and decoder. The class must:

  • be public, concrete and non-generic, in a library under lib/;
  • have a public unnamed constructor;
  • expose, for every constructor parameter, a public instance getter or field with the same name and the same type.

Only the constructor parameters cross the boundary: the worker receives a new instance built from them, never the original object. State that is not a constructor parameter is not transferred, and a subclass instance arrives as the declared class.

@DwiPayload()
class Range {
  const Range(this.start, {required this.end});
  final int start;
  final int end;
}

Constructors

DwiPayload()
Creates a payload marker.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
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
toString() → String
A string representation of this object.
inherited

Operators

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