CockpitWidgetTreeOptions.fromJson constructor

CockpitWidgetTreeOptions.fromJson(
  1. Map<String, Object?> json
)

Decodes widget-tree capture options from a JSON object.

Implementation

factory CockpitWidgetTreeOptions.fromJson(Map<String, Object?> json) {
  CockpitFoundationValueReader.keys(json, const <String>{
    'profile',
    'maxNodes',
    'maxProps',
  }, r'$');
  return CockpitWidgetTreeOptions(
    profile: json['profile'] == null
        ? CockpitWidgetTreeProfile.minimal
        : CockpitWidgetTreeProfile.fromJson(json['profile']),
    maxNodes: json['maxNodes'] == null
        ? 800
        : CockpitFoundationValueReader.integer(
            json['maxNodes'],
            r'$.maxNodes',
            min: 1,
            max: 500000,
          ),
    maxProps: json['maxProps'] == null
        ? 0
        : CockpitFoundationValueReader.integer(
            json['maxProps'],
            r'$.maxProps',
            min: 0,
            max: 256,
          ),
  );
}