AssetManager class

Manages the assets for a web request, including JavaScript, CSS, and data.

The AssetManager class is responsible for handling various assets (like JS and CSS files) and the data to be included in a web response. It provides methods for adding assets, managing cache settings, and generating the necessary HTML for including assets in the frontend.

Constructors

AssetManager(WebRequest rq)
Creates an instance of AssetManager and adds a default JS include.

Properties

css List<Asset>
Returns the list of CSS assets.
no setter
data Map<String, Object?>
The map of additional data to be passed to the frontend.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
includes List<Asset>
The list of assets (JS, CSS) to be included in the request.
getter/setter pair
js List<Asset>
Returns the list of JS assets.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addAsset(Asset asset) AssetManager
Adds a single asset to the manager.
addAssets(List<Asset> assets) AssetManager
Adds multiple assets to the manager.
addData(Map<String, Object?> params) AssetManager
Adds additional data to be passed to the frontend.
addNotify({required String text, String type = 'success'}) AssetManager
Adds a notification message to the data map.
getByType(AssetType type) List<Asset>
Filters assets by their type (JS or CSS).
getCssUI() String
Generates the HTML for including CSS assets in the frontend.
getDataJs() String
Generates a script tag with data as a JSON object.
getJsUI() String
Generates the HTML for including JS assets in the frontend.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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