The measurement of translational diffusion coefficients by nuclear magnetic resonance (NMR) spectroscopy is essential in a broad range of fields, including organic, inorganic, polymer, and supramolecular chemistry. It is also a powerful method for mixture analysis. Spatially encoded diffusion NMR (SPEN DNMR)" is a time efficient technique to collect diffusion NMR data, which is particularly relevant for the analysis of samples that evolve in time. In many cases, motion other than diffusion is present in NMR samples. This is, for example, the case of flow NMR experiments, such as in online reaction monitoring and in the presence of sample convection. Such motion is deleterious for the accuracy of DNMR experiments in general and for SPEN DNMR in particular. Limited theoretical understanding of flow effects in SPEN DNMR experiments is an obstacle for their broader experimental implementation. Here, we present a detailed theoretical analysis of flow effects in SPEN DNMR and of their compensation, throughout the relevant pulse sequences. This analysis is validated by comparison with numerical simulation performed with the Fokker-Planck formalism. We then consider, through numerical simulation, the specific cases of constant, laminar, and convection flow and the accuracy of SPEN DNMR experiments in these contexts. This analysis will be useful for the design and implementation of fast diffusion NMR experiments and for their applications.