feat: page.get_device_info() to get device informations#5672
Merged
FeodorFitsner merged 9 commits intomainfrom Oct 2, 2025
Merged
feat: page.get_device_info() to get device informations#5672FeodorFitsner merged 9 commits intomainfrom
page.get_device_info() to get device informations#5672FeodorFitsner merged 9 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a page.get_device_info() method to retrieve device information across different platforms (Web, Android, iOS, macOS, Linux, Windows). The implementation provides platform-specific device information classes with comprehensive device details.
- Adds new
get_device_info()method to the Page class that returns platform-specific device information - Creates comprehensive device information data structures for all supported platforms
- Upgrades device_info_plus dependency to enable additional device information features
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/python/packages/flet/src/flet/controls/page.py | Adds the get_device_info() method that returns platform-specific device info objects |
| sdk/python/packages/flet/src/flet/controls/device_info.py | Defines comprehensive device information data classes for all platforms |
| sdk/python/packages/flet/src/flet/init.py | Exports all device info classes in the public API |
| packages/flet/pubspec.yaml | Upgrades device_info_plus dependency from ^11.2.0 to ^12.1.0 |
| packages/flet/lib/src/utils/device_info.dart | Implements device info collection logic for Flutter/Dart side |
| packages/flet/lib/src/controls/page.dart | Adds device info method handler and minor theme parsing improvements |
| sdk/python/packages/flet/src/flet/controls/layout_control.py | Adds missing ConstrainedControl to all exports |
| sdk/python/packages/flet/src/flet/controls/core/keyboard_listener.py | Adds missing keyboard event classes to all exports |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Deploying flet-docs with
|
| Latest commit: |
46dd7f4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://54b22ca0.flet-docs.pages.dev |
| Branch Preview URL: | https://device-info.flet-docs.pages.dev |
Contributor
|
Contributor
|
I'd keep |
Replaced direct class instantiation with the from_dict utility for device info objects in Page.get_device_info. This improves consistency and handles dictionary-to-object conversion more robustly.
Introduces JSAny type and conditional JS interop import for Dart, enabling serialization of JS interop objects in FletMsgpackEncoder. Updates protocol.py to handle new ext type code for JSAny. Also comments out unused HTML view sections and updates PyPI cleanup version pattern.
FeodorFitsner
approved these changes
Oct 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #1938
Test Code
Note
page.client_user_agentcould be removed in favor ofpage.get_device_info().user_agentfor webSummary by Sourcery
--
Implement a unified page.get_device_info() API across Python and Flutter SDKs, including new platform-specific DeviceInfo types and a Dart mapping layer, and upgrade the device_info_plus dependency.
New Features:
Add get_device_info() method to Page in Python SDK and to Flutter PageControl for retrieving device information.
Enhancements:
Introduce platform-specific DeviceInfo dataclasses and WebBrowserName enum in Python SDK for typed device info.
Add Dart utility and BaseDeviceInfo extension to map device_info_plus data into a structured JSON representation.
Build:
Bump Flutter device_info_plus dependency from ^11.2.0 to ^12.1.0.