writeDeviceInfo method
写入设备 & 应用信息 & IP 地址
Implementation
Future<void> writeDeviceInfo() async {
try {
String logDirPath = await UtilFile.getFileStorageDirectory(type: FileStorageDirectoryType.log);
String filePath = p.join(logDirPath, 'device-info.txt');
PackageInfo package = await PackageInfo.fromPlatform();
Map ipAddress = await getIpAddress();
Map output = {
"deviceInfo": SystemStore.to.deviceInfo,
"packageInfo": package.data,
"ipAddress": ipAddress,
};
_logQueue.addToQueue(
path: filePath,
content: normalizeFileContent(output),
mode: FileMode.write,
);
} catch (e) {
debugPrint('日志服务 - 设备信息记录失败: $e');
}
}