state method

void state(
  1. String stateId,
  2. String stateLabel, {
  3. String? description,
  4. List<FieldDescriptor> fields = const [],
  5. required PanelStateReader read,
})

Declares a snapshot the host can ask for.

Implementation

void state(
  String stateId,
  String stateLabel, {
  String? description,
  List<FieldDescriptor> fields = const [],
  required PanelStateReader read,
}) {
  _states[stateId] = (
    StateDescriptor(
      stateId,
      stateLabel,
      description: description,
      fields: fields,
    ),
    read,
  );
  _panels._changed();
}