getPlatformVersion method
Gets the platform version from the native platform.
This method invokes the getPlatformVersion
method on the native side and
returns the result as a String. If the method call fails, it catches the error
and returns null
.
Implementation
@override
Future<String?> getPlatformVersion() async {
try {
final version =
await methodChannel.invokeMethod<String>('getPlatformVersion');
return version;
} on PlatformException catch (e) {
// Handle potential exceptions that may occur when invoking the method
debugPrint('Failed to get platform version: ${e.message}');
return null;
}
}