capture method

Future<bool> capture({
  1. required int captureType,
  2. int? desiredWidth,
  3. int? desiredHeight,
  4. required dynamic onCaptured(
    1. CaptureResult
    ),
  5. required dynamic onFailed(
    1. DigifiedError,
    2. int
    ),
  6. required dynamic onCancelled(
    1. int
    ),
  7. required dynamic onTimeout(),
})

This method is used to capture images (ID front image, ID back image and Selfie)

  • captureType (required) Specifies what you are capturing (ID Front, ID Back or Selfie) find the types here DigifiedCaptureType
  • desiredWidth (optional) desired image width (not guaranteed in order not to stretch the image, however SDK will not exceed that width)
  • desiredHeight (optional) desired image width (not guaranteed in order not to stretch the image, however SDK will not exceed that width)
  • onCaptured (required) This method is called when we have a successful CaptureResult
  • onFailed (required) This method is called when there is a problem with the capture request, DigifiedError and a DigifiedCaptureType can be obtained
  • onCancelled (required) This method is called when the user pauses the app during capturing request, DigifiedCaptureType can be obtained
  • onTimeout (required) This method is called if the time out of the capture process has passed

Implementation

Future<bool> capture(
    {required int captureType,
    int? desiredWidth,
    int? desiredHeight,
    required Function(CaptureResult) onCaptured,
    required Function(DigifiedError, int) onFailed,
    required Function(int) onCancelled,
    required Function() onTimeout}) {
  if (!_isInitializeCalled) {
    debugPrint("Digifed: call initialize first!");
    return Future.value(false);
  }
  return CaptureMethod().invoke(
      captureType: captureType,
      onCaptured: onCaptured,
      onFailed: onFailed,
      onCancelled: onCancelled,
      onTimeout: onTimeout);
}