  Neutrons play an important role in the dynamics of gamma-ray bursts. The
presence of neutrons in the baryon-loaded fireball is expected. If the neutrons
abundance is comparable to that of protons, important features may be observed
such as quasi-thermal multi-GeV neutrinos in coincidence with a subphotospheric
$\gamma$-ray emission, nucleosynthesis at later times and rebrightening of the
afterglow emission. Additionally, thermal MeV neutrinos are created by
electron-positron annihilation, electron (positron) capture on protons
(neutrons) and nucleonic bremsstrahlung. Although MeV neutrinos are difficult
to detect, quasi-thermal GeV neutrinos are expected in km$^3$ detectors and/or
DeepCore+IceCube. In this paper, we show that neutrino oscillations have
outstanding implications for the dynamics of the fireball evolution and also
that they can be detected through their flavor ratio on Earth. For that we
derive the resonance and charged-neutrality conditions as well as the neutrino
self-energy and effective potential up to order $m_W^{-4}$ at strong, moderate
and weak magnetic field approximation to constrain the dynamics of the
fireball. We found important implications: i) resonant oscillations are
suppressed for high baryon densities as well as neutrons abundance larger than
that of protons and ii) the effect of magnetic field is to decrease the
proton-to-neutron ratio aside from the number of multi-GeV neutrinos expected
in DeepCore detector. Also we estimate the GeV neutrino flavor ratios along the
jet and on Earth.
