Assets
- Introduction
- Files
- Managing assets
Introduction
In this section, we'll look into how you can manage assets throughout your widgets.
Nylo provides a few helper methods which make it easy to fetch images, files and more from your public/assets
directory.
Displaying images
You can return images by calling the below helper method.
getImageAsset('nylo_logo.png');
In your widget, it would look something like the below.
Image.asset(
getImageAsset("nylo_logo.png"),
height: 100,
width: 100,
)
Returning files
You can call the below helper method to get the full file path for an asset.
getPublicAsset('/images/nylo_logo.png');
This could also be any file within the public/assets
directory too
getPublicAsset('/video/welcome.mp4');
Adding new files
To add new files, open the public/assets
directory and include your files in a new folder or an existing one.