Put class

Marks a method as a handler for HTTP PUT requests.

Use this annotation on controller methods to map them to HTTP PUT endpoints. The path parameter specifies the route path relative to the controller's base path. PUT requests are typically used for updating existing resources with a complete replacement.

Example:

@Controller('/api/users')
class UserController {
  final UserService _service;

  UserController(this._service);

  @Put('/:id') // Maps to PUT /api/users/:id
  Future<Response> updateUser(
    Request request,
    @Param('id') String id,
    @Body() UserDTO user
  ) async {
    final updated = await _service.update(id, user);
    return updated
        ? Response.ok(jsonEncode({'success': true}))
        : Response.notFound('User not found');
  }
}

Constructors

Put([String path = '/'])
Creates a Put annotation with the specified path.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
path String
The route path relative to the controller's base path.
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
toString() String
A string representation of this object.
inherited

Operators

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