getPlatformVersion method
Retrieves the platform version information from the native SDK.
This method communicates with the native platform (Android/iOS) to get version information about the underlying Kruzr SDK implementation.
Returns:
String?: The platform version string, ornullif retrieval fails
Usage:
final version = await communicator.getPlatformVersion();
print('Platform version: $version');
Error Handling:
- Returns
nullif a PlatformException occurs - Logs error details in debug mode for troubleshooting
Implementation
Future<String?> getPlatformVersion() async {
const platform = MethodChannel('co.kruzr.kruzr360/channel');
try {
final version = await platform.invokeMethod<String>('getPlatformVersion');
if (kDebugMode) {
print("Platform version: $version");
}
return version;
} on PlatformException catch (e) {
if (kDebugMode) {
print("Failed to get platform version: '${e.message}'.");
}
}
return null;
}