startCroppingScreen static method

Future<ResultWrapper<DocumentData>> startCroppingScreen(
  1. CroppingConfiguration config
)

Launches the Ready-to-Use V2 Cropping Screen as a full-screen modal dialog.

This method allows users to crop and adjust documents detected in a scanning session.

config: A CroppingConfiguration object defining the cropping screen's appearance and behavior.

Returns: A Future that resolves to a ResultWrapper<DocumentData> containing the cropped document data or an error if the operation fails.

Implementation

static Future<ResultWrapper<DocumentData>> startCroppingScreen(
    CroppingConfiguration config) async {
  try {
    var result = await SharedCalls.invoke(
        ScanbotSdk.channel, 'startCroppingScreenV2', config.toJson());
    return ResultWrapper.fromJson(jsonDecode(result),
        fromJsonT: DocumentData.fromJson);
  } catch (e) {
    Logger.root.severe(e);
    return ResultWrapper.error(e.toString());
  }
}