Ferroelastic twin walls in nonpolar materials can give rise to a spontaneous polarization due to symmetry breaking. Nevertheless, the bistable polarity of twin walls and its reversal have not yet been demonstrated. Here, we report that the polarity of SrTiO_{3} twin walls can be switched by an ultralow strain gradient. Using first-principles-based machine-learning potential, we demonstrate that the twin walls can be deterministically rotated and realigned in specific directions under the strain gradient, which breaks the inversion symmetry of a sequence of walls and leads to a macroscopic polarization. The system can maintain polarity even after the constraint is removed. As a result, the polarization of twin walls can exhibit a ferroelectriclike hysteresis loop upon cyclic bending, namely flexoferroelectricity. Finally, we propose a scheme to experimentally detect the polarity of the twin wall by measuring the bulk photovoltaic responses. Our findings suggest a twin-wall-mediated flexoferroelectricity in SrTiO_{3}, which could be potentially exploited as functional elements in nanoelectronic devices design.