flutter_demo_gps/lib/utils/environment.dart

29 lines
744 B
Dart

import 'dart:io' show Platform;
import 'package:flutter/foundation.dart';
class Environment {
static bool get hasRealGps =>
kIsWeb || Platform.isAndroid || Platform.isIOS;
// !kIsWeb && (Platform.isAndroid || Platform.isIOS);
static bool get isAndroid => !kIsWeb && Platform.isAndroid;
static bool get isIOS => !kIsWeb && Platform.isIOS;
static bool get isDesktop => !kIsWeb && (
Platform.isLinux ||
Platform.isMacOS ||
Platform.isWindows ||
Platform.isFuchsia);
static String storageDir() {
if (kIsWeb) {
return ".";
} else if (isAndroid) {
return '/storage/emulated/0/Download/';
} else if (isIOS) {
return 'Documents';
} else {
return ".";
}
}
}