OpenMediacenterMobileFlutter/lib/utils/platform.dart

24 lines
606 B
Dart
Raw Normal View History

2022-04-15 16:15:44 +00:00
import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
bool _isTV = false;
bool isDesktop() {
return (Platform.isLinux || Platform.isWindows || Platform.isMacOS) &&
!kIsWeb;
2022-04-15 16:15:44 +00:00
}
Future<void> loadDeviceInfo() async {
WidgetsFlutterBinding.ensureInitialized();
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
_isTV = androidInfo.systemFeatures.contains('android.software.leanback_only');
}
bool isTV() {
return _isTV;
}