decodeWebResponse function

WebResponse decodeWebResponse(
  1. Object? json, [
  2. String field = 'webResponse'
])

Implementation

WebResponse decodeWebResponse(Object? json, [String field = 'webResponse']) {
  final map = _object(json, field);
  return WebResponse(
    status: _int(map['status'], '$field.status'),
    created: switch (map['created']) {
      null => null,
      final String created => created,
      _ => throw FormatException('$field.created: not a string'),
    },
    refusedBecause: switch (map['refusedBecause']) {
      null => null,
      final String why => why,
      _ => throw FormatException('$field.refusedBecause: not a string'),
    },
  );
}