initialize method

Future<bool> initialize({
  1. required String baseUrl,
  2. required String apiKey,
  3. bool? enableManualCapturingFallback,
  4. int? captureTimeout,
  5. int? maxCapturingWidth,
  6. int? maxCapturingHeight,
  7. String? warningAction,
  8. String? userName,
  9. String? phoneNumber,
  10. String? email,
  11. required void onSuccess(
    1. InitializationResult
    ),
  12. required void onFailed(
    1. DigifiedError
    ),
})

Initializing the SDK and setting some config params

  • baseUrl (required) https url of the backend hosting Digified API
  • apiKey (required) API Key of the Digified API
  • enableManualCapturingFallback (optional) Enables fallback to manual capturing after a default or a custom timeout
  • captureTimeout (optional) Setting the capture timeout
  • maxCapturingWidth (optional) maximum width of the output image
  • maxCapturingHeight (optional) maximum height of the output image
  • warningAction (optional) setting the warning action for the api (optional - set to null if you will not use it)
  • userName (optional) name of the user (optional - set to if you will not use it)
  • phoneNumber (optional) user's phone number (optional - set to null if you will not use it)
  • email (optional) user's email (optional - set to null if you will not use it)
  • onSuccess (required) Function that is called if the initialization succeeds, you can get InitializationResult from it
  • onFailed (required) Function that is called if the initialization fails, you can get DigifiedError from it

Implementation

Future<bool> initialize(
    {required String baseUrl,
    required String apiKey,
    bool? enableManualCapturingFallback,
    int? captureTimeout,
    int? maxCapturingWidth,
    int? maxCapturingHeight,
    String? warningAction,
    String? userName,
    String? phoneNumber,
    String? email,
    required void Function(InitializationResult) onSuccess,
    required void Function(DigifiedError) onFailed}) async {
  _isInitializeCalled = true;
  return InitializeMethod().invoke(
      baseUrl: baseUrl,
      apiKey: apiKey,
      enableManualCapturingFallback: enableManualCapturingFallback,
      captureTimeout: captureTimeout,
      maxCapturingWidth: maxCapturingWidth,
      maxCapturingHeight: maxCapturingHeight,
      warningAction: warningAction,
      userName: userName,
      phoneNumber: phoneNumber,
      email: email,
      onSuccess: onSuccess,
      onFailed: onFailed);
}