modelInfo top-level property

String get modelInfo

Implementation

String get modelInfo {
  if (Dart.isAndroid) {
    return Process.runSync("getprop", [
      "ro.product.model",
    ]).stdout.toString().trim();
  }
  if (Platform.isLinux) {
    String model = "";
    final List<String> files = [
      "/sys/devices/virtual/dmi/id/product_name",
      "/sys/devices/virtual/dmi/id/product_version",
      "/sys/devices/virtual/dmi/id/board_name",
    ];
    for (var i = 0; i < files.length; i++) {
      final String data = files[i];
      final File file = File(data);
      if (file.existsSync()) {
        try {
          model += "${file.readAsStringSync().trim()} ";
        } catch (e) {}
      }
    }
    return model;
  }
  throw "not support device";
}