PluginCheckOutcome.fromJson constructor
PluginCheckOutcome.fromJson(
- Object? json
Reads one outcome as conformanceReport writes it. Throws a
FormatException for an entry that is not one: an entry without a
check, a passed and a says of their types.
Implementation
factory PluginCheckOutcome.fromJson(Object? json) => switch (json) {
{
'check': final String check,
'passed': final bool passed,
'says': final String says,
} =>
PluginCheckOutcome(
check: check,
passed: passed,
says: says,
backend: json['backend'] is String ? json['backend']! as String : null,
declined: json['declined'] == true,
requires: switch (json['requires']) {
final List<Object?> list when list.every((e) => e is String) =>
List<String>.unmodifiable(list.cast<String>()),
_ => const <String>[],
},
),
_ => throw FormatException(
'not a check outcome: an outcome has a string "check", a bool '
'"passed" and a string "says"',
json,
),
};