MDeviceMetric enum
A device metric the widget reads natively, with the app closed.
See MDeviceValue.
Values
- batteryLevel → const MDeviceMetric
-
Battery charge, 0–100.
Android reads this in the widget process, so it is correct even if the app has not run for days. iOS cannot:
isBatteryMonitoringEnabledis a no-op inside an app extension, sobatteryLevelthere is always -1 — on a real device as well as the simulator. Mosaic therefore publishes it from the app (MosaicPlugin), which means on iOS the value appears only after the app has run once, and then tracks changes while it is alive. Until then the widget shows the missing-value placeholder.It never resolves in the iOS simulator, which has no battery to read — monitoring cannot even be enabled there.
const MDeviceMetric('mosaic_battery_level') - batteryCharging → const MDeviceMetric
-
Whether the device is charging — use with
MVisibility. Same iOS caveats as batteryLevel.const MDeviceMetric('mosaic_battery_charging') - storageFreeGb → const MDeviceMetric
-
Free space on the data volume, in GB.
const MDeviceMetric('mosaic_storage_free_gb') - storageUsedPercent → const MDeviceMetric
-
Percentage of the data volume in use, 0–100.
const MDeviceMetric('mosaic_storage_used_percent') - memoryFreeMb → const MDeviceMetric
-
Free RAM in MB.
Android reports system-wide free memory via
ActivityManager. iOS has no public system-wide figure — apps are sandboxed from it — so this is the memory still available to this process (os_proc_available_memory, iOS 13+). Useful as a headroom gauge; do not present it to users as the device's free RAM.const MDeviceMetric('mosaic_memory_free_mb') - memoryTotalMb → const MDeviceMetric
-
Total RAM in MB. Android only; absent on iOS.
const MDeviceMetric('mosaic_memory_total_mb') - memoryUsedPercent → const MDeviceMetric
-
Percentage of RAM in use, 0–100. Android only; absent on iOS.
const MDeviceMetric('mosaic_memory_used_percent')
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- key → String
-
The reserved bind key this metric is published under.
final
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - 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
Constants
-
values
→ const List<
MDeviceMetric> - A constant List of the values in this enum, in order of their declaration.