requiredBinding top-level constant

const requiredBinding = const RequiredBinding()

Marks an ResourceController property binding as required.

Bindings are often applied to operation method arguments, in which required vs. optional is determined by whether or not the argument is in required or optional in the method signature.

When properties are bound, they are optional by default. Adding this metadata to a bound controller property requires that it for all operation methods.

For example, the following controller requires the header 'X-Request-ID' for both of its operation methods:

    class UserController extends ResourceController {
      String requestID;

      Future<Response> getUser(@Bind.path("id") int id) async
         => return Response.ok(await getUserByID(id));

      Future<Response> getAllUsers() async
         => return Response.ok(await getUsers());


const RequiredBinding requiredBinding = RequiredBinding()