Map<String, dynamic> toJson() { final state = this.state; return { if (state != null) 'State': state.toValue(), }; }