Viewing version 1.0.1. Open the latest package page.

w_transport

1.0.1

A fluent-style, platform-agnostic library with ready to use transport classes for sending and receiving data over HTTP.

Download archive

Readme

w_transport Pub Build Status codecov.io

A fluent-style, platform-agnostic library with ready to use transport classes for sending and receiving data over HTTP.


Platform Agnostic

The main library (w_transport/w_transport.dart) depends on neither dart:html nor dart:io, making it platform agnostic. This means you can use the w_transport library to build components, libraries, or APIs that will be reusable in the browser AND on the server.

The end consumer will make the decision between client and server, most likely in a main() block.

Usage in the Browser

import 'package:w_transport/w_transport_client.dart' show configureWTransportForBrowser;

void main() {
  configureWTransportForBrowser();
}

Usage on the Server

import 'package:w_transport/w_transport_server.dart' show configureWTransportForServer;

void main() {
  configureWTransportForServer();
}

HTTP

All standard HTTP methods are supported:

  • DELETE
  • GET
  • HEAD
  • OPTIONS
  • PATCH
  • POST
  • PUT
  • TRACE (only on the server)

Features include:

  • Fluent URI construction/mutation thanks to Fluri.
  • Request headers.
  • Easy attachment of various data types to requests.
  • Upload and download progress streams.
  • Sending of credentials on cross-origin requests (withCredentials flag - only has an effect on the client).
  • Request cancellation.

WHttp

WHttp acts as an HTTP client that can be used to send many HTTP requests. Client-side this has no effect, but on the server this gives you the benefit of cached network connections.

Additionally, WHttp has static methods that make simple HTTP requests easy.

WHttp.get(Uri.parse('example.com'));
WHttp.post(Uri.parse('example.com'), 'data');
...

If you do create an instance of WHttp, make sure you close it when finished.

WHttp http = new WHttp();
...
http.close();

WRequest

WRequest is the class used to create and send HTTP requests. It supports headers, request data, upload & download progress monitoring, withCredentials (only useful in the browser), and request cancellation.

WResponse

WResponse is the class that contains the response to a WRequest.

This includes response meta data (available synchronously):

  • Response headers
  • Status code (200)
  • Status text ('OK')

As well as the response content in the following formats (available asynchronously):

  • Dynamic object (ByteBuffer, Document, String, List, etc.)
  • Text (decoded and joined if necessary)
  • Stream

WProgress

WProgress is a simple class that mimics ProgressEvent with an additional percent property for convenience. WProgress is platform-agnostic, unlike ProgressEvent.

WHttpException

WHttpException is a custom exception that is raised when a request responds with a non-successful status code.

Changelog

Changelog

1.0.1

Bug Fixes:

  • Allow request data to be set to null.
  • Canceling an in-flight request now properly results in the returned Future completing with an error.
  • Request data type validation now happens when sending the request instead of upon assignment, allowing intermediate data assignments.
  • Verify w_transport configuration has been set before constructing a WHttp instance.

1.0.0

  • Initial version of w_transport: a fluent-style, platform-agnostic library with ready to use transport classes for sending and receiving data over HTTP.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'w_transport:1.0.1'
pubspec.yaml
name: w_transport
version: 1.0.1
description: A fluent-style, platform-agnostic library with ready to use transport classes for sending and receiving data over HTTP.
authors:
  - Workiva Client Platform Team <clientplatform@workiva.com>
  - Evan Weible <evan.weible@workiva.com>
  - Max Peterson <maxwell.peterson@workiva.com>
  - Trent Grover <trent.grover@workiva.com>
homepage: https://github.com/Workiva/w_transport
dependencies:
  fluri: '>=1.0.0 <2.0.0'
dev_dependencies:
  ansicolor: '>=0.0.9 <0.1.0'
  args: '>=0.12.1 <0.14.0'
  browser: any
  dart_style: '>=0.1.8 <0.2.0'
  http_server: '>=0.9.5+1 <0.10.0'
  mime: '>=0.9.3 <0.10.0'
  mockito: '>=0.9.0 <0.10.0'
  path: '>=1.3.5 <2.0.0'
  react: '>=0.6.1 <0.7.0'
  shelf: '>=0.6.1+1 <0.7.0'
  test: '>=0.12.0 <0.13.0'
  uuid: '>=0.5.0 <0.6.0'

Version history

