orientation method

void orientation(
  1. Orientation orient
)

The orient parameter lets you control the cardinal orientation of the given image. Using this parameter, you can orient the image right or left, flip horizontally or vertically or both, and do a lot more. It can automatically correct the orientation of the image if the source image contains orientation details within its EXIF data (Exchangeable Image File Format).

orient parameter should be enum type of Orientation

For more details, Read documentation: https://www.contentstack.com/docs/developers/apis/image-delivery-api/#reorient-images

Example:

final stack = contentstack.Stack(apiKey, deliveryToken, environment);
final imageTransformation = stack.imageTransform(imageUrl);
final response = await imageTransformation
                 .orientation(Orientation.vertically).fetch();

Implementation

void orientation(Orientation orient) {
  //  toDefault = '1';
  //  horizontally = '2';
  //  horizontallyAndVertically = '3';
  //  vertically = '4';
  //  horizontallyAndRotate90DegreeLeft = '5';
  //  degrees90TowardsRight = '6';
  //  horizontallyAndRotate90DegreesRight = '7';
  //  rotate90DegreesLeft = '8';
  if (orient != null) {
    orient.when(toDefault: (orientation) {
      query.append('orient', 1);
    }, horizontally: (orientation) {
      query.append('orient', 2);
    }, horizontallyAndVertically: (orientation) {
      query.append('orient', 3);
    }, vertically: (orientation) {
      query.append('orient', 4);
    }, horizontallyAndRotate90DegreeLeft: (orientation) {
      query.append('orient', 5);
    }, degrees90TowardsRight: (orientation) {
      query.append('orient', 6);
    }, horizontallyAndRotate90DegreesRight: (orientation) {
      query.append('orient', 7);
    }, rotate90DegreesLeft: (orientation) {
      query.append('orient', 8);
    });
  }
}