init method

Future<CSDocumentosCopySDKResponse> init({
  1. required CSDocsSDK configuration,
})

Implementation

Future<CSDocumentosCopySDKResponse> init(
    {required CSDocsSDK configuration}) async {
  try {
    final String nativeSDKResponseAsString = await methodChannel.invokeMethod(
        MethodChannels.init.methodName, configuration.toJson());

    final nativeSDKResponseAsJson = jsonDecode(nativeSDKResponseAsString);
    final CSDocumentosCopySDKResponse sdkResponse =
        CSDocumentosCopySDKResponse.fromJson(nativeSDKResponseAsJson);
    return sdkResponse;
  } on PlatformException catch (e) {
    throw CSDocsInternalErrorException(
        message: e.message,
        errorDescription:
            "Platform exception when calling init method: ${e.message}");
  } catch (e) {
    throw CSDocsInternalErrorException(
        message: e.toString(),
        errorDescription:
            "Internal error when calling init method: ${e.toString()}");
  }
}