UApp class abstract
App, device, platform, theme and language info in one place; filled by initU(). UApp.version, UApp.isAndroid, UApp.toDarkMode()
Constructors
- UApp()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- buildNumber → String
-
Build number.
UApp.buildNumber→ "12"no setter - cpuArch → String?
-
CPU architecture. "arm64", "x86_64"
no setter
- cpuCores → int?
-
Number of CPU cores (web: navigator.hardwareConcurrency).
no setter
- deviceBrand → String
-
Brand. "samsung", "Apple"
no setter
-
deviceExtra
→ Map<
String, Object?> -
Raw platform-specific details (e.g. Android fingerprint, Apple model name).
no setter
-
deviceHeaders
→ Map<
String, String> -
Ready-made X-Device-* / X-App-* headers for your API calls.
http.get(url, headers: UApp.deviceHeaders)no setter - deviceInfo → UDeviceInfo
-
Everything about this device (model, OS, id, locales, time zone…) as one object.
UApp.deviceInfo.modelno setter -
deviceLocales
→ List<
String> -
Device languages, most preferred first.
"fa-IR", "en-US"no setter - deviceManufacturer → String
-
Maker. "Samsung", "Apple", "Lenovo"
no setter
- deviceModel → String
-
Hardware model. "SM-S918B", "iPhone16,1", "MacBookPro18,3"; web: the browser.
no setter
- deviceName → String
-
Name the user gave the device. "Sina's iPhone" (iOS 16+ needs an entitlement, else "iPhone")
no setter
- deviceType → UDeviceType
-
phone, tablet, desktop, tv, watch, car or web.
if (UApp.deviceType == UDeviceType.tablet) …no setter - firstLaunchTime → DateTime?
-
When the app was opened for the first time.
no setter
- flavor → String?
-
Build flavor from
flutter run --flavor x; null when none.no setter - fullVersion → String
-
Version with build. "1.4.0+12"
no setter
- installer → UInstaller
-
Where the app came from: Play, App Store, TestFlight, Bazaar, Myket, Microsoft Store, sideload…
if (UApp.installer == UInstaller.bazaar) …no setter - installTime → DateTime?
-
When the app was first installed; null on web and Linux.
no setter
- is24HourFormat → bool?
-
True when the device clock is 24-hour; null on web and when unknown.
no setter
- isAndroid → bool
-
True on Android (false on web, even in an Android browser).
no setter
- isDarkMode → bool
-
True when the app is showing the dark theme.
no setter
- isDebug → bool
-
True in debug builds.
no setter
- isDesktop → bool
-
True on macOS, Windows or Linux apps.
no setter
- isDesktopDevice → bool
-
True when the hardware is a computer.
no setter
- isDeviceInfoReady → bool
-
True once device info is loaded (after initU()).
no setter
- isEmbedded → bool
-
Web only: true inside an iframe/WebView or with ?embedded=true.
no setter
- isEmulator → bool
-
True on an emulator/simulator (detected on Android and Apple; desktops report false).
no setter
- isFirstLaunch → bool
-
True on the very first launch after install (e.g. show onboarding).
if (UApp.isFirstLaunch) showIntro()no setter - isFirstLaunchOfVersion → bool
-
True on the first launch of this version (e.g. show "What's new").
no setter
- isFuchsia → bool
-
True on Fuchsia.
no setter
- isIos → bool
-
True on iOS/iPadOS (false on web).
no setter
- isLinux → bool
-
True on Linux (false on web).
no setter
- isMacOs → bool
-
True on macOS (false on web).
no setter
- isMobile → bool
-
True on Android or iOS apps (not mobile browsers; use deviceType for that).
no setter
- isPackageInfoReady → bool
-
True once app info is loaded (after initU()).
no setter
- isPhoneDevice → bool
-
True when the hardware is a phone (also for mobile browsers).
no setter
- isPhysicalDevice → bool
-
False on emulators, simulators and virtual machines.
no setter
- isProfile → bool
-
True in profile builds.
no setter
- isRelease → bool
-
True in release builds.
no setter
- isTabletDevice → bool
-
True when the hardware is a tablet (also for tablet browsers).
no setter
- isTvDevice → bool
-
True on Android TV / Apple TV.
no setter
- isWeb → bool
-
True in a browser.
if (UApp.isWeb) …no setter - isWindows → bool
-
True on Windows (false on web).
no setter
- justUpdated → bool
-
True when the app was updated since the last launch.
no setter
- launchCount → int
-
How many times the app has been opened (e.g. ask for a review after 10).
if (UApp.launchCount == 10) ULaunch.requestReview()no setter - name → String
-
App name as shown on the home screen.
UApp.name→ "My App"no setter - osBuild → String?
-
OS build id. "UP1A.231005.007", "21E236"; null when unknown.
no setter
- osName → String
-
OS name. "Android", "iOS", "macOS", "Windows 11", "Ubuntu"; web: the visitor's OS.
no setter
- osVersion → String
-
OS version. "14", "17.4.1", "10.0.22631"
no setter
- packageInfo → UPackageInfo
-
Everything about this app (name, id, version, build, install time…) as one object.
UApp.packageInfo.versionno setter - packageName → String
-
Android application id / Apple bundle id (web: the site host).
UApp.packageName→ "com.company.app"no setter - previousVersion → String?
-
Version that ran last time; null on first launch.
no setter
-
queryParameters
→ Map<
String, String> -
Web page URL query, e.g. ?ref=x → {"ref": "x"}; empty elsewhere.
UApp.queryParameters["ref"]no setter - sdkInt → int?
-
Android API level (34 = Android 14); null on other platforms.
if ((UApp.sdkInt ?? 0) >= 33) …no setter - signatureSha256 → String?
-
Android signing certificate SHA-256, to catch repackaged APKs; null on other platforms.
no setter
- timeZone → String?
-
Device time zone (IANA). "Asia/Tehran"
no setter
- totalMemory → int?
-
Total RAM in bytes (web: rounded by the browser, Chromium only).
UApp.totalMemory?.toBKMG()no setter - updateTime → DateTime?
-
When the app was last updated; null on web and Linux.
no setter
- userAgent → String
-
User-Agent for your API calls. "MyApp/1.4.0+12 (Android 14; SM-S918B)"
no setter
- version → String
-
App version.
UApp.version→ "1.4.0"no setter - versionFirstLaunchTime → DateTime?
-
When this version was opened for the first time.
no setter
Static Methods
-
batteryLevel(
) → Future< int?> -
Battery 0-100; null without a battery (desktops) and on Safari/Firefox.
await UApp.batteryLevel() -
compareVersions(
String a, String b) → int -
Compares versions: negative if a < b, 0 if equal, positive if a > b.
UApp.compareVersions("1.2.0", "1.10.0")→ -1 -
deviceId(
) → String -
Stable id of this device, empty before initU() finishes. Web: resets when site data is cleared.
UApp.deviceId() -
deviceIntegrity(
{bool refresh = false}) → Future< UDeviceIntegrity> -
Root/jailbreak, emulator, hooking (Frida/Xposed), debugger and dev-mode checks, cached.
(await UApp.deviceIntegrity()).reasons -
deviceStatus(
) → Future< UDeviceStatus> -
Battery, charging, power saver, thermal, free RAM/disk right now.
final s = await UApp.deviceStatus(); -
exit(
) → Future< void> -
Closes the app on Android and desktop; iOS and web do not allow it (does nothing).
UApp.exit() -
freeDiskSpace(
) → Future< int?> -
Free disk space in bytes (web: remaining site storage quota).
(await UApp.freeDiskSpace())?.toBKMG() -
freeMemory(
) → Future< int?> - Free RAM in bytes; null on web.
-
haptic(
[UHapticType type = UHapticType.light]) → Future< void> -
Short vibration feedback (Android/iOS; ignored on desktop and web).
UApp.haptic(UHapticType.success) -
hideKeyboard(
) → void -
Closes the on-screen keyboard from anywhere.
UApp.hideKeyboard() -
initPackageInfo(
) → Future< void> -
Loads app info (initU() already does it).
await UApp.initPackageInfo() -
isCharging(
) → Future< bool> -
True when plugged in and charging or full.
await UApp.isCharging() -
isDarkTheme(
) → bool - True when the app is showing the dark theme.
-
isDesktopSize(
) → bool - True when the window is 1100+ wide.
-
isDeviceCompromised(
) → Future< bool> -
True when rooted/jailbroken, hooked or a debugger is attached; block payments with it.
if (await UApp.isDeviceCompromised()) … -
isLandscape(
) → bool - True when the screen is wider than tall (needs a built app, uses navigatorKey).
-
isLowBattery(
) → Future< bool> - True when 15% or less and not charging.
-
isMobileSize(
) → bool - True when the window is narrower than 850 (phone layout, any platform).
-
isPhone(
) → bool - True when the short side is under 600 (always false on web).
-
isPortrait(
) → bool - True when the screen is taller than wide.
-
isPowerSaveMode(
) → Future< bool?> - True when battery saver / Low Power Mode is on; null when unknown (web).
-
isRooted(
) → Future< bool> - True when rooted (Android) or jailbroken (iOS); always false on desktop and web.
-
isTablet(
) → bool -
True when the short side is 600+ (always false on web).
if (UApp.isTablet()) twoColumns() -
isTabletSize(
) → bool - True when the window is 850-1100 wide.
-
isVersionAtLeast(
String minimum) → bool -
True when this app is
minimumor newer.if (!UApp.isVersionAtLeast(server.minVersion)) forceUpdate() -
isVersionOlderThan(
String other) → bool -
True when this app is older than
other.UApp.isVersionOlderThan(latest) -
keepScreenOn(
bool on) → Future< bool> -
Keeps the screen awake while
on(videos, navigation, scanners); Android/iOS/web.UApp.keepScreenOn(true) -
locale(
) → String -
Current app language code.
UApp.locale()→ "fa" -
setFullScreen(
bool fullScreen) → Future< void> -
Hides (true) or shows the status and navigation bars; Android/iOS.
UApp.setFullScreen(true) -
setOrientations(
List< DeviceOrientation> orientations) → Future<void> -
Locks rotation (empty list unlocks); ignored on desktop and web.
UApp.setOrientations([DeviceOrientation.portraitUp]) -
setStatusBarLight(
bool light) → void -
Makes status/navigation bar icons white (for dark screens) or black; mobile only.
UApp.setStatusBarLight(true) -
shouldSaveEnergy(
) → Future< bool> -
True when you should skip heavy work (low battery, saver on, or device hot).
if (!await UApp.shouldSaveEnergy()) sync() -
toDarkMode(
) → void -
Switches to the dark theme and saves it (needs UMaterialApp).
UApp.toDarkMode() -
toLightMode(
) → void -
Switches to the light theme and saves it (needs UMaterialApp).
UApp.toLightMode() -
updateLocale(
Locale locale) → void -
Switches the app language and saves it for next launch (needs UMaterialApp).
UApp.updateLocale(const Locale("en"))