Zufar Muhamadeev Zufar Muhamadeev - 8 months ago 58
Dart Question

Extending BaseRequest to make custom post request

I am trying to make custom post request with

BrowserClient (package:http/browser_client.dart)
using send method. I don`t understand how should i extend abstract BaseRequest, should i override finalize method?

Answer Source

Unless you're doing something very custom, you want to use one of the subclasses of the abstract BaseRequest class (seen in the docs under Implemented by).

I'm almost sure you want to just use the Request class, like so:

var client = new BrowserClient();
var request = new Request("post", Uri.parse("http://example.com"));
// ... set up the request some more ...
var response = await client.send(request);
// ... do stuff with response ...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download