mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
38 lines
818 B
Dart
38 lines
818 B
Dart
import 'package:device_info_plus/device_info_plus.dart';
|
|
import 'package:fl_lib/fl_lib.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class AppProvider extends ChangeNotifier {
|
|
int? _newestBuild;
|
|
int? get newestBuild => _newestBuild;
|
|
set newestBuild(int? build) {
|
|
_newestBuild = build;
|
|
notifyListeners();
|
|
}
|
|
|
|
BuildContext? ctx;
|
|
|
|
bool isWearOS = false;
|
|
|
|
Future<void> init() async {
|
|
await _initIsWearOS();
|
|
}
|
|
|
|
Future<void> _initIsWearOS() async {
|
|
if (!isAndroid) {
|
|
isWearOS = false;
|
|
return;
|
|
}
|
|
|
|
final deviceInfo = DeviceInfoPlugin();
|
|
final androidInfo = await deviceInfo.androidInfo;
|
|
|
|
const feat = 'android.hardware.type.watch';
|
|
final hasFeat = androidInfo.systemFeatures.contains(feat);
|
|
if (hasFeat) {
|
|
isWearOS = true;
|
|
return;
|
|
}
|
|
}
|
|
}
|