device_profile 0.1.0
device_profile: ^0.1.0 copied to clipboard
What the device is: the name a person knows it by (Redmi 9A, Galaxy XCover 5, iPhone 12 mini) instead of its hardware code, the kind of device, and whether its display is round.
0.1.0 #
Added #
PlatformDeviceProfile.read(), behind theDeviceProfileReaderinterface, giving aDeviceProfile: what the device is, from one read of the platform.DeviceProfile.name: aDisplayNamewith the name, itsNameSourceand the key it was read from.- Android: the maker's factory name from
Settings.Global(Samsungdefault_device_name, Huawei/Honorunified_default_device_name, vivowifi_hotspot_default_name) or from its system properties (Xiaomi, OPPO/realme/OnePlus, vivo, Huawei, ZTE, Transsion, Lenovo/Motorola, HMD, Sony, Asus, LG, Umidigi);Build.MODELwhen it already is a name; the brand and the model otherwise. Placeholders, codenames and hardware codes are rejected. Only the device maker's keys are read (androidKeysFor). - Android: the user-assigned name through
userAssignedName:never(default),fallbackorpreferred. - iOS: the hardware identifier looked up in a generated table of Apple identifiers; the identifier itself when the table does not know it.
DeviceProfile.kind(DeviceKind: phone, tablet, foldable, watch, tv, car, desktop, headset, unknown) from the Android system features,ro.build.characteristicsand the smallest screen width, or the iOS interface idiom.DeviceProfile.screenShape(ScreenShape.roundorrectangular): Android'sConfiguration.isScreenRound, read in the same call as the name; always rectangular on iOS.chooseAndroidProfile,chooseIosProfile, andchooseAndroidName,chooseIosNamefor the name alone.DisplayName.fullNamewith the brand in front,DisplayName.userAgentTokenanduserAgentToken(String)safe for a header, anddistinctLabelsfor a list of devices that share a name.readSources()with the raw values the platform read.- Other platforms, and every failure, answer
null.
Requirements #
- Flutter 3.47 or later; Android 7.0 (API 24) or later, built with Android Gradle Plugin 8.13 or later; iOS 15 or later.