Navigator.of(context).push( //Requires Navigator.of(context).push in order to loadMaterialPageRoute<void>( builder: (BuildContext context) =>Scaffold( appBar:AppBar(title:constText("SmileID Selfie Enrollment")), body:SmileIDSmartSelfieEnrollmentEnhanced( userId:"random-user-id/generated-user-id",// There are more parameters -- they correspond 1:1 with the native SDK parameters onSuccess: (String? result) {// Your success handling logicfinal snackBar =SnackBar(content:Text("Success: $result"));ScaffoldMessenger.of(context).showSnackBar(snackBar);Navigator.of(context).pop(); //Return flow to your app }, onError: (String errorMessage) {// Your error handling logicfinal snackBar =SnackBar(content:Text("Error: $errorMessage"));ScaffoldMessenger.of(context).showSnackBar(snackBar);Navigator.of(context).pop(); //Return flow to your app } ), ), ),);
If you are authenticating a previously registered user, you should use SmileIDSmartSelfieAuthenticationEnhanced Flutter widget
Navigator.of(context).push( //Requires Navigator.of(context).push in order to loadMaterialPageRoute<void>( builder: (BuildContext context) =>Scaffold( appBar:AppBar(title:constText("SmileID Selfie Authentication")), body:SmileIDSmartSelfieAuthenticationEnhanced( userId:"random-user-id/generated-user-id",// There are more parameters -- they correspond 1:1 with the native SDK parameters onSuccess: (String? result) {// Your success handling logicfinal snackBar =SnackBar(content:Text("Success: $result"));ScaffoldMessenger.of(context).showSnackBar(snackBar);Navigator.of(context).pop(); //Return flow to your app }, onError: (String errorMessage) {// Your error handling logicfinal snackBar =SnackBar(content:Text("Error: $errorMessage"));ScaffoldMessenger.of(context).showSnackBar(snackBar);Navigator.of(context).pop(); //Return flow to your app } ), ), ),);
Arguments
userId
The user ID to associate with the SmartSelfie™ Registration. Most often, this will correspond to a unique User ID within your own system. (If not provided at time of Registration, a random user ID will be generated. This field is required for Authentication)
jobId
The job ID to associate with the SmartSelfie™ Registration. Most often, this will correspond to a unique Job ID within your own system. If not provided, a random job ID will be generated.
allowAgentMode
Whether to allow Agent Mode or not. If allowed, a switch will be displayed allowing toggling between the back camera and front camera. If not allowed, only the front camera will be used.
showAttribution
Whether to show the Smile ID attribution or not on the Instructions screen
skipApiSubmission
Whether to capture images and not Submit to the SmileID api, this will return file paths which can be retrieved for later use.
extraPartnerParams
Custom values specific to partners passed as an immutable map
Callback to be invoked when the SmartSelfie™ Registration is complete. The result itself is a SmileIDResult which can either be a SmileIDResult.Success or SmileIDResult.Error
delegate (iOS)
This is the delegate object that is notifed when there is a result from the SmartSelfie™ flow. This class has to conform to SmartSelfieResultDelegate and implement the delegate methods
func didSucceed(selfieImage: Data, livenessImages: [Data], jobStatusResponse: JobStatusReponse) and func didError(error: Error)