getDeviceName static method

Future<String?> getDeviceName()

获取当前设备的名称。

Implementation

static Future<String?> getDeviceName() async {
  try {
    return Platform.localHostname;
  } catch (e) {
    debugPrint("Failed to get device name: '${e.toString()}'.");
    return null;
  }
}