device_info – Detect platform and OS version in Flutter

device_info is a package which allows developers to get Android and iOS system information.

Import package:device_info/device_info.dart, instantiate DeviceInfoPlugin and use the Android and iOS getters to get platform-specific device information.

if (Platform.isAndroid) {
  var androidInfo = await DeviceInfoPlugin().androidInfo;    
  print("Android ${androidInfo.version.release} on ${androidInfo.model}")
} else if (Platform.isIOS) {
  var iosInfo = await DeviceInfoPlugin().iosInfo;
  print("iOS ${iosInfo.systemVersion} on ${iosInfo.name}")
}

Leave a Comment

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close