JJ_MKVMaker/lib/services/platform_info.dart

23 lines
1.0 KiB
Dart

/// 약속: 앱이 도는 기기가 무엇인지 (Android · Windows) 와 메모리를 아껴야 하는지 - 한곳에서만 정한다.
/// 입력 없음 ([PlatformInfo.host] 는 이 기기를 그대로 읽는다), 출력 = 세 값, 오류 없음.
/// 기기에 따라 다르게 도는 곳은 이것을 받아 (생성자 · 조립) 쓴다 - "Android 인 척" 하는 스위치를 따로 두지 않는다 (M1)
library;
import 'dart:io';
class PlatformInfo {
final bool isAndroid;
final bool isWindows;
/// 메모리를 아끼는 방식 (모델을 나눠 열기 등). 처음 값은 Android
final bool lowMemory;
const PlatformInfo({required this.isAndroid, required this.isWindows, bool? lowMemory}) : lowMemory = lowMemory ?? isAndroid;
/// 이 기기
static final PlatformInfo host = PlatformInfo(isAndroid: Platform.isAndroid, isWindows: Platform.isWindows);
static const android = PlatformInfo(isAndroid: true, isWindows: false);
static const windows = PlatformInfo(isAndroid: false, isWindows: true);
}