device_info_gigachad

This plugin will let you get device information synchronously via ffi.


gigachad

Platform support

Android iOS Windows macOS Linux Web

Preparation before use

Android

If native code obfuscation is enabled in Android part of your project (in android/app/build.gradle(.kts) isMinifyEnabled is set to true) you should add this rules in your proguard-rules.pro file otherwise you will get an java.lang.ClassNotFoundException in runtime.

-keep class com.mozochek.device_info_gigachad.DeviceInfoGigachad { *; }
-keep class com.mozochek.device_info_gigachad.DeviceInfoGigachad$Companion { *; }

See example for more information.

iOS

Make sure your app meets the requirements if you want to use UIDevice.current.name. For more information: https://developer.apple.com/documentation/uikit/uidevice/name


Basic usage

import 'package:device_info_gigachad/device_info_gigachad.dart';

void someFunc() {
  final deviceInfo = DeviceInfoGigachad.getInfo();
  switch (deviceInfo) {
    case AndroidDeviceInfo():
      print(deviceInfo.version.sdkInt);
      // your desired code with AndroidDeviceInfo instance
      break;
    case IosDeviceInfo():
      print(deviceInfo.uiDevice.systemVersion);
      // your desired code with IosDeviceInfo instance
      break;
  }
}