getx
getx copied to clipboard
Bug Report Getx5 : Error when setting URL strategy in GetMaterialApp
After updating to the latest getx5 version, I encountered an error related to setting the URL strategy while using GetMaterialApp in a Flutter web project. The error occurs during the app initialization, stating that the URL strategy cannot be set a second time or after the app has already been initialized.
Error Message
======== Exception caught by widgets library =======================================================
The following assertion was thrown building GetMaterialApp:
Assertion failed: org-dartlang-sdk:///lib/ui_web/ui_web/navigation/url_strategy.dart:53:5
_customUrlStrategyCanBeSet
"Cannot set URL strategy a second time or after the app has been initialized."
Stack Trace
The relevant error-causing widget was:
GetMaterialApp GetMaterialApp:file:///Users/jepiloseu/StudioProjects/venustalk/lib/main.dart:204:16
When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 296:3 throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3 assertFailed
lib/ui_web/ui_web/navigation/url_strategy.dart 53:5 set urlStrategy
packages/flutter_web_plugins/src/navigation/url_strategy.dart 22:10 setUrlStrategy
packages/get/get_navigation/src/routes/url_strategy/impl/web_url.dart 4:3 removeHash
packages/get/get_navigation/src/routes/url_strategy/url_strategy.dart 6:3 setUrlStrategy
packages/get/get_navigation/src/routes/get_router_delegate.dart 100:46 new
packages/get/get_navigation/src/routes/get_router_delegate.dart 25:12 createDelegate
packages/get/get_navigation/src/root/get_root.dart 367:39 onInit
packages/get/get_navigation/src/root/get_root.dart 331:5 initState
Additional Information Flutter version: 3.24.1 GetX version: ^5.0.0-release-candidate-9.2.1 Platform: Web Is there a recommended solution for ensuring the URL strategy is set correctly in GetMaterialApp for Flutter web?
Same issue. Unfortunately there is currently no way to set showHashOnUrl manually.
if (!showHashOnUrl && GetPlatform.isWeb) setUrlStrategy();
any update on this ?
I have the same issue and downgrade to 4.7.2