Move the code inside the onSuccess()
method that is depended on the result of AsyncCallback
.
It's clear from the name that AsyncCallback
is just like a AJAX request
that talks to server asynchronously
means the execution of code is not sequential.
Just move if(!flck.isEmpty)...
inside onSuccess()
method.