Skip to main content

Initializing the SDK

Before using any of the modules, you must initalize the SDK. This method needs to be called only once.

final AmaniSDK _amaniSDK = AmaniSDK();

bool initSuccess = await AmaniSDK.initAmani(
server: "https://server.example",
customerToken: "customer_token",
customerIdCardNumber: "customer_id_card_number",
lang: "tr",
useLocation: true,
sharedSecret: "optional shared secret",
apiVersion: AmaniApiVersion.v2,
).catchError((err) {
// TODO: Handle the error.
})

if(initSuccess) {
// Call the any of the modules
IdCapture idCaptureModule = AmaniSDK.getIdCapture();
idCaptureModule.setType("XXX_ID_0");
} else {
throw Exception("Failed to initialize AmaniSDK");
}

Registering the event stream

For getting the errors from this SDK, and getting information about the profile of the KYC as well as getting the step results as the steps updated, listen to the event stream.

// in any async function
// delegateResult is Map<dynamic> consisting type and data fields
await for (final delegateResult in AmaniSDK().getDelegateStream()) {
// do something with delegateResult
}

Understanding the module system

Each type of document has different modules that you can set the document type and capture with it. Modules uses the same pattern of containing start, setType and upload methods. Each start method can have different parameters, with subtle differences.