device_utils.dart 599 B

1234567891011121314151617181920
  1. import 'dart:io';
  2. import 'package:flutter/foundation.dart';
  3. class DeviceUtils {
  4. static bool get isDesktop => !isWeb && (isWindows || isLinux || isMacOS);
  5. static bool get isMobile => isAndroid || isIOS;
  6. static bool get isWeb => kIsWeb;
  7. static bool get isWindows => !isWeb && Platform.isWindows;
  8. static bool get isLinux => !isWeb && Platform.isLinux;
  9. static bool get isMacOS => !isWeb && Platform.isMacOS;
  10. static bool get isAndroid => !isWeb && Platform.isAndroid;
  11. static bool get isFuchsia => !isWeb && Platform.isFuchsia;
  12. static bool get isIOS => !isWeb && Platform.isIOS;
  13. }