Routes class final

Declares that a library's top-level handlers form a route module.

This is the function-style counterpart to @Controller: it gives the module a prefix without requiring a class to hang it on. Without it, a library of annotated functions still generates a group, but with no prefix of its own.

@Routes('/notes')
library notes;

import 'package:dust_server/server.dart';

part 'notes.g.dart';

@GET('/{id}')
Future<Note> read(@Path() String id, @State() NoteRepo repo) => repo.find(id);
Annotations
  • @Target.new({TargetKind.library})

Constructors

Routes(String path, {String? name, List<String> tags = const [], List<Object> middleware = const []})
Declares a route module rooted at path.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
middleware List<Object>
Middleware applied to every handler in the library.
final
name String?
The name of the generated getter.
final
path String
The path prefix shared by every handler in the library.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tags List<String>
Tags inherited by every handler, for documentation tooling.
final

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