init static method
Initialize the native SDK with project token Optionally pass the client SDK platform and version so native Android can be configured before init
Implementation
static Future<void> init(
String token,
String? secretKey,
String? keyId,
bool debug, [
String platform = 'FLUTTER',
String? packageVersion,
]) async {
try {
final Map<String, dynamic> arguments = {
'token': token,
'debug': debug,
};
// Only include secretKey and keyId if they are provided
if (secretKey != null) {
arguments['secretKey'] = secretKey;
}
if (keyId != null) {
arguments['keyId'] = keyId;
}
// Provide SDK platform and version so Android can call configureSDK before init
arguments['platform'] = platform;
if (packageVersion != null) {
arguments['packageVersion'] = packageVersion;
}
var res = await _channel.invokeMethod('init', arguments);
developer.log(res.toString(), name: packageName);
developer.log('Linkrunner initialized successfully 🔥', name: packageName);
} on PlatformException catch (e) {
developer.log('Failed to initialize native SDK: ${e.message}',
error: e, name: packageName);
rethrow;
}
}