parse static method
- String? body
null for anything but an ObservANT camera's answer.
Implementation
static ObservantSettings? 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 ObservantSettings(
name: name,
rotate: rotate,
score: score.toDouble(),
ignore: parseZones(json['ignore']),
classes: json['classes'] is List
? <String>[
for (final c in json['classes'] as List)
if (c is String) c,
]
: null,
classesLocked: json['privacy'] == 'pixelate',
);
}