mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-29 07:34:13 +01:00
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.
20 lines
791 B
Dart
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);
|