SwaggerSecurity constructor

const SwaggerSecurity({
  1. required String name,
  2. String position = 'header',
  3. required String type,
  4. String? scheme,
  5. String? bearerFormat,
  6. String? description,
})

Using to make Authentication in Swagger https://swagger.io/docs/specification/authentication/

Implementation

const SwaggerSecurity({
  required this.name,
  this.position = 'header',
  required this.type,
  this.scheme,
  this.bearerFormat,
  this.description,
})  : assert(
        position == 'query' || position == 'header' || position == 'cookie',
        'position should be: "query" | "header" | "cookie"',
      ),
      assert(
        type == 'http' ||
            type == 'apiKey' ||
            type == 'oauth2' ||
            type == 'openIdConnect',
        'type should be: "http" | "apiKey" | "oauth2" | "openIdConnect"',
      ),
      assert(
        scheme == null || scheme == 'basic' || scheme == 'bearer',
        'scheme should be: null | "basic" | "bearer"',
      );