VersionPublishedArchiveSHA-256
1.0.0Cached · Upstream SHA-256 matchedDownload3222509a…48163f
1.0.1Cached · Upstream SHA-256 matchedDownload61990825…beba17
2.0.0Cached · Upstream SHA-256 matchedDownload9feee6c4…603888
2.0.1Cached · Upstream SHA-256 matchedDownloade4e2b50c…0d9350
2.1.0Cached · Upstream SHA-256 matchedDownload7260654a…884f17
2.2.0Cached · Upstream SHA-256 matchedDownload4ae61525…d65b4c
2.3.0Cached · Upstream SHA-256 matchedDownload583a6dfc…551985
2.3.1Cached · Upstream SHA-256 matchedDownload3967a1b5…c7ac73
2.3.2Cached · Upstream SHA-256 matchedDownload9e27eab6…1f3234
2.4.0Cached · Upstream SHA-256 matchedDownload0f67474e…71d178
2.5.0Cached · Upstream SHA-256 matchedDownloadf6af8865…006367
2.5.1Cached · Upstream SHA-256 matchedDownload9ca77c16…a2d873
2.6.0Cached · Upstream SHA-256 matchedDownload3e9cbd47…f442d7
2.7.0Cached · Upstream SHA-256 matchedDownloada73e13da…699cd0
2.7.1Cached · Upstream SHA-256 matchedDownloadf118b095…ea407d
2.8.0Cached · Upstream SHA-256 matchedDownloadcf838cb2…1fe338
2.9.0Cached · Upstream SHA-256 matchedDownload4d05321f…b2484f
2.9.1Cached · Upstream SHA-256 matchedDownload59b61eb3…515e4b
2.9.2Cached · Upstream SHA-256 matchedDownload06c8d45c…a7cdff
2.9.3Cached · Upstream SHA-256 matchedDownload9895612e…2fa208
2.9.4Cached · Upstream SHA-256 matchedDownload8e091ae4…1a48ff
2.9.5Cached · Upstream SHA-256 matchedDownloada0b73bed…c1e587
2.9.6Cached · Upstream SHA-256 matchedDownload7bd284b3…b046d5
2.9.7Cached · Upstream SHA-256 matchedDownloadc2763f8a…2ddc04
2.9.9Cached · Upstream SHA-256 matchedDownloadd6f9e0fe…219616
2.10.0Cached · Upstream SHA-256 matchedDownloadbcd07a9e…92b057
2.10.1Cached · Upstream SHA-256 matchedDownload81b2d987…70550d
3.0.0Cached · Upstream SHA-256 matchedDownload081648c6…d90eb1
3.0.1Cached · Upstream SHA-256 matchedDownload6493e573…207c7a
3.0.2Cached · Upstream SHA-256 matchedDownload5c1a9b2d…184907
3.0.3Cached · Upstream SHA-256 matchedDownload06be9045…767b5b
3.0.4Cached · Upstream SHA-256 matchedDownloadd296a4cb…ab74cb
3.0.5Cached · Upstream SHA-256 matchedDownloadc9960ce4…8f6935
3.0.6Cached · Upstream SHA-256 matchedDownload45e36550…d27ad5
3.1.0Cached · Upstream SHA-256 matchedDownload7f5441f3…40d147
3.1.1Cached · Upstream SHA-256 matchedDownload07b35161…769311
3.1.2Cached · Upstream SHA-256 matchedDownloadcc86ffd7…8e9c53
3.2.0Cached · Upstream SHA-256 matchedDownloadfe9c0912…88d1ad
3.2.1Cached · Upstream SHA-256 matchedDownload551affe3…352520
3.2.2Cached · Upstream SHA-256 matchedDownload16e30166…8dc7f6
3.2.3Cached · Upstream SHA-256 matchedDownloadb7207793…fdde99
3.2.4Cached · Upstream SHA-256 matchedDownload77bc6424…d59de6
3.2.5Cached · Upstream SHA-256 matchedDownloadeaffc5ae…e20972
3.2.6Cached · Upstream SHA-256 matchedDownload054ad1b0…a72904
3.2.7Cached · Upstream SHA-256 matchedDownload365fb82c…3d17f7
3.2.8Cached · Upstream SHA-256 matchedDownload31aba39a…b85424
4.0.0Cached · Upstream SHA-256 matchedDownload4d1e129d…4f9781
4.0.1Cached · Upstream SHA-256 matchedDownload70a9a000…4635df
4.0.2Cached · Upstream SHA-256 matchedDownload24885a5a…95d3c3
4.0.8Cached · Upstream SHA-256 matchedDownload7d00d5da…575eae
4.0.9Cached · Upstream SHA-256 matchedDownloadddf5432f…956aed
4.1.0Cached · Upstream SHA-256 matchedDownloadc61dbd19…a2bc3b
4.1.3Cached · Upstream SHA-256 matchedDownloade8b7da8e…656a84
4.1.4Cached · Upstream SHA-256 matchedDownload32622c7e…f7076c
4.1.5Cached · Upstream SHA-256 matchedDownloada0f06d2a…18b134
4.1.6Cached · Upstream SHA-256 matchedDownload5845272c…9e7680
5.0.0Cached · Upstream SHA-256 matchedDownload889eddc5…e0c289
5.0.1Cached · Upstream SHA-256 matchedDownload06748571…bba3d5
5.1.0Cached · Upstream SHA-256 matchedDownload0e08fe2b…21792d
5.2.0Cached · Upstream SHA-256 matchedDownload4eefeb2f…670259
5.2.1Cached · Upstream SHA-256 matchedDownload6d17ee45…daff4b
5.2.2Cached · Upstream SHA-256 matchedDownloadba45d754…cd1a86
5.2.3Cached · Upstream SHA-256 matchedDownloadd0877828…08890d
5.3.0Cached · Upstream SHA-256 matchedDownloadc9292b40…4fea1d
5.4.0Cached · Upstream SHA-256 matchedDownload0657bf74…4374cb
5.4.1Cached · Upstream SHA-256 matchedDownload8cab1336…fbd35f
5.4.2Cached · Upstream SHA-256 matchedDownloadac876818…e3df57
5.4.3Cached · Upstream SHA-256 matchedDownloade5458f95…d95828
5.4.4Cached · Upstream SHA-256 matchedDownloadb2624cf0…938cd7

Dependencies

fluri "\u003e=1.0.0 \u003c2.0.0"