IntoResponse class abstract interface

A value that can turn itself into an HTTP Response.

Handler return types implementing this are written to the wire by calling intoResponse. Dust also detects the method structurally, so an unrelated class exposing Response intoResponse() works the same way.

class NotFound implements IntoResponse {
  const NotFound(this.message);

  final String message;

  @override
  Response intoResponse() => jsonResponse({'error': message}, status: 404);
}
Implementers

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

intoResponse() Response
Builds the response for this value.
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