
747 So.2d 447 (1999)
NEVADA INTERSTATE PROPERTIES CORPORATION, a Nevada corporation, Appellant,
v.
The CITY OF WEST PALM BEACH, a Florida municipal corporation, Appellee.
No. 98-4383.
District Court of Appeal of Florida, Fourth District.
December 15, 1999.
Randy D. Ellison, West Palm Beach and Charles Eiss, Plantation, for appellant.
Patrick N. Brown, City Attorney, and Sonja K. Knighton, Assistant City Attorney, West Palm Beach, for appellee.
HAZOURI, J.
Nevada Interstate Properties Corporation (Nevada) appeals from the final judgment dismissing its complaint with prejudice. We reverse.
On April 6, 1995, Nevada became a mortgagee on certain property located *448 within the City of West Palm Beach (the City) by recording an assignment of note and mortgage in the public records of Palm Beach County, Florida. In April of 1997, the City demolished the buildings on the subject property because of what it deemed to be building code violations without giving notice to Nevada of the intent to demolish the buildings. Subsequent to the demolition, Nevada obtained fee simple title to the property by foreclosure.
Nevada filed a two-count complaint against the City alleging in count I, negligence, and in count II, violation of due process. In count I, Nevada alleged the City negligently failed to provide notice of its intention to demolish the buildings as required by the City's building code. In count II, Nevada alleged that it was denied the right and opportunity to be heard prior to the destruction of the buildings under the City's building code, the United States Constitution and the Florida Constitution.
In the order dismissing Nevada's two-count complaint, the Court held: (1) The city demolished the property pursuant to its building code and in exercise of its police power; (2) There is no duty of care with regard to how a government enforces its building code; (3) The city is immune from any liability associated with its alleged negligent failure to give notice to Nevada of the demolition of the property; and (4) Nevada's claims are barred by the doctrine of sovereign immunity and the trial court lacks subject matter jurisdiction over this matter. The trial court was correct that Nevada did not establish a cause of action for negligence in count I in light of our supreme court's decision in Trianon Park Condominium Ass'n. v. City of Hialeah, 468 So.2d 912, 914 (Fla.1985). However, the trial court clearly erred in dismissing count II based upon the violation of the United States Constitution because a mortgagee's lien is a compensable property interest within the meaning of the Fifth Amendment of the United States Constitution. See Shelden v. United States, 7 F.3d 1022, 1026 (Fed.Cir.1993).
As further grounds for reversal, we note the trial court dismissed Nevada's original complaint with prejudice without affording Nevada the opportunity to amend in an effort to cure defects in its pleadings. It is well settled that a dismissal with prejudice for failure to state a cause of action should not be ordered without giving the party offering the defective pleading an opportunity to amend, unless it is apparent that the pleading cannot be amended so as to state a cause of action. See Balcar v. Ramos, 595 So.2d 308 (Fla. 4th DCA 1992); Delia & Wilson, Inc. v. Wilson, 448 So.2d 621 (Fla. 4th DCA 1984); Hansen v. Central Adjustment Bureau, Inc., 348 So.2d 608 (Fla. 4th DCA 1977). Because we are unable to determine with certainty that Nevada cannot amend its initial complaint to state a cause of action other than a violation of the United States Constitution, the trial court's dismissal of counts I and II with prejudice was erroneous. On remand, the trial court shall permit Nevada to file an amended complaint should it choose to do so.
REVERSED AND REMANDED.
FARMER and KLEIN, JJ., concur.
