diskInfo top-level property

String get diskInfo

Implementation

String get diskInfo {
  final data = (Process.runSync(
    "lspci",
    [],
  )).stdout.toString();
  final List<String> networkRaws = data.split("\n");
  final List<String> networks = [];
  for (var i = 0; i < networkRaws.length; i++) {
    final String line = networkRaws[i];
    if (!line.contains(":")) continue;

    final first = line.split(" ")[1];
    if (RegExp("^(Non-Volatile memory controller:)", caseSensitive: false).hasMatch(line) == false && first != "Non-Volatile") {
      continue;
    }
    String network = line.split(": ")[1].replaceAll(RegExp("\\(rev .*\\)\$"), "").trim();

    networks.add(network.trim());
  }
  return networks.join("\n");
}