fromAssetEntity static method

Future<AssetModel> fromAssetEntity(
  1. AssetEntity entity
)

Create asset model from asset entity

Implementation

static Future<AssetModel> fromAssetEntity(AssetEntity entity) async {
  final File? file = await entity.file;
  if (file == null) {
    throw Exception('File not found');
  }
  final XFile xFile = XFile(file.path);
  return AssetModel(
    id: entity.id,
    file: xFile,
    type: entity.type,
  );
}