getPlatformVersion method

  1. @override
Future<String?> getPlatformVersion()
override

Implementation

@override
Future<String?> getPlatformVersion() async {
  try {
    // Invoke the 'getPlatformVersion' method on the native side.
    final version =
        await methodChannel.invokeMethod<String>('getPlatformVersion');
    return version;
  } on PlatformException catch (e) {
    // Handle platform-specific exceptions.
    if (kDebugMode) {
      print("Failed to get platform version: '${e.message}'.");
    }
    return null;
  }
}