Calling startFaceLiveness
Copy void startSDK () {
final stream = _faceLiveness. start ();
_setupFaceLivenessListener (stream);
}
void _setupFaceLivenessListener ( Stream < FaceLivenessEvent > stream) {
stream. listen ((event) {
if (event is FaceLivenessEventConnecting ) {
print ( 'Connecting to FaceLiveness...' );
} else if (event is FaceLivenessEventConnected ) {
print ( 'Connected to FaceLiveness.' );
} else if (event is FaceLivenessEventClosed ) {
print ( 'SDK closed by the user.' );
} else if (event is FaceLivenessEventSuccess ) {
print ( 'Success! SignedResponse: ${event.signedResponse} ' );
} else if (event is FaceLivenessEventFailure ) {
print (
'Failure! Error type: ${event.errorType} , '
'Error description: ${event.errorDescription} ' ,
);
}
});
}