I am using chopper package to send requests to my backend, I have created small warehouse program, when I build it for desktop it works fine, but when I compile for web it throws this error, XMLHttpRequest error
, I am using Open Server Panel for Windows
.
My code for API requests
import 'package:chopper/chopper.dart';
import 'package:intermax_warehouse_app/BrigadeDetails/brigade_details.dart';
import 'package:intermax_warehouse_app/IssuedItemsDetails/issued_items.dart';
import 'package:intermax_warehouse_app/JsonConverter/converter.dart';
import 'package:intermax_warehouse_app/SuppliersDetails/suppliers_details.dart';
import 'package:intermax_warehouse_app/UserDetails/user_details.dart';
import 'package:intermax_warehouse_app/WarehouseItemDetails/warehouse_item_details.dart';
part 'server_side_api.chopper.dart';
@ChopperApi()
abstract class ServerSideApi extends ChopperService{
@Post(path: '/login_user.php', headers: {"Access-Control-Allow-Origin" : "*"})
Future<Response<User>> loginUser(@Body() var data);
static ServerSideApi create(){
final client = ChopperClient(baseUrl: 'http://192.168.0.21',
services: [
_$ServerSideApi()
],
converter: converter,
);
return _$ServerSideApi(client);
}
}