This appeal arises out of appellants’ inverse condemnation action against appel-lees and the Department of Environmental Regulation (DER). Appellants’ suit seeks compensation based on allegations that the actions of appellees and DER resulted in a taking of submerged lands which appellants’ predecessor in title purchased from appellees.
During the pleadings stage of the suit, appellees moved to dismiss the action against them but the court denied the motion. Later, at a pretrial conference, appel-lees again moved for involuntary dismissal of the action against them. The judge granted the motion and dismissed the complaint with prejudice as to appellees.
On appeal, appellees concede that it may have been proeedurally improper for the court to have granted the involuntary dismissal before the appellants had completed the presentation of their case. In Re Estate of McCoy, 445 So.2d 680 (Fla.2d DCA 1984). Yet, appellees contend that any error was harmless because the trial judge *556could have entered summary judgment at that time.
Moreover, appellees point to the appellants’ failure to have proffered any amendment to their complaint at the pretrial conference. The appellants respond that their failure to offer an amendment was justified because they were not on notice that the judge might grant a motion to dismiss at that time. We think appellants’ contention is reasonable, especially in view of the court’s previous denial of appellees’ motion to dismiss.
Generally, a trial court must allow a litigant the opportunity to amend a complaint before dismissing its suit with prejudice unless it is clear that the pleading cannot be amended so as to state a cause of action. Delia & Wilson, Inc. v. Wilson, 448 So.2d 621 (Fla. 4th DCA 1984). At oral argument appellants contended that if afforded the opportunity they could amend their complaint to state a cause of action against appellees. We express no view as to appellants’ ability to do so; nevertheless, under the circumstances, we think they should be given that opportunity.
Accordingly, we reverse the trial court’s order dismissing the action against appel-lees and remand with the direction that appellants be permitted to file an amended complaint.
RYDER, C.J., and LEHAN, J., concur.