Skip to content

Commit fe6ff19

Browse files
Merge pull request #6684 from TURBODRIVER/patch-1
Fix GestureDetector allowed_devices type cast error
2 parents 2522e1d + 5532345 commit fe6ff19

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
* Fix the cryptic `shutil.ReadError: ... is not a zip file` failure in web apps when the app package download fails. The Pyodide worker piped the `pyfetch(app_package_url)` response straight into `unpack_archive()` without a status check, so any non-2xx response (transient server 500, expired auth 401, deleted app 404) wrote the JSON/HTML error body to a temp file and crashed while unpacking it. The worker now checks `response.ok` and raises a readable `Failed to download app package: HTTP <status> <url> — <body>` error, including the first 200 chars of the error body. Applied to both the Flet web client and the `flet build` template ([#6680](https://github.com/flet-dev/flet/pull/6680)) by @FeodorFitsner.
1010
* Remove unused `BasePage` return type and import from `BaseControl` and `ControlEvent` ([#6606](https://github.com/flet-dev/flet/pull/6606)) by @Iaw4tch.
11+
* Fix `GestureDetector.allowed_devices` crashing with `type 'List<dynamic>' is not a subtype of type 'List<String?>?'` and preventing the control from rendering. Property values are deserialized from JSON as `List<dynamic>`, but the value was read via `get<List<String?>>(...)`, whose reified cast fails because a `List<dynamic>` is not a `List<String?>`. It's now read as `List<dynamic>` and each entry is converted to a string before parsing, restoring `supportedDevices` filtering for Flutter's `GestureDetector` ([#6684](https://github.com/flet-dev/flet/pull/6684)) by @TURBODRIVER.
1112

1213
## 0.86.0
1314

packages/flet/lib/src/controls/gesture_detector.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ class _GestureDetectorControlState extends State<GestureDetectorControl> {
295295
trackpadScrollCausesScale:
296296
widget.control.getBool("trackpad_scroll_causes_scale", false)!,
297297
supportedDevices: () {
298-
var supportedDevices =
299-
widget.control.get<List<String?>>("allowed_devices");
298+
var supportedDevices =
299+
widget.control.get<List<dynamic>>("allowed_devices");
300300
return supportedDevices
301-
?.map((d) => parsePointerDeviceKind(d))
301+
?.map((d) => parsePointerDeviceKind(d?.toString()))
302302
.nonNulls
303303
.toSet();
304304
}(),

0 commit comments

Comments
 (0)