AssetService class
Asset service for managing static assets and files.
Constructors
- AssetService(UrlService _urlService, StorageManager _storageManager)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
asset(
String path, {Map< String, dynamic> ? query}) → String - Get URL for an asset (alias).
-
copyFile(
String from, String to, {String disk = 'public'}) → Future< void> - Copy a file.
-
css(
String path, {Map< String, dynamic> ? query}) → String - Get URL for a CSS file.
-
deleteFile(
String path, {String disk = 'public'}) → Future< void> - Delete a stored file.
-
fileExists(
String path, {String disk = 'public'}) → Future< bool> - Check if a file exists.
-
fileSize(
String path, {String disk = 'public'}) → Future< int> - Get file size.
-
generateUniqueFilename(
String originalFilename) → String - Generate a unique filename.
-
getFileExtension(
String filename) → String - Get file extension.
-
getFileNameWithoutExtension(
String filename) → String - Get file name without extension.
-
image(
String path, {Map< String, dynamic> ? query}) → String - Get URL for an image.
-
isValidFileType(
String filename, List< String> allowedExtensions) → bool - Validate file type.
-
js(
String path, {Map< String, dynamic> ? query}) → String - Get URL for a JavaScript file.
-
listFiles(
String directory, {String disk = 'public'}) → Future< List< String> > - List files in a directory.
-
mimeType(
String path, {String disk = 'public'}) → Future< String?> - Get file MIME type.
-
moveFile(
String from, String to, {String disk = 'public'}) → Future< void> - Move a file.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
storage(
String path, {Map< String, dynamic> ? query}) → String - Get URL for a file in storage.
-
storeFile(
String path, List< int> bytes, {String disk = 'public', String? filename}) → Future<String> - Store a file and return its URL.
-
storeTextFile(
String path, String content, {String disk = 'public', String? filename}) → Future< String> - Store a text file and return its URL.
-
toString(
) → String -
A string representation of this object.
inherited
-
url(
String path, {Map< String, dynamic> ? query}) → String - Get URL for an asset.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited