Viewing version 1.0.0. Open the latest package page.
w_transport
1.0.0A fluent-style, platform-agnostic library with ready to use transport classes for sending and receiving data over HTTP.
Readme
w_transport Build Status
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 (
withCredentialsflag - 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
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'w_transport:1.0.0'pubspec.yaml
name: w_transport
version: 1.0.0
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
coverage:
git:
url: https://github.com/ekweible/coverage.git
ref: 796a265
dart_codecov_generator:
git:
url: https://github.com/ekweible/dart_codecov_generator.git
ref: 0.3.0
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
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 1.0.0 | Cached · Upstream SHA-256 matched | Download | 3222509a…48163f |
| 1.0.1 | Cached · Upstream SHA-256 matched | Download | 61990825…beba17 |
| 2.0.0 | Cached · Upstream SHA-256 matched | Download | 9feee6c4…603888 |
| 2.0.1 | Cached · Upstream SHA-256 matched | Download | e4e2b50c…0d9350 |
| 2.1.0 | Cached · Upstream SHA-256 matched | Download | 7260654a…884f17 |
| 2.2.0 | Cached · Upstream SHA-256 matched | Download | 4ae61525…d65b4c |
| 2.3.0 | Cached · Upstream SHA-256 matched | Download | 583a6dfc…551985 |
| 2.3.1 | Cached · Upstream SHA-256 matched | Download | 3967a1b5…c7ac73 |
| 2.3.2 | Cached · Upstream SHA-256 matched | Download | 9e27eab6…1f3234 |
| 2.4.0 | Cached · Upstream SHA-256 matched | Download | 0f67474e…71d178 |
| 2.5.0 | Cached · Upstream SHA-256 matched | Download | f6af8865…006367 |
| 2.5.1 | Cached · Upstream SHA-256 matched | Download | 9ca77c16…a2d873 |
| 2.6.0 | Cached · Upstream SHA-256 matched | Download | 3e9cbd47…f442d7 |
| 2.7.0 | Cached · Upstream SHA-256 matched | Download | a73e13da…699cd0 |
| 2.7.1 | Cached · Upstream SHA-256 matched | Download | f118b095…ea407d |
| 2.8.0 | Cached · Upstream SHA-256 matched | Download | cf838cb2…1fe338 |
| 2.9.0 | Cached · Upstream SHA-256 matched | Download | 4d05321f…b2484f |
| 2.9.1 | Cached · Upstream SHA-256 matched | Download | 59b61eb3…515e4b |
| 2.9.2 | Cached · Upstream SHA-256 matched | Download | 06c8d45c…a7cdff |
| 2.9.3 | Cached · Upstream SHA-256 matched | Download | 9895612e…2fa208 |
| 2.9.4 | Cached · Upstream SHA-256 matched | Download | 8e091ae4…1a48ff |
| 2.9.5 | Cached · Upstream SHA-256 matched | Download | a0b73bed…c1e587 |
| 2.9.6 | Cached · Upstream SHA-256 matched | Download | 7bd284b3…b046d5 |
| 2.9.7 | Cached · Upstream SHA-256 matched | Download | c2763f8a…2ddc04 |
| 2.9.9 | Cached · Upstream SHA-256 matched | Download | d6f9e0fe…219616 |
| 2.10.0 | Cached · Upstream SHA-256 matched | Download | bcd07a9e…92b057 |
| 2.10.1 | Cached · Upstream SHA-256 matched | Download | 81b2d987…70550d |
| 3.0.0 | Cached · Upstream SHA-256 matched | Download | 081648c6…d90eb1 |
| 3.0.1 | Cached · Upstream SHA-256 matched | Download | 6493e573…207c7a |
| 3.0.2 | Cached · Upstream SHA-256 matched | Download | 5c1a9b2d…184907 |
| 3.0.3 | Cached · Upstream SHA-256 matched | Download | 06be9045…767b5b |
| 3.0.4 | Cached · Upstream SHA-256 matched | Download | d296a4cb…ab74cb |
| 3.0.5 | Cached · Upstream SHA-256 matched | Download | c9960ce4…8f6935 |
| 3.0.6 | Cached · Upstream SHA-256 matched | Download | 45e36550…d27ad5 |
| 3.1.0 | Cached · Upstream SHA-256 matched | Download | 7f5441f3…40d147 |
| 3.1.1 | Cached · Upstream SHA-256 matched | Download | 07b35161…769311 |
| 3.1.2 | Cached · Upstream SHA-256 matched | Download | cc86ffd7…8e9c53 |
| 3.2.0 | Cached · Upstream SHA-256 matched | Download | fe9c0912…88d1ad |
| 3.2.1 | Cached · Upstream SHA-256 matched | Download | 551affe3…352520 |
| 3.2.2 | Cached · Upstream SHA-256 matched | Download | 16e30166…8dc7f6 |
| 3.2.3 | Cached · Upstream SHA-256 matched | Download | b7207793…fdde99 |
| 3.2.4 | Cached · Upstream SHA-256 matched | Download | 77bc6424…d59de6 |
| 3.2.5 | Cached · Upstream SHA-256 matched | Download | eaffc5ae…e20972 |
| 3.2.6 | Cached · Upstream SHA-256 matched | Download | 054ad1b0…a72904 |
| 3.2.7 | Cached · Upstream SHA-256 matched | Download | 365fb82c…3d17f7 |
| 3.2.8 | Cached · Upstream SHA-256 matched | Download | 31aba39a…b85424 |
| 4.0.0 | Cached · Upstream SHA-256 matched | Download | 4d1e129d…4f9781 |
| 4.0.1 | Cached · Upstream SHA-256 matched | Download | 70a9a000…4635df |
| 4.0.2 | Cached · Upstream SHA-256 matched | Download | 24885a5a…95d3c3 |
| 4.0.8 | Cached · Upstream SHA-256 matched | Download | 7d00d5da…575eae |
| 4.0.9 | Cached · Upstream SHA-256 matched | Download | ddf5432f…956aed |
| 4.1.0 | Cached · Upstream SHA-256 matched | Download | c61dbd19…a2bc3b |
| 4.1.3 | Cached · Upstream SHA-256 matched | Download | e8b7da8e…656a84 |
| 4.1.4 | Cached · Upstream SHA-256 matched | Download | 32622c7e…f7076c |
| 4.1.5 | Cached · Upstream SHA-256 matched | Download | a0f06d2a…18b134 |
| 4.1.6 | Cached · Upstream SHA-256 matched | Download | 5845272c…9e7680 |
| 5.0.0 | Cached · Upstream SHA-256 matched | Download | 889eddc5…e0c289 |
| 5.0.1 | Cached · Upstream SHA-256 matched | Download | 06748571…bba3d5 |
| 5.1.0 | Cached · Upstream SHA-256 matched | Download | 0e08fe2b…21792d |
| 5.2.0 | Cached · Upstream SHA-256 matched | Download | 4eefeb2f…670259 |
| 5.2.1 | Cached · Upstream SHA-256 matched | Download | 6d17ee45…daff4b |
| 5.2.2 | Cached · Upstream SHA-256 matched | Download | ba45d754…cd1a86 |
| 5.2.3 | Cached · Upstream SHA-256 matched | Download | d0877828…08890d |
| 5.3.0 | Cached · Upstream SHA-256 matched | Download | c9292b40…4fea1d |
| 5.4.0 | Cached · Upstream SHA-256 matched | Download | 0657bf74…4374cb |
| 5.4.1 | Cached · Upstream SHA-256 matched | Download | 8cab1336…fbd35f |
| 5.4.2 | Cached · Upstream SHA-256 matched | Download | ac876818…e3df57 |
| 5.4.3 | Cached · Upstream SHA-256 matched | Download | e5458f95…d95828 |
| 5.4.4 | Cached · Upstream SHA-256 matched | Download | b2624cf0…938cd7 |
Dependencies
fluri "\u003e=1.0.0 \u003c2.0.0"