device_info – Detect platform and OS version in Flutter

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

Install the package:

device_info: ^1.0.0

Then its classes can be imported with package:device_info/device_info.dart in a Dart file.

DeviceInfoPlugin class in this package can provide device and operating system information. Each OS, Android and iOS, have its own 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 ${}")

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.