The dynamical quantum phase transition is characterized by the emergence of nonanalytic behaviors in the rate function, corresponding to the occurrence of exact zero points of the Loschmidt echo in the thermodynamical limit. In general, exact zeros of the Loschmidt echo are not accessible in a finite-size quantum system except for some fine-tuned quench parameters. In this work, we study the realization of the dynamical singularity of the rate function for finite-size systems under the twist boundary condition, which can be introduced by applying a magnetic flux. By tuning the magnetic flux, we illustrate that exact zeros of the Loschmidt echo can be always achieved when the postquench parameter is across the underlying equilibrium phase transition point, and thus the rate function of a finite-size system is divergent at a series of critical times. We demonstrate our theoretical scheme by calculating the Su-Schrieffer-Heeger model and the Creutz model in detail and exhibit its applicability to more general cases. Our result unveils that the emergence of dynamical singularity in the rate function can be viewed as a signature for detecting dynamical quantum phase transition in finite-size systems. We also unveil that the critical times in our theoretical scheme are independent on the systems size, and thus it provides a convenient way to determine the critical times by tuning the magnetic flux to achieve the dynamical singularity of the rate function.