send<T extends DigifiedResult> method

Future<bool> send<T extends DigifiedResult>({
  1. required dynamic onResult(
    1. T extractionResult
    ),
  2. required dynamic onFailure(
    1. DigifiedError
    ),
  3. required dynamic onUploadProgress(
    1. int,
    2. int
    ),
  4. required dynamic onUploadingDone(
    1. int
    ),
})

Sending the captured image and get a result of T that is specified in the Function

  • T The result extending DigifiedResult, this is what you expect to get in onResult
  • onResult (required) This function is called when the API request was successful and we have the response of T
  • onFailure (required) This function is called when there is a problem with the API call, and you will get DigifiedError
  • onUploadProgress (required) This method is called when we the SDK sending and processing the API request, and you can get a DigifiedCaptureType as the first parameter and the second parameter is the progress as int
  • onUploadingDone (required) This method is called when the uploading process of the image is done, so now the processing of the image has started and you will get the DigifiedCaptureType as a parameter

Implementation

Future<bool> send<T extends DigifiedResult>(
    {required Function(T extractionResult) onResult,
    required Function(DigifiedError) onFailure,
    required Function(int, int) onUploadProgress,
    required Function(int) onUploadingDone}) {
  if (!_isInitializeCalled) {
    debugPrint("Digifed: call initialize first!");
    return Future.value(false);
  }
  return SendMethod<T>().invoke(
      onResult: onResult,
      onFailure: onFailure,
      onUploadProgress: onUploadProgress,
      onUploadingDone: onUploadingDone);
}