There might be a bug in your API endpoint code.
In your code, you are setting:
val acceptors : ArrayList<Party>? = null;
And then in the subsequent loop, you have the following logic for expanding the array:
if (acceptors != null) {
acceptors.add(to)
}
Since acceptors is initialised to null, this condition is never true and you never expand the list. As a result, when you try to construct the YoFlow, you are trying to set the target parameter to null, which isn't allowed due to Kotlin's null safety.
Try this instead:
val acceptors = mutableListOf<Party>()