prepareDatabase method

Future<bool> prepareDatabase(
  1. String databaseID,
  2. DocumentReaderPrepareCompletion prepareCompletion,
  3. SuccessCompletion? successCompletion
)

Allows you to download a database from the Regula server. If it exists in your app and compatible with the SDK, it won't be downloaded.

databaseID An identifier of the database.

prepareCompletion A callback that returns downloading progress.

successCompletion The block to execute after the download finishes.

Note: for convinience function returns Future<bool>. This is the same bool that is returned by SuccessCompletion, indicating whether the function has succeeded or not. If you don't need to handle an error, you can leave successCompletion as null and only use the return value of the function.

Implementation

Future<bool> prepareDatabase(
  String databaseID,
  DocumentReaderPrepareCompletion prepareCompletion,
  SuccessCompletion? successCompletion,
) async {
  _setDocumentReaderPrepareCompletion(prepareCompletion);
  return _successCompletionFromJson(
    await _bridge.invokeMethod("prepareDatabase", [databaseID]),
    successCompletion,
  );
}