initialize method
Initialize the Paystack object. It should be called as early as possible (preferably in initState() of the Widget.
publicKey
- your paystack 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
initialize({required String publicKey}) async {
assert(() {
if (publicKey.isEmpty) {
throw PaystackException('publicKey cannot be null or empty');
}
return true;
}());
if (sdkInitialized) return;
publicKey = publicKey;
// Using cascade notation to build the platform specific info
try {
platformInfo = (await PlatformInfo.getinfo())!;
_publicKey = publicKey;
_sdkInitialized = true;
} on PlatformException {
rethrow;
}
}