This Letter presents the measurement of differential cross sections of isolated prompt photons produced in association with a b -jet or a c -jet. These final states provide sensitivity to the heavy-flavour content of the proton and aspects related to the modelling of heavy-flavour quarks in perturbative QCD. The measurement uses proton?proton collision data at a centre-of-mass energy of 8 TeV recorded by the ATLAS detector at the LHC in 2012 corresponding to an integrated luminosity of up to 20.2 fb -1 . The differential cross sections are measured for each jet flavour with respect to the transverse energy of the leading photon in two photon pseudorapidity regions: |ηγ|<1.37 and 1.56<|ηγ|<2.37 . The measurement covers photon transverse energies 25<ETγ<400 GeV and 25<ETγ<350 GeV respectively for the two |ηγ| regions. For each jet flavour, the ratio of the cross sections in the two |ηγ| regions is also measured. The measurement is corrected for detector effects and compared to leading-order and next-to-leading-order perturbative QCD calculations, based on various treatments and assumptions about the heavy-flavour content of the proton. Overall, the predictions agree well with the measurement, but some deviations are observed at high photon transverse energies. The total uncertainty in the measurement ranges between 13% and 66%, while the central γ+b measurement exhibits the smallest uncertainty, ranging from 13% to 27%, which is comparable to the precision of the theoretical