Alert class

A fluent builder for creating styled alerts.

Provides a chainable API for alert configuration with support for the new Style system, custom borders, and multiple display styles.

final alert = Alert()
    .info()
    .message('Operation completed successfully!')
    .displayStyle(AlertDisplayStyle.block)
    .render();

print(alert);

// Or with custom styling
final customAlert = Alert()
    .message('Custom alert')
    .prefix('[CUSTOM]')
    .prefixStyle(Style().bold().foreground(Colors.magenta))
    .messageStyle(Style().italic())
    .render();
Inheritance
Available extensions

Constructors

Alert({RenderConfig renderConfig = const RenderConfig()})
Creates a new empty alert builder.

Properties

hashCode → int
The hash code for this object.
no setterinherited
lineCount → int
Number of lines in the rendered output.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

block() → Alert
Sets the alert to block display.
border(Border border) → Alert
Sets the border style (for block/large display).
borderStyle(Style style) → Alert
Sets the border text style.
displayStyle(AlertDisplayStyle style) → Alert
Sets the display style.
error() → Alert
Sets the alert to error type.
info() → Alert
Sets the alert to info type.
init() → Cmd?
Returns an optional command to execute on program startup.
inherited
inline() → Alert
Sets the alert to inline display.
large() → Alert
Sets the alert to large display.
message(String text) → Alert
Sets the alert message.
messageStyle(Style style) → Alert
Sets the message style.
messageStyleFunc(AlertStyleFunc func) → Alert
Sets the message style function for per-line styling.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
note() → Alert
Sets the alert to note type.
padding(int value) → Alert
Sets the padding (for block/large display).
prefix(String prefix) → Alert
Sets a custom prefix (overrides type prefix).
prefixStyle(Style style) → Alert
Sets the prefix style (overrides type default).
render() → String
Renders the component as a styled string.
override
success() → Alert
Sets the alert to success type.
toString() → String
A string representation of this object.
inherited
type(AlertType type) → Alert
Sets the alert type.
update(Msg msg) → (ViewComponent, Cmd?)
Updates the component state in response to a message.
inherited
view() → String
Renders the current model state for display.
inherited
warning() → Alert
Sets the alert to warning type.
width(int value) → Alert
Sets the width (for block/large display).
writelnTo(Console io) → void

Available on DisplayComponent, provided by the DisplayComponentExtension extension

Renders the component and writes it to the console.

Operators

operator ==(Object other) → bool
The equality operator.
inherited