SecurityRequirement class
Represents a Security Requirement Object in OpenAPI/Swagger 2.0.
Each SecurityRequirement maps a security scheme name to an optional list of required scopes. For non-OAuth2 schemes, the list must be empty.
Example:
{ "api_key": [] }
{ "oauth2": ["read", "write"] }
- Annotations
-
- @immutable
Constructors
-
SecurityRequirement.new({required String name, required List<
String> scopes}) -
Creates a SecurityRequirement.
const
-
SecurityRequirement.fromJson(Map<
String, dynamic> json) -
Parses a
SecurityRequirement
from JSON (map with one key).factory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- name → String
-
The name of the security scheme (must match one in
securityDefinitions
).final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
scopes
→ List<
String> -
List of scopes for OAuth2 (empty for other types).
final
Methods
-
copyWith(
{String? name, List< String> ? scopes}) → SecurityRequirement - Returns a copy of this instance with updated fields.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this SecurityRequirement to JSON.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override