toJson method

Map<String, Object?> toJson()

This hint as a document writes it: key and the kind's name, then only what was given.

Implementation

Map<String, Object?> toJson() => <String, Object?>{
  'key': key,
  'kind': kind.name,
  'label': ?label,
  'help': ?help,
  'min': ?min,
  'max': ?max,
  'step': ?step,
  if (unit case final Unit unit) 'unit': unit.toJson(),
  if (choices.isNotEmpty) 'choices': choices,
  if (suffixes.isNotEmpty) 'suffixes': suffixes,
  'default': ?defaultValue,
  if (readOnly) 'readOnly': true,
};