isolate_http 3.0.0 copy "isolate_http: ^3.0.0" to clipboard
isolate_http: ^3.0.0 copied to clipboard

IsolateHttp provides a way to launch 'http' library in Isolate with IsolatesFlutter.

IsolateHttp #

Pub

IsolateHttp provides a way to launch http package with IsolateFlutter.

Usage #

Performing a GET request:

final _isolateHttp = IsolateHttp();
final _response = await _isolateHttp.get('https://example.com/product',
    headers: {'Authorization': 'abc='});
print(_response);

Performing a POST request:

final _response = await _isolateHttp.post('https://example.com/product',
    headers: {'Authorization': 'abc='},
    body: {'size': 'XL', 'price': 236},
    files: [
        HttpFile.fromPath('files', 'path/image_1.png')
    ]);
print(_response);

Performing a DELETE request:

final _response = await _isolateHttp.delete('https://example.com/product/1',
    headers: {'Authorization': 'abc='});
print(_response);

*** You can set a timeout and debug label for your request when creating an IsolateHttp like:

final _isolateHttp =  IsolateHttp(timeout: Duration(seconds: 30), debugLabel: 'get_products')

If timeout, its returns you an IsolateHttpResponse with status code 408 (Request Timeout).

Log Curl #

_isolateHttp.listener = (curl) {
    if (kDebugMode) {
      log('Isolate Http -> Curl: ----------------\n$curl\n----------------');
    }
  };

Author #

IsolateHttp is developed by Thong Dang. You can contact me at thongdn.it@gmail.com

If you like my project, you can support me Buy Me A Coffee or star (like) for it.

Thank you! ❤️

10
likes
130
pub points
73%
popularity

Publisher

unverified uploader

IsolateHttp provides a way to launch 'http' library in Isolate with IsolatesFlutter.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, http, http_parser, isolate_flutter

More

Packages that depend on isolate_http