2025-06-16 20:37:45 +05:30
|
|
|
import 'dart:typed_data';
|
|
|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
|
|
import 'package:photo_manager/photo_manager.dart';
|
|
|
|
|
|
2025-06-23 11:27:44 -05:00
|
|
|
class AssetMediaRepository {
|
2025-06-16 20:37:45 +05:30
|
|
|
const AssetMediaRepository();
|
|
|
|
|
|
2025-07-29 00:34:03 +05:30
|
|
|
Future<Uint8List?> getThumbnail(String id, {int quality = 80, Size size = const Size.square(256)}) => AssetEntity(
|
|
|
|
|
id: id,
|
|
|
|
|
// The below fields are not used in thumbnailDataWithSize but are required
|
|
|
|
|
// to create an AssetEntity instance. It is faster to create a dummy AssetEntity
|
|
|
|
|
// instance than to fetch the asset from the device first.
|
|
|
|
|
typeInt: AssetType.image.index,
|
|
|
|
|
width: size.width.toInt(),
|
|
|
|
|
height: size.height.toInt(),
|
|
|
|
|
).thumbnailDataWithSize(ThumbnailSize(size.width.toInt(), size.height.toInt()), quality: quality);
|
2025-06-16 20:37:45 +05:30
|
|
|
}
|