saveImageToGallery static method

Future<KatAssetEntity?> saveImageToGallery(
  1. Uint8List value,
  2. String fileName
)

hàm này dùng để lưu value vào thư viện ảnh (gallery) của thiết bị với tên file là fileName. Trả về null nếu người dùng không cấp quyền truy cập thư viện ảnh.

Implementation

static Future<KatAssetEntity?> saveImageToGallery(
  Uint8List value,
  String fileName,
) async {
  final permission = await KatPhotoManager.requestPermissionExtend();
  if (!permission.hasAccess) return null;

  return KatPhotoManager.editor.saveImage(
    value,
    filename: fileName,
    title: fileName,
  );
}