parse static method

CatCamSettings? parse(
  1. String? body
)

null for anything but a cat cam's answer.

Implementation

static CatCamSettings? parse(String? body) {
  final json = decodeJsonObject(body);
  if (json == null) {
    return null;
  }
  final name = json['name'];
  final rotate = json['rotate'];
  final score = json['score'];
  if (name is! String || rotate is! int || score is! num) {
    return null;
  }
  return CatCamSettings(
    name: name,
    rotate: rotate,
    score: score.toDouble(),
    ignore: parseZones(json['ignore']),
  );
}