My API's are working fine in applications but if I'm trying to call API with web so API's are not working
API's are implemented with dio (https://pub.dev/packages/dio)
Welcome for the improvements and thanks in advance for solutions and suggestions.
My API's are working fine in applications but if I'm trying to call API with web so API's are not working
API's are implemented with dio (https://pub.dev/packages/dio)
Welcome for the improvements and thanks in advance for solutions and suggestions.
Disable web security must be turned off and it will work immediately.
This is a CORS (cross-origin resource sharing) issue. You need to enable the CORS request on your server-side to fix this. Depending on your setup, you won't be needing to make changes on the client app.
1- Go to flutter\bin\cache and remove a file named: flutter_tools.stamp
2- Go to flutter\packages\flutter_tools\lib\src\web and open the file chrome.dart.
3- Find '--disable-extensions'
4- Add '--disable-web-security'
This is a CORS (cross-origin resource sharing) issue. You need to enable the CORS request on your server-side to fix this. Depending on your setup, you won't be needing to make changes on the client app.
Common workarounds made here for development builds is by disabling security using --disable-web-security argument when the app is run.