Flutter SDK Migration Guide
InfoWe strongly recommend using the latest version of IDWise SDK. This ensures you always have access to the latest improvements, bug fixes, and security updates.
Migrating from v5.5.x to v5.6.x
We have update our Android SDK to target android-15 with Edge-to-Edge UI handling. If you are already targeting to android-15 then there is no need change. If not, then you need to update the following:
- Update the AGP version to minimum v8.4.0 if you are on an older version
- Update the kotlin version to minimum v1.9.21 if you are on an older version
- You may also need to look at the other changes comes with upgrading to these versions. Here's the guide to do so.
- Add the following lines at the top of your Podfile
These lines add the public CocoaPods source and the IDWise private repository as sources for package Installation.
source 'https://cdn.cocoapods.org/' source 'https://github.com/idwise/ios-sdk'
Migrating from v5.4.x to v5.5.x
We are now serving our SDK from our Secure Repository, so in order to add our SDK, please add the following repository URL android/build.gradle.
maven { url 'https://mobile-sdk.idwise.ai/releases/' }Upgrade AGP to minimum 7.1.2, if you are using and older one.
Migrating from v4.x.x to v5.x.x
Required Imports
- The import statement is changed in the latest version.
The following code:
import 'package:idwise_flutter_sdk/idwise_flutter.dart';Should be changed to be like this:
import ‘package:idwise_flutter_sdk/idwise.dart’;Simple SDK Code Changes
If you are using Simple Flutter SDK integration please follow the following sections to change your code to be compatible with the new version:
IDWise.initialize method:
IDWise.initialize method:- The
themeparameter has its type changed fromIDWiseSDKThemetoIDWiseTheme
The following code:
String clientKey = "<clientKey>" //provided by IDWise
String theme = IDWiseSDKTheme.LIGHT // Available options [DARK, LIGHT, SYSTEM_DEFAULT]
IDWise.initialize(clientKey,theme, onError:(error){
print("Error in initializeSDK");
print(error);
});Should be changed to be like this:
val clientKey = "<YOUR_CLIENT_KEY>"
val theme = IDWiseTheme.SYSTEM_DEFAULT //[LIGHT, DARK, SYSTEM_DEFAULT]
IDWise.initialize(clientKey,theme, onError:(error){
print("Error in initializeSDK");
print(error);
});IDWise.startJourney method:
IDWise.startJourney method:- This method now takes a new optional parameter named
applicantDetailswhich is aString:Stringdictionary. You can pass this parameter asnilif you do not intend to use it. For further information, please check documentation. - The parameter
journeyDefinitionIdis now renamed toflowId - The parameter
journeyDelegateis now renamed tojourneyCallbacks
The following code:
String journeyDefinitionId = "FLOW ID"; //As known as journey definition ID, Provided by IDWise
String referenceNo = "Unique reference number"; //[Optional] User's unique id e.g user_id
String locale = "en"; //Language code e.g en, ar
try {
IDWise.startJourney(journeyDefinitionId,referenceNo,locale, journeyCallbacks);
} on PlatformException catch (e) {
print("Error : '${e.message}'.");
}Should be changed to become:
String flowId = "<FLOW_ID>"
String referenceNo = "Unique reference number"; //[Optional] User's unique id e.g user_id
String locale = "en"; //Language code e.g en, ar
Map<String, String> applicantDetails = HashMap();
applicantDetails["full_name"] = "Waqar Khan";
applicantDetails["sex"] = "Male";
try {
IDWise.startJourney(flowId, referenceNo, locale,applicantDetails, journeyCallbacks);
} on PlatformException catch (e) {
print("Error : '${e.message}'.");
}IDWise.resumeJourney method:
IDWise.resumeJourney method:- The parameter
journeyDefinitionIdparameter is now renamed toflowId - The parameter
journeyDelegateis now renamed tojourneyCallbacks
The following code:
String journeyDefinitionId = "FLOW ID"; //As known as journey definition ID, Provided by IDWise
String journeyId = "journey id"; //they journey id that you want to resume
String locale = "en"; //Language code e.g en, ar
IDWise.resumeJourney(journeyDefinitionId,journeyId,locale,journeyCallbacks);
Should be changed to become:
val flowId = "<FLOW_ID>"
val locale = "en"
val journeyId = "<YOUR_JOURNEY_ID>"
IDWise.resumeJourney(
context,flowId,journeyId,locale,journeyCallbacks
)IDWiseSDK Journey Callbacks
JourneyStarted Callback Method
JourneyStarted Callback Method- This delegate method previously took one parameter
journeyID: Stringbut now the parameter changed to becomejourneyStartedInfo: IDWiseSDK.JourneyStartedInfo. The new typeJourneyStartedInfocontains Journey Id as a sub field.
onJourneyResumed Callback Method
onJourneyResumed Callback Method- This delegate method previously took one parameter
journeyIDbut now the parameter changed to becomejourneyResumedInfo: JourneyResumedInfo. The new typeJourneyResumedInfocontains Journey Id as a sub field.
JourneyFinished Callback Method
JourneyFinished Callback Method- This delegate method is now named
onJourneyCompleted - This delegate method previously took one parameter
journeyID: Stringbut now the parameter changed to becomejourneyCompletedInfo: JourneyCompletedInfo. The new typeJourneyCompletedInfocontains Journey Id as a sub field.
JourneyCancelled Callback Method
JourneyCancelled Callback Method- This delegate method previously took one parameter
journeyID: Stringbut now the parameter changed to becomejourneyCancelledInfo: JourneyCancelledInfo. The new typeJourneyCancelledInfocontains Journey Id as a sub field.
onError Callback Method
onError Callback Method- This delegate method previously took one parameter of type
IDWiseSDKError. But the type of this parameter was changed to becomeIDWiseError
Code Implementation of Journey Callbacks
The following code:
//callbacks events for journey
const journeyCallback = {
onJourneyStarted(data) {
console.log('Event onJourneyStarted received:', data);
},
onJourneyResumed(data) {
console.log('Event onJourneyResumed received:', data);
},
onJourneyFinished(data) {
console.log('Event onJourneyFinished received:', data);
},
onJourneyCancelled(data) {
console.log('Event onJourneyCancelled received:', data);
},
onError(error) {
console.log('Event onError received:', error);
}
};
Should be changed to be like this:
IDWiseJourneyCallbacks _journeyCallbacks = IDWiseJourneyCallbacks(
onJourneyStarted: (dynamic journeyStartedInfo) {
print("Method: onJourneyStarted, $journeyStartedInfo");
},
onJourneyCompleted: (dynamic journeyCompletedInfo) =>
print("onJourneyCompleted: $journeyCompletedInfo"),
onJourneyCancelled: (dynamic journeyCancelledInfo) =>
print("onJourneyCancelled: $journeyCancelledInfo"),
onJourneyResumed: (dynamic journeyResumedInfo) {
print("Method: onJourneyResumed, ${journeyResumedInfo["journeyId"]}");
},
onError: (dynamic error) => print("onError $error"));
Dynamic SDK Migration
If you are using Dynamic Flutter SDK integration please follow the following sections to change your code to be compatible with the new version.
You should use IDWiseDynamic object to call methods in dynamic mode.
IDWise.initialize method:
IDWise.initialize method:- The
themeparameter has its type changed fromIDWiseSDKThemetoIDWiseTheme IDWiseDynamicshould be used instead ofIDWiseto call this method.
The following code:
String clientKey = "<YOUR_CLIENT_KEY>"
IDWiseTheme theme = IDWiseSDKTheme.LIGHT //[DARK, LIGHT, SYSTEM_DEFAULT]
IDWise.initialize(clientKey,theme, onError:(error){
print("Error in initializeSDK");
print(error);
});Should be changed to be like this:
String clientKey = "<YOUR_CLIENT_KEY>"
IDWiseTheme theme = IDWiseTheme.LIGHT //[DARK, LIGHT, SYSTEM_DEFAULT]
IDWiseDynamic.initialize(clientKey,theme, onError:(error){
print("Error in initializeSDK");
print(error);
});IDWise.startDynamicJourney method:
IDWise.startDynamicJourney method:IDWiseDynamicshould be used instead ofIDWiseto call this method.- This method is renamed from
startDynamicJourneytostartJourney. - This method now takes a new optional parameter named
applicantDetailswhich is aString:Stringdictionary. You can pass this parameter asnilif you do not intend to use it. For further information, please check documentation. - The parameter
journeyDefinitionIdis now renamed toflowId - The parameter
journeyDelegateis now renamed tojourneyCallbacks
The following code:
IDWise.startDynamicJourney(journeyDefinitionId: "FLOW_ID", referenceNumber: "REFERENCE_NUMBER",locale: "LOCALE", journeyDelegate: self)Should be changed to become:
Map<String, String> applicantDetails = HashMap();
applicantDetails["full_name"] = "Waqar Khan";
applicantDetails["sex"] = "Male";
IDWiseDynamic.startJourney(flowId:"FLOW_ID",
referenceNumber: "REFERENCE_NUMBER",
locale: "LOCALE", applicantDetails: applicantDetails,
journeyCallbacks: self)IDWise.resumeDynamicJourney method:
IDWise.resumeDynamicJourney method:IDWiseDynamicshould be used instead ofIDWiseto call this method.- This method is renamed from
resumeDynamicJourneytoresumeJourney. - The parameter
journeyDefinitionIdparameter is now renamed toflowId - The parameter
journeyDelegateis now renamed tojourneyCallbacks
The following code:
let journeyDefinitionId = "<JOURNEY_DEFINITION_ID>" // aka flowId
let journeyId = "<YOUR_JOURNEY_ID>"
let locale = "en"
IDWise.resumeDynamicJourney(
journeyDefinitionId,journeyId,locale, _journeyCallbacks,_stepCallbacks
);Should be changed to become:
String flowId = "<FLOW_ID>"
String journeyId = "YOUR_JOURNEY_ID"
String locale = "en";
IDWiseDynamic.resumeJourney(
flowId,journeyId, locale,journeyCallbacks,stepCallbacks
)IDWise.finishDynamicJourney method:
IDWise.finishDynamicJourney method:IDWiseDynamicshould be used instead ofIDWiseto call this method.- This method is renamed from
finishDynamicJourneytofinishJourney.
The following code:
IDWise.finishDynamicJourney()Should be changed to become:
IDWiseDynamic.finishJourney()IDWise.startStep method:
IDWise.startStep method:IDWiseDynamicshould be used instead ofIDWiseto call this method.
The following code:
IDWise.startStep("STEP_ID")Should be changed to become:
IDWiseDynamic.startStep("STEP_ID")IDWise.skipStep method:
IDWise.skipStep method:IDWiseDynamicshould be used instead ofIDWiseto call this method.
The following code:
IDWise.skipStep("STEP_ID")Should be changed to become:
IDWiseDynamic.skipStep("STEP_ID")IDWise.unloadSDK method:
IDWise.unloadSDK method:IDWiseDynamicshould be used instead ofIDWiseto call this method.
The following code:
IDWise.unloadSDK()Should be changed to become:
IDWiseDynamic.unloadSDK()IDWise.getJourneySummary method:
IDWise.getJourneySummary method:IDWiseDynamicshould be used instead ofIDWiseto call this method.
The following code:
IDWise.getJourneySummary(onJourneySummary: (dynamic summary) {
print("onJourneySummary: $summary")
});Should be changed to become:
IDWiseDynamic.getJourneySummary(onJourneySummary: (dynamic summary) {
print("onJourneySummary: $summary")
});IDWiseSDK Journey Callbacks
JourneyStarted Callback Method
JourneyStarted Callback Method- This delegate method previously took one parameter
journeyID: Stringbut now the parameter changed to becomejourneyStartedInfo: IDWiseSDK.JourneyStartedInfo. The new typeJourneyStartedInfocontains Journey Id as a sub field.
onJourneyResumed Callback Method
onJourneyResumed Callback Method- This delegate method previously took one parameter
journeyIDbut now the parameter changed to becomejourneyResumedInfo: JourneyResumedInfo. The new typeJourneyResumedInfocontains Journey Id as a sub field.
JourneyFinished Callback Method
JourneyFinished Callback Method- This delegate method is now named
onJourneyCompleted - This delegate method previously took one parameter
journeyID: Stringbut now the parameter changed to becomejourneyCompletedInfo: JourneyCompletedInfo. The new typeJourneyCompletedInfocontains Journey Id as a sub field.
JourneyCancelled Callback Method
JourneyCancelled Callback Method- This delegate method previously took one parameter
journeyID: Stringbut now the parameter changed to becomejourneyCancelledInfo: JourneyCancelledInfo. The new typeJourneyCancelledInfocontains Journey Id as a sub field.
onError Callback Method
onError Callback Method- This delegate method previously took one parameter of type
IDWiseSDKError. But the type of this parameter was changed to becomeIDWiseError
Code Implementation of Journey Callbacks
The following code:
//callbacks events for journey
const journeyCallback = {
onJourneyStarted(data) {
console.log('Event onJourneyStarted received:', data);
},
onJourneyResumed(data) {
console.log('Event onJourneyResumed received:', data);
},
onJourneyFinished(data) {
console.log('Event onJourneyFinished received:', data);
},
onJourneyCancelled(data) {
console.log('Event onJourneyCancelled received:', data);
},
onError(error) {
console.log('Event onError received:', error);
}
};
Should be changed to be like this:
IDWiseJourneyCallbacks _journeyCallbacks = IDWiseJourneyCallbacks(
onJourneyStarted: (dynamic journeyStartedInfo) {
print("Method: onJourneyStarted, $journeyStartedInfo");
},
onJourneyCompleted: (dynamic journeyCompletedInfo) =>
print("onJourneyCompleted: $journeyCompletedInfo"),
onJourneyCancelled: (dynamic journeyCancelledInfo) =>
print("onJourneyCancelled: $journeyCancelledInfo"),
onJourneyResumed: (dynamic journeyResumedInfo) {
print("Method: onJourneyResumed, ${journeyResumedInfo["journeyId"]}");
},
onError: (dynamic error) => print("onError $error"));
IDWiseSDK Step Callbacks
onStepCaptured Callback Method
onStepCaptured Callback Method- This delegate method previously took two parameters
stepId: IntandcapturedImage: UIImage?but now the parameter changed to becomestepCapturedInfo: StepCapturedInfo. The new typeStepCapturedInfocontainsstepId: String,originalImage: UIImage?andcroppedImage: UIImage?as a subfields.
onStepResult Callback Method
onStepResult Callback Method- This delegate method previously took two parameters
stepId: IntandstepResult: StepResult?but now the parameter changed to becomestepResultInfo: IDWiseSDK.StepResultInfo. The new typeStepResultInfocontainsstepId: StringandstepResult: StepResult?as subfields.
onStepCancelled Callback Method
onStepCancelled Callback Method- This delegate method previously took one parameter
stepId: Stringbut now the parameter changed to becomestepCancelledInfo: StepCancelledInfo. The new typeStepCancelledInfocontainsstepId: Stringas a sub field.
onStepSkipped Callback Method
onStepSkipped Callback Method- This delegate method previously took one parameter
stepId: Stringbut now the parameter changed to becomestepSkippedInfo: StepSkippedInfo. The new typeStepSkippedInfocontainsstepId: Stringas a sub field.
Code Implementation of Step Callbacks
//Declare global variables to be passed to initialize later
late IDWiseSDKStepCallbacks _stepCallbacks;
_stepCallbacks = IDWiseSDKStepCallbacks(onStepCaptured: (dynamic response) {
print("Method: onStepCaptured, ${response["stepId"]}");
print("Method: capturedImage, ${response["capturedImage"]}");//base64 string
}, onStepResult: (dynamic response) {
print("Method: onStepResult, $response");
}, onStepCancelled: (dynamic response) {
print("Method: onStepCancelled, $response");
}, onStepSkipped: (dynamic response) {
print("Method: onStepSkipped, $response");
}
);should be changed to
//Declare global variables to be passed to initialize later
late IDWiseSDKStepCallbacks _stepCallbacks;
_stepCallbacks = IDWiseStepCallbacks(onStepCaptured: (dynamic response) {
print("Method: onStepCaptured, ${response["stepId"]}");
print("Method: capturedImage, ${response["originalImage"]}");//base64 string
print("Method: capturedImage, ${response["croppedImage"]}");//base64 string
}, onStepResult: (dynamic response) {
print("Method: onStepResult, $response");
}, onStepCancelled: (dynamic response) {
print("Method: onStepCancelled, $response");
}, onStepSkipped: (dynamic response) {
print("Method: onStepSkipped, $response");
}
);
Updated about 2 months ago
