  The results of a search for direct pair production of top squarks and for
dark matter in events with two opposite-charge leptons (electrons or muons),
jets and missing transverse momentum are reported, using 139 fb$^{-1}$ of
integrated luminosity from proton-proton collisions at $\sqrt{s} = 13$ TeV,
collected by the ATLAS detector at the Large Hadron Collider during Run 2
(2015-2018). This search considers the pair production of top squarks and is
sensitive across a wide range of mass differences between the top squark and
the lightest neutralino. Additionally, spin-0 mediator dark-matter models are
considered, in which the mediator is produced in association with a pair of top
quarks. The mediator subsequently decays to a pair of dark-matter particles. No
significant excess of events is observed above the Standard Model background,
and limits are set at 95% confidence level. The results exclude top squark
masses up to about 1 TeV, and masses of the lightest neutralino up to about 500
GeV. Limits on dark-matter production are set for scalar (pseudoscalar)
mediator masses up to about 250 (300) GeV.
