detectDocument static method

Future<Page> detectDocument(
  1. Page page
)

Performs auto document detection on the ORIGINAL image of the given page and creates a (cropped) DOCUMENT image. The given page must contain the ORIGINAL image. Returns Page with the detected polygon.

Implementation

static Future<Page> detectDocument(Page page) async {
  try {
    var arguments = {'page': page.toJson()};
    var documentScanningResult =
        await _channel.invokeMethod('detectDocument', arguments);
    var json = jsonDecode(documentScanningResult);
    var pageResult = Page.fromJson(json);
    return pageResult;
  } catch (e) {
    return page;
  }
}