initialize method

dynamic initialize({
  1. required String publicKey,
})

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 new PaystackException('publicKey cannot be null or empty');
    }
    return true;
  }());

  if (sdkInitialized) return;

  this._publicKey = publicKey;

  // Using cascade notation to build the platform specific info
  try {
    platformInfo = await PlatformInfo.fromMethodChannel(Utils.methodChannel);
    _sdkInitialized = true;
  } on PlatformException {
    rethrow;
  }
}