"For behold, it came to pass that the Lord spake unto my father, yea, even in a dream, and said unto him: Blessed art thou Lehi, because of the things which thou hast done; and because thou has been faithful and declared unto this people the things which I commanded thee, behold, they seek to take away thy life."
Many times prophets receive revelations though dreams. I think it's the time that the heart and mind are open to the words of the Lord. Sister Parrish believes it this the time the desires of the heart can come though and the Lord can speak to the heart.
Because of the faithfulness of the servants of God He warns and protects. Thee Lord being omnipotent knew of the danger to Lehi and his family. The Lord out of mercy and love warned them to leave and to continue to follow the commandments. As Lehi had done all he could the Lord could bless him and his family with safety.