Map<String, Object?> toJson() { var state = this.state; final json = <String, Object?>{}; if (state != null) { json[r'state'] = state.value; } return json; }