"flutter localhost xmlhttprequest error" Code Answer's
You're definitely familiar with the best coding language Dart that developers use to develop their projects and they get all their queries like "flutter localhost xmlhttprequest error" answered properly. Developers are finding an appropriate answer about flutter localhost xmlhttprequest error related to the Dart coding language. By visiting this online portal developers get answers concerning Dart codes question like flutter localhost xmlhttprequest error. Enter your desired code related query in the search bar and get every piece of information about Dart code related question on flutter localhost xmlhttprequest error.
flutter localhost xmlhttprequest error
// Get your local IP by ipconfig (command prompt)
// XAMPP Apache 2.4 httpd.conf:
<Directory />
Require local
Require ip 192.168.0
</Directory>
// Flutter side: add headers to async method:
var response = await http.get(Uri.parse("http://192.168.0.54/api.php"),
headers: {
"Accept": "application/json",
"Access-Control-Allow-Origin": "*"
});
// php side (api.php):
<?php // Modify header too
header('Content-Type: application/json');
header("Access-Control-Allow-Origin: *"); // CORS
header("Access-Control-Allow-Headers: Access-Control-Allow-Origin, Accept");
echo json_encode(['id' => '33', 'success' => 'OK']);
?>
Source: stackoverflow.com
All those coders who are working on the Dart based application and are stuck on flutter localhost xmlhttprequest error can get a collection of related answers to their query. Programmers need to enter their query on flutter localhost xmlhttprequest error related to Dart code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about flutter localhost xmlhttprequest error for the programmers working on Dart code while coding their module. Coders are also allowed to rectify already present answers of flutter localhost xmlhttprequest error while working on the Dart language code. Developers can add up suggestions if they deem fit any other answer relating to "flutter localhost xmlhttprequest error". Visit this developer's friendly online web community, CodeProZone, and get your queries like flutter localhost xmlhttprequest error resolved professionally and stay updated to the latest Dart updates.