PatchbayParameterDescriptorWire.fromJson constructor

PatchbayParameterDescriptorWire.fromJson(
  1. Map<String, Object?> json, {
  2. String path = r'$',
})

Decodes a strict JSON object at path.

Implementation

factory PatchbayParameterDescriptorWire.fromJson(
  Map<String, Object?> json, {
  String path = r'$',
}) {
  _wireKeys(json, const <String>{
    'name',
    'type',
    'required',
    'sensitive',
    'default',
    'allowedValues',
    'summary',
  }, path);
  return PatchbayParameterDescriptorWire(
    name: _wireString(json['name'], '$path.name'),
    type: PatchbayParameterTypeWire.fromJson(
      json['type'],
      path: '$path.type',
    ),
    required: _wireBool(json['required'], '$path.required'),
    sensitive: _wireBool(json['sensitive'], '$path.sensitive'),
    defaultValue: json['default'] == null
        ? null
        : _wireJson(json['default'], '$path.default'),
    allowedValues: json['allowedValues'] == null
        ? const <Object?>[]
        : _wireList(json['allowedValues'], '$path.allowedValues')
              .map((item) => _wireJson(item, '$path.allowedValues[]'))
              .toList(growable: false),
    summary: json['summary'] == null
        ? null
        : _wireString(json['summary'], '$path.summary'),
  );
}