magic_device 0.0.1
magic_device: ^0.0.1 copied to clipboard
Device signals for Flutter, whether the device is on mains power, whether the viewer is away, and the macOS window fullscreen state.
Changelog #
All notable changes to this project will be documented in this file.
[Unreleased] #
0.0.1 - 2026-10-29 #
Added #
DevicePower: whether the device is on mains power (charging) and whether the viewer is away (idle). Desktop idle polls the OS last-input clock; mobile idle follows the app lifecycle, seeded from the current lifecycle state atstart()so an app started in the background reads idle at once.televisionis an injectable predicate that defaults to() => false.WindowFullscreen: whether the macOS window is fullscreen (active), where it is going (target, moved by AppKit's will-notification) and whether it is animating (transitioning), withtoggle()to flip it. A press that the window never answers (AppKit ignores the call for an app that is not frontmost) ends afterpressTimeoutand re-reads the window, so it cannot hold every later toggle. One sharedinstance; listeners hear each change, whether it came fromtoggle(), the window's green button, Esc or the Window menu.availableis true on macOS only. The native half is a macOS plugin (MagicDevicePlugin, channelmagic_device/window) that finds the window holding the Flutter view on each call, so the host's Runner needs no edit.BatteryStateis exported from the barrel.DevicePower'sbatteryStatereader returns it, so a host that supplies its own reader names the type without addingbattery_plusas a direct dependency.