platformVersion property

Future<String?> platformVersion

Gets the platform version.

Fetches the host (native platform) version (e.g. The iOS or Android version).

Example:

Future<void> _getPlatformVersion() async {
  String platformVersion;
  try {
    platformVersion = await Dji.platformVersion ?? 'Unknown platform version';
  } on PlatformException {
    platformVersion = 'Failed to get platform version.';
  }
  if (!mounted) return;
  setState(() {
    _platformVersion = platformVersion;
  });
}

Note: We check the mounted so that if the widget was removed from the tree while the asynchronous platform message was in flight, we want to discard the reply.

Implementation

static Future<String?> get platformVersion async {
  Version? version = await _api?.getPlatformVersion();
  return version?.string;
}