Charge doping of iron-pnictide superconductors leads to collective pinning of flux vortices, whereas isovalent doping does not. Moreover, flux pinning in the charge-doped compounds is consistently described by the mean-free path fluctuations introduced by the dopant atoms, allowing for the extraction of the elastic quasiparticle scattering rate. The absence of scattering by dopant atoms in isovalently doped BaFe$_{2}$(As$_{1-x}$P$_{x}$)$_{2}$ is consistent with the observation of a linear temperature dependence of the low-temperature penetration depth in this material.