pickAvatarImageForPlatform function

Future<PhotoSelection?> pickAvatarImageForPlatform(
  1. BuildContext context
)

Normalizes iOS camera images before avatar upload.

iOS cameras can return HEIC or Display P3 images. Converting them to an sRGB JPEG avoids green-tinted avatars on platforms that do not preserve the original color profile.

Implementation

Future<PhotoSelection?> pickAvatarImageForPlatform(
  BuildContext context,
) async {
  if (ChatKitUtils.isDesktopOrWeb) {
    final path = await _pickImageWithFilePicker();
    return path == null ? null : PhotoSelection(path: path, isCamera: false);
  }
  return showPhotoSelectorWithSource(context);
}