import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:isekai_wiki/global.dart'; import '../extension/string.dart'; class ApiUtils { static Future getUserAgent() async { if (kIsWeb) { // Web版防止出错 return ""; } String osName = Platform.operatingSystem.capitalize(); String osVersion = Platform.operatingSystemVersion; String appVersion = Global.packageInfo?.version ?? "0.0"; return "IsekaiWikiApp/$appVersion ($osName $osVersion)"; } }