A method to measure the antikaon–nucleon scattering length in lattice QCD