decodeMethod function
Implementation
Method decodeMethod(Object? json, [String field = 'method']) {
final raw = _string(json, field);
return Method.values.where((m) => m.name == raw).firstOrNull ??
(throw FormatException('$field: not a method ($raw)'));
}