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.

example/main.dart

import 'dart:developer';
import 'package:flutter/foundation.dart';

import 'package:isolate_http/isolate_http.dart';

void main(List<String> args) async {
  // https://developers.google.com/books
  final _isolateHttp =
      IsolateHttp(timeout: Duration(seconds: 60), debugLabel: 'search_book');
  final _response = await _isolateHttp.get(
      'https://www.googleapis.com/auth/books/v1/volumes',
      query: {'q': 'flutter'});
  if (_response?.statusCode == 200) {
    final _bodyJson = _response?.bodyJson;
    print(_bodyJson);
  } else {
    print('Request failed with status: ${_response?.statusCode}.');
  }

  // Log Curl
  _isolateHttp.listener = (curl) {
    if (kDebugMode) {
      log('Isolate Http -> Curl: ----------------\n$curl\n----------------');
    }
  };
}
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