GenerateRouterFor class

Annotation for top level getters to generate a router that handles all routers of the types passed using the package shelf_routing_generator.

Example

// Always import 'shelf_router' without 'show' or 'as'.
import 'package:shelf_router/shelf_router.dart';
// Always import 'shelf_routing' without 'show' or 'as'.
import 'package:shelf_routing/shelf_routing.dart' show Request, Response;

// Include generated code, this assumes current file is 'services_router.dart'.
part 'services_router.g.dart';

// Get a router for all these services.
@GenerateRouterFor([MyService, MyAnotherService])
Router get router => _$router;
Annotations
  • @Target({TargetKind.getter})

Constructors

GenerateRouterFor(List<Type> routables)
See class documentation
const

Properties

hashCode int
The hash code for this object.
no setterinherited
routables List<Type>
List of services that have a static getter that returns a Router
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