Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception when running on the web #25

Merged
merged 1 commit into from
Jan 17, 2024
Merged

Fix exception when running on the web #25

merged 1 commit into from
Jan 17, 2024

Conversation

dsyrstad
Copy link
Contributor

@dsyrstad dsyrstad commented Jan 16, 2024

When you run the example/lib/main.dart on the web, you get:
image

======== Exception caught by widgets library =======================================================
The following UnsupportedError was thrown building DragTarget<FlexDragTargetData>(dirty, state: _DragTargetState<FlexDragTargetData>#800e2):
Unsupported operation: Platform._operatingSystem

The relevant error-causing widget was: 
  DragTarget<FlexDragTargetData> DragTarget:file:///home/dsyrstad/IdeaProjects/appflowy-board/lib/src/widgets/reorder_flex/drag_target.dart:127:25
When the exception was thrown, this was the stack: 
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 294:3       throw_
dart-sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart 244:5                   _operatingSystem
dart-sdk/lib/io/platform_impl.dart 56:40                                          get operatingSystem
dart-sdk/lib/io/platform.dart 83:44                                               get operatingSystem
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 1430:8  get
dart-sdk/lib/io/platform.dart 161:46                                              get isIOS
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 1430:8  get
packages/appflowy_board/src/widgets/reorder_flex/drag_target.dart 201:21          [_buildDraggableWidget]

This is due to drag_target.dart blindly checking the Platform, which doesn't work on web. This PR fixes the issue by checking for kIsWeb first.

@CLAassistant
Copy link

CLAassistant commented Jan 16, 2024

CLA assistant check
All committers have signed the CLA.

@Xazin Xazin merged commit 59efa93 into AppFlowy-IO:main Jan 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants