device_util.dart 442 B

12345678910111213
  1. import 'package:installed_apps/app_info.dart';
  2. import 'package:installed_apps/installed_apps.dart';
  3. import 'package:news_app/util/log.util.dart';
  4. Future<bool> isWeChatInstalledOnlyAndroid() async {
  5. try {
  6. List<AppInfo> apps = await InstalledApps.getInstalledApps(true, true);
  7. return apps.any((app) => app.packageName == 'com.tencent.mm');
  8. } catch (e) {
  9. consoleLog("Error checking installed apps: $e");
  10. return false;
  11. }
  12. }