パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v5.4.4

w_transport

HTTPリクエストの送信とWebSocketの開設に使用するトランスポートライブラリ。プラットフォームに依存せず、ブラウザおよびDart VM(SockJSもサポート)を内蔵でサポートしています。テスト用のモックユーティリティも含まれています。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
3.2万
いいね数
3
Pub ポイント
125

パッケージをインストール

flutter pub add w_transport

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

w_transport は、Android、iOS、Web、macOS、Windows、Linux でスムーズに動作するように設計された、Dart 向けのプラットフォーム非依存の HTTP および WebSocket クライアントライブラリです。標準的な HTTP リクエストと WebSocket 接続をサポートし、ネイティブ WebSocket が利用できない環境では SockJS との組み込み互換性も提供しています。実際のネットワーク呼び出しを行わずにネットワーク動作をシミュレートできるモックユーティリティも含まれており、テストを簡単にできます。バックエンドサービスとの信頼性の高いクロスプラットフォーム通信が必要なアプリケーションに最適です。

用途

  • FlutterアプリからHTTPリクエストを送信する
  • ウェブおよびモバイルアプリでのWebSocket接続の確立
  • モック応答を使用したネットワークロジックのテスト
  • WebSocket を使用してリアルタイム機能を構築する
  • プラットフォーム間でポータブルなネットワーキングレイヤーを作成する

主な機能

  • クロスプラットフォームの HTTP および WebSocket サポート
  • ブラウザ用の組み込みSockJSフォールバック
  • ユニットテスト用のモックユーティリティ
  • すべてのプラットフォームで一貫した API
  • 軽量でトランスポート層に焦点を当てる

適している対象

  • マルチプラットフォームのFlutterアプリを開発する開発者
  • デバイス間で一貫したネットワーク動作を必要とするチーム
  • テスト可能なネットワークコードを必要とするプロジェクト
  • リアルタイムデータストリーミングアプリケーション
  • バックエンドに依存しない通信レイヤー

注意事項

  • HTTPおよびWebSocketプロトコルの理解が必要です
  • トランスポートレベルの機能のみ(シリアル化なし)
  • モックユーティリティはテスト専用であり、本番環境での使用はできません
  • キャッシュや認証をオールインワンで利用する必要がある複雑なRESTクライアントには適していません
  • JSONの解析またはリクエストのインターセプトに外部パッケージに依存しています

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

w_transport

Pub


Transport library for sending HTTP requests and opening WebSockets.

HTTP support includes plain-text, JSON, form-data, and multipart data, as well as custom encoding. Also supports automatic retrying and request & response interception.

WebSocket support includes native WebSockets in the browser and the VM with the option to use SockJS in the browser.

All transport classes are platform-independent and can be configured to work in the browser or on the Dart VM. Additionally, all transport classes can be mocked out and controlled through an API included with this library.


Docs & Help
Older Versions
Installing

As of version 3.0.0, w_transport will be following a versioning and stability commitment that guarantees a compatibility lifespan of two major versions.

If you're installing w_transport for the first time, simply depend on the latest major version and you'll get all patches and minor versions as they are released:

dependencies:
  w_transport: ^3.0.0

If you're upgrading from version 2.x, you can use the above version range without breaking any existing code. Check out the 3.0.0 upgrade guide.

Importing

The main entry point contains all of the transport classes necessary for sending HTTP requests and establishing WebSocket connections. It is also platform-independent (depends on neither dart:html nor dart:io), which means you can use it to build components, libraries, or APIs that will be reusable in the browser and on the Dart VM.

import 'package:w_transport/w_transport.dart' as transport;

We strongly recommend importing with the prefix transport because there are some classes whose names conflict with classes from the Dart SDK.

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

Dart SDK

As of version 3.0.0 of the w_transport package, the minimum required Dart SDK version is 1.14.0 (released Jan 28, 2016).

Versioning and Stability

This library follows semver to the best of our interpretation of it. We want this library to be a stable dependency that’s easy to keep current. A good explanation of the versioning scheme that we intend to follow can be seen here from React.js:

https://facebook.github.io/react/blog/2016/02/19/new-versioning-scheme.html

In short: our goal is for every major release to be backwards compatible with the previous major version, giving consumers a lifespan of two major versions to deal with deprecations.

Credits

This library was influenced in many ways by the http package, especially with regard to multipart requests, and served as a useful source for references to pertinent IETF RFCs.

Development

This project leverages the dart_dev package for most of its tooling needs, including static analysis, code formatting, running tests, collecting coverage, and serving examples. Check out the dart_dev readme for more information.

To run integration tests, you'll need two JS dependencies for a SockJS server. Run npm install to download them.

カテゴリー

依存関係

依存関係一覧 7 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。