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');
}
}
Properties
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