Pakete, Repositories und App-Kategorien suchen

Paketdetailsv5.4.4

w_transport

Transportbibliothek zum Senden von HTTP-Anfragen und Öffnen von WebSockets. Plattformunabhängig mit integriertem Support für Browser und Dart VM (auch SockJS wird unterstützt). Enthält Mock-Utilities für Tests.

AndroidiOSWebmacOSWindowsLinux
30-Tage-Downloads
32.400
Likes
3
Pub-Punkte
125

Paket installieren

flutter pub add w_transport

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

w_transport ist eine plattformunabhängige HTTP- und WebSocket-Clientsbibliothek für Dart, die nahtlos auf Android, iOS, Web, macOS, Windows und Linux funktioniert. Sie unterstützt Standard-HTTP-Anfragen und WebSocket-Verbindungen und bietet integrierte Kompatibilität mit SockJS in Umgebungen, in denen native WebSockets nicht verfügbar sind. Die Bibliothek enthält Mock-Tools, die das Testen vereinfachen, indem Entwickler Netzwerkverhalten simulieren können, ohne echte Netzwerkaufrufe durchzuführen. Ideal für Anwendungen, die zuverlässige, plattformübergreifende Kommunikation mit Backend-Diensten erfordern.

Anwendungsfälle

  • HTTP-Anfragen von Flutter-Apps senden
  • Herstellen von WebSocket-Verbindungen in Web- und Mobilanwendungen
  • Testen der Netzwerklogik mit Mock-Antworten
  • Echtzeitfunktionen mit WebSockets erstellen
  • Portierbare Netzwerkschichten über Plattformen hinweg erstellen

Hauptmerkmale

  • Plattformübergreifender HTTP- und WebSocket-Unterstützung
  • Eingebaute SockJS-Fallback für Browser
  • Mock-Utilities für die Einheitstests
  • Konsistente API auf allen Plattformen
  • Leichtgewichtig und auf die Transportebene fokussiert

Geeignet für

  • Entwickler, die Multiplattform-Flutter-Anwendungen erstellen
  • Teams, die konsistentes Netzwerkverhalten über Geräte hinweg benötigen
  • Projekte, die testbaren Netzwerkcode erfordern
  • Echtzeit-Datenstrom-Anwendungen
  • Backend-unabhängige Kommunikationsschichten

Hinweise

  • Erfordert Verständnis der HTTP- und WebSocket-Protokolle
  • Beschränkt auf Transportebenen-Funktionalität (keine Serialisierung)
  • Mock-Utilities sind nur für Tests gedacht, nicht für den Produktiveinsatz
  • Nicht geeignet für komplexe REST-Clients mit Caching oder Authentifizierung out-of-the-box
  • Abhängig von externen Paketen für die JSON-Analyse oder Anfrage-Abschaltung

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

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.

Kategorien

Abhängigkeiten

Abhängigkeiten 7 Einträge

Quell-Repository

Projekte, die dieses Paket verwenden

Noch keine Daten verfügbar.