initialize method
Initialize the SPRINTCHECK object. It should be called as early as possible (preferably in initState() of the Widget.
publicKey
- your SPRINTCHECK public key. This is mandatory
use checkout and you want this plugin to initialize the transaction for you. Please check checkout for more information
Implementation
@override
initialize({required String publicKey, required String secretKey}) async {
assert(() {
if (publicKey.isEmpty) {
throw SprintCheckException('publicKey cannot be null or empty');
// } else if (!publicKey.startsWith("pk_")) {
// throw SprintCheckException(Utils.getKeyErrorMsg('public'));
} else if (secretKey.isEmpty) {
throw SprintCheckException('secretKey cannot be null or empty');
// } else if (!secretKey.startsWith("sk_")) {
// throw SprintCheckException(Utils.getKeyErrorMsg('secret'));
} else {
return true;
}
}());
if (controller.sdkInitialized) return;
publicKey = publicKey;
// Using cascade notation to build the platform specific info
try {
// platformInfo = (await PlatformInfo.getinfo())!;
controller.publicKey = publicKey;
controller.secretKey = secretKey;
controller.sdkInitialized = true;
} on PlatformException {
rethrow;
}
}