1

Can anyone show me how to get and post data with API in flutter? I have tried some flutter API tutorials with Laravel but when I print the value is error cors, something wrong with my flutter code or my API? or there are some settings in laravel when i create API?

create CRUD in Flutter using API from laravel

4
  • have you try it with postman? does it show the error when you get/post the API Commented Dec 23, 2022 at 9:35
  • yes, I have used postman and it's work fine, but when I get the API there is error cors Commented Dec 23, 2022 at 9:40
  • your backend (laravel) must be work fine if you have tried it with postman and showing no error, could you post your code and post the error message from the console log when you run your app Commented Dec 23, 2022 at 9:41
  • I've posted my code and error below, there is wrong with my code? Commented Dec 23, 2022 at 10:26

1 Answer 1

1

I think You are having CORS issue from your mobile app. From the backend (laravel) you need to allow the request from your specific IP or even you can allow for all the domains. Please refer to this link on how to enable CORS on laravel. https://www.stackhawk.com/blog/laravel-cors/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.