Allah ﷻ, and only Allah, knows the absolute unseen (Arabic: علم الغيب المطلق). The Prophet ﷺ received revelation from Allah through Gabriel about specific incidents at specific times, but he had no absolute knowledge of the unseen.
يَسْأَلُونَكَ عَنِ السَّاعَةِ أَيَّانَ مُرْسَاهَا ۖ قُلْ إِنَّمَا عِلْمُهَا عِندَ رَبِّي ۖ لَا يُجَلِّيهَا لِوَقْتِهَا إِلَّا هُوَ ۚ ثَقُلَتْ فِي السَّمَاوَاتِ وَالْأَرْضِ ۚ لَا تَأْتِيكُمْ إِلَّا بَغْتَةً ۗ يَسْأَلُونَكَ كَأَنَّكَ حَفِيٌّ عَنْهَا ۖ قُلْ إِنَّمَا عِلْمُهَا عِندَ اللَّهِ وَلَٰكِنَّ أَكْثَرَ النَّاسِ لَا يَعْلَمُونَ قُل لَّا أَمْلِكُ لِنَفْسِي نَفْعًا وَلَا ضَرًّا إِلَّا مَا شَاءَ اللَّهُ ۚ وَلَوْ كُنتُ أَعْلَمُ الْغَيْبَ لَاسْتَكْثَرْتُ مِنَ الْخَيْرِ وَمَا مَسَّنِيَ السُّوءُ ۚ إِنْ أَنَا إِلَّا نَذِيرٌ وَبَشِيرٌ لِّقَوْمٍ يُؤْمِنُونَ
They ask you, [O Muhammad], about the Hour: when is its arrival? Say, "Its knowledge is only with my Lord. None will reveal its time except Him. It lays heavily upon the heavens and the earth. It will not come upon you except unexpectedly." They ask you as if you are familiar with it. Say, "Its knowledge is only with Allah, but most of the people do not know." Say, "I hold not for myself [the power of] benefit or harm, except what Allah has willed. And if I knew the unseen, I could have acquired much wealth, and no harm would have touched me. I am not except a warner and a bringer of good tidings to a people who believe."
— Qur'an 7:187-188
These verses show that Prophet ﷺ had no knowledge of the unseen, otherwise he would have acquired wealth, and not have been harmed. In this context, one may say that had he known that he would have completed the Hijra trip without being harmed, he would not have done so and so. Having said that, this would be reverting to deductions based on interpretations of some incidents; this is prone to interpretation and personal opinion. Whereas, in the presence of a very clear verse like the one above (Allah commanding the Prophet ﷺ to say he did not know the unseen), there is no need for deductions or inferences.
One may say from the above verses that the Prophet ﷺ did not know the unseen, but others might have. Allah ﷻ makes it very clear in the following verse that this knowledge is only His, and no one else's:
قُل لَّا يَعْلَمُ مَن فِي السَّمَاوَاتِ وَالْأَرْضِ الْغَيْبَ إِلَّا اللَّهُ ۚ وَمَا يَشْعُرُونَ أَيَّانَ يُبْعَثُونَ
Say, "None in the heavens and earth knows the unseen except Allah, and they do not perceive when they will be resurrected."
— Qur'an 27:65
Finally, while the Prophet ﷺ received revelations of prophecies, so did others who were either prophets ...
فَلَمَّا ذَهَبُوا بِهِ وَأَجْمَعُوا أَن يَجْعَلُوهُ فِي غَيَابَتِ الْجُبِّ ۚ وَأَوْحَيْنَا إِلَيْهِ لَتُنَبِّئَنَّهُم بِأَمْرِهِمْ هَٰذَا وَهُمْ لَا يَشْعُرُونَ
So when they took him [out] and agreed to put him into the bottom of the well. But We inspired to him, "You will surely inform them [someday] about this affair of theirs while they do not perceive [your identity]."
— Qur'an 12:15
... or not prophets:
إِذْ أَوْحَيْنَا إِلَىٰ أُمِّكَ مَا يُوحَىٰ أَنِ اقْذِفِيهِ فِي التَّابُوتِ فَاقْذِفِيهِ فِي الْيَمِّ فَلْيُلْقِهِ الْيَمُّ بِالسَّاحِلِ يَأْخُذْهُ عَدُوٌّ لِّي وَعَدُوٌّ لَّهُ ۚ وَأَلْقَيْتُ عَلَيْكَ مَحَبَّةً مِّنِّي وَلِتُصْنَعَ عَلَىٰ عَيْنِي
When We inspired to your mother what We inspired, [Saying], 'Cast him into the chest and cast it into the river, and the river will throw it onto the bank; there will take him an enemy to Me and an enemy to him.' And I bestowed upon you love from Me that you would be brought up under My eye.
— Qur'an 20:38-39