You shouldn’t, really. That pattern is ‘two stage initialisation’ which is easy to get wrong, for example if you forget to signal that the initialisation has been completed.
The APVTS has two constructors: one which takes a ParameterLayout, and one which does not. The one which doesn’t also doesn’t set the state to valid, so you could use that (old) constructor, call createAndAddParameter a few times, and then finally set the state to valid. However, as I said above, this approach is not recommended, and createAndAddParameter may be removed in a future JUCE update. Instead, it’s better to write a helper function to create a ParameterLayout, and to pass the resulting layout to the constructor of the APVTS.
