CorsPolicy.fromJson constructor
Creates a CorsPolicy from JSON data.
Implementation
CorsPolicy.fromJson(Map<String, dynamic> json)
: this(
allowOrigins: json['allowOrigins'] != null
? (json['allowOrigins'] as Iterable)
.cast<Map<String, dynamic>>()
.map((e) => StringMatch.fromJson(e))
.toList()
: null,
allowMethods: json['allowMethods'] != null
? List<String>.from(json['allowMethods'])
: null,
allowHeaders: json['allowHeaders'] != null
? List<String>.from(json['allowHeaders'])
: null,
exposeHeaders: json['exposeHeaders'] != null
? List<String>.from(json['exposeHeaders'])
: null,
maxAge: parseDuration(json['maxAge']),
allowCredentials: json['allowCredentials'],
);