t_client 0.1.6 copy "t_client: ^0.1.6" to clipboard
t_client: ^0.1.6 copied to clipboard

A lightweight Dart HTTP client library, designed like Dio, supporting request/response interceptors, upload/download progress, cancel tokens, timeout management, and multipart file upload/download.

example/t_client_example.dart

import 'dart:io';

import 'package:t_client/src/internal.dart';
import 'package:t_client/t_client.dart';

void main() async {
  TClientLogger.instance.init(
    onMessageLog: (message) {
      print(message);
    },
  );
  // final client = TClient();

  final headers = THttpHeaderBuilder();
  headers.setContentType(type: HeaderContentType.applicationJson);
  headers.setAccept(accept: HeaderAccept.applicationJson);
  headers.setAuthorization('i am token');
  headers.setUserAgent(agent: HeaderUserAgent.androidApp);
  headers.setOrigin('[origin]');
  headers.setCookie('[value]');
  headers.setCustom('[key]', '[value]');
  headers.setXApiKey('[value]');
  headers.setReferer('[value]');

  print(headers.getMap);
  //result
  /*{
  Content-Type: application/json, 
  Accept: application/json, 
  Authorization: i am token, 
  User-Agent: MyApp/1.0.0 (Linux; Android 13), 
  Origin: [origin], 
  Cookie: [value], 
  [key]: [value], 
  X-Api-Key: [value], 
  Referer: [value]
  }
  */
}
0
likes
0
points
65
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight Dart HTTP client library, designed like Dio, supporting request/response interceptors, upload/download progress, cancel tokens, timeout management, and multipart file upload/download.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on t_client