  The presence of distant protoplanets may explain the observed gaps in the
dust emission of protoplanetary disks. Here, we derive a novel analytical model
to describe the temporal decay of the pebble flux through a protoplanetary disk
as the result of radial drift. This has allowed us to investigate the growth
and migration of distant protoplanets throughout the lifespan of the disk. We
find that Moon-mass protoplanets that formed early on can grow to their pebble
isolation mass, between approximately $20$ and $80\,M_{\oplus}$, within less
than $1\,\mathrm{Myr,}$ in the $20$ to $80\,\mathrm{AU}$ region around
solar-like stars. The subsequent fast migration in the early stages of gas
accretion, after pebble accretion ends, transports these giant planets into
their final orbits at $<\,$$10\,\mathrm{AU}$. However, our pebble decay model
allows us to include a new pathway that may trigger the transition from pebble
accretion to gas accretion after the pebble flux has decayed substantially.
With this pebble decay pathway, we show that it is also possible to form gas
giants beyond $10\,\mathrm{AU}$. The occurrence of these wide-orbit gas giants
should be relatively low, since their core must attain sufficient mass to
accrete gas before the pebble flux decays, while avoiding excessive migration.
Since these gas giants do not reach the pebble isolation mass, their heavy
element content is typically less than $10\,M_{\oplus}$. Our results imply that
the observed gaps in protoplanetary disks could be caused by distant
protoplanets that reached the pebble isolation mass and then migrated, while
gas giants in wide orbits, such as PDS 70 b and c, accreted their gas after the
decay in the pebble flux.
