addAsset method
Adds an asset with bytes (status ready); returns its id.
Implementation
String addAsset(
Uint8List bytes, {
String name = 'asset.bin',
String type = 'video',
String? id,
double? duration,
List<String> tags = const [],
}) {
final aid = id ?? uuidV7();
_assetBytes[aid] = bytes;
_assets[aid] = {
'id': aid,
'name': name,
'type': type,
'status': 'ready',
'sha256': sha256.convert(bytes).toString(),
'size': bytes.length,
'tags': tags,
if (duration != null) 'media': {'duration': duration},
'revision': 1,
'createdAt': _now(),
'updatedAt': _now(),
};
return aid;
}