Files
SpotiFLAC-Mobile/lib/utils/desktop_platform.dart
T
zarzet 8398845ce7 build(mobile): compile desktop-only code out of phone builds
isDesktopPlatform is only known at run time, so phone builds carried
the desktop player engine, the desktop diagnostics and the Windows
folder lookup. With --dart-define=MORNYE_MOBILE=true it is a
compile-time false and the compiler drops what only desktop reaches.
Android and iOS release builds pass the define.

Three call sites reached desktop code without asking
isDesktopPlatform; they ask now. Without the define (desktop builds,
tests) nothing changes.
2026-11-22 00:19:10 +07:00

20 lines
791 B
Dart

import 'dart:io' show Platform;
/// Set with `--dart-define=MORNYE_MOBILE=true` on Android and iOS release
/// builds so Dart AOT can tree-shake desktop-only dependencies and UI paths.
const bool kMornyeMobileBuild = bool.fromEnvironment('MORNYE_MOBILE');
/// Overrides [isDesktopPlatform] in tests.
bool? debugDesktopPlatformOverride;
// `flutter test` runs on a desktop host; tests see a mobile app unless they
// opt in through [debugDesktopPlatformOverride].
final bool _hostIsDesktop =
!Platform.environment.containsKey('FLUTTER_TEST') &&
(Platform.isMacOS || Platform.isWindows || Platform.isLinux);
/// True in Windows, Linux and macOS builds of the app.
bool get isDesktopPlatform => kMornyeMobileBuild
? false
: (debugDesktopPlatformOverride ?? _hostIsDesktop);