Back
flashIsEmpty()
The flashIsEmpty() function checks whether the Flash scope contains any keys. It returns true if the Flash is empty and false if it contains one or more keys. This is useful for conditionally displaying messages or deciding whether to process Flash data before reading or clearing it.
1. Check if the Flash is empty
if (flashIsEmpty()) {
writeOutput("No messages to display.");
} else {
writeOutput("There are messages in Flash.");
}
2. Use before reading a specific key
if (!flashIsEmpty() && structKeyExists(flash(), "notice")) {
writeOutput(flash("notice"));
}
3. Typical flow: after clearing Flash
flashClear();
writeOutput(flashIsEmpty()); // true
Copied!