cropAndRotatePage static method

Future<Page> cropAndRotatePage(
  1. Page page,
  2. List<PolygonPoint> polygon,
  3. int rotationsCount
)

Rotates all images of the given page by 90 degrees value for rotationsCount times.

Implementation

static Future<Page> cropAndRotatePage(
    Page page, List<PolygonPoint> polygon, int rotationsCount) async {
  try {
    var arguments = {
      'page': page.toJson(),
      'rotationsCount': rotationsCount,
      'polygon': polygon.map((e) => e.toJson()).toList(),
    };
    var pageJson =
        await _channel.invokeMethod('cropAndRotatePage', arguments);
    var decoded = jsonDecode(pageJson);
    var rotatedPage = Page.fromJson(decoded);
    return rotatedPage;
  } catch (e) {
    Logger.root.severe(e);
    rethrow;
  }
}