toJson method

Map<String, Object?> toJson()

This node as JSON, omitting what it does not carry so that a golden file stays readable.

Implementation

Map<String, Object?> toJson() => <String, Object?>{
  'role': role,
  if (name.isNotEmpty) 'name': name,
  if (value.isNotEmpty) 'value': value,
  if (tooltip.isNotEmpty) 'tooltip': tooltip,
  if (state.isNotEmpty) 'state': state,
  if (actions.isNotEmpty) 'actions': actions,
};