addLocalAsset method Null safety
- String url
Adds a local asset to the repository. Local means that the asset
only exists as a local entity. Format variants will not be generated.
For now, there's no format detection so mimetypes will not be created.
With this call, ownership is transferred to the repository. This in
turn means that local assets will be deleted from the file system
when delete() is called.
path must be a local URI that can be passed to File()
Local assets DO NOT PERSIST, their content is lost after app restart.
They are only meant for transient use and should be converted to remote
assets as soon as possible.
Implementation
MediaAsset addLocalAsset(String url) {
const uuid = Uuid();
return MediaAsset((builder) => builder
..id = uuid.v4()
..location = MediaAssetLocation.local
..url = url);
}