activateLicense method
Implementation
@override
Future<bool?> activateLicense({String? android, String? ios}) async {
// Determine the platform and select the corresponding license key
String? licenseKey = Platform.isAndroid ? android : ios;
// Check if a license key was provided for the current platform
if (licenseKey == null) {
if (kDebugMode) {
print('License key for the current platform is not available');
}
return false;
}
// Attempt to activate the license with the given key
try {
final bool? result = await methodChannel
.invokeMethod<bool>('activateLicense', {'licenseKey': licenseKey});
if (kDebugMode) {
print('License activation result for $licenseKey: $result');
}
return result;
} catch (e) {
if (kDebugMode) {
print('Failed to activate license: $e');
}
return false;
}
}