Controller
flash()
Signature
Section titled “Signature”flash() — returns any
Available in: controller
Category: Flash Functions
Description
Section titled “Description”Returns the value of a specific key in the Flash (or the entire Flash as a struct if no key is passed in).
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
key | string | no | — | The key to get the value for. |
Examples
Section titled “Examples”// 1. Get the current value of a specific key in the Flash
notice = flash("notice");
// notice -> "Your profile was updated successfully."
// 2. Get the entire Flash as a struct when no key is passed
flashContents = flash();
// flashContents -> {notice: "Record saved.", error: "Something went wrong."}
// 3. Check for a key before reading it to avoid an empty-string fallback
if (flashKeyExists("error")) {
errorMessage = flash("error");
}