패키지, 저장소 및 앱 카테고리 검색

패키지 상세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
  • 경량이며 전송 계층에 집중

적합한 대상

  • 다중 플랫폼 플러터 앱을 개발하는 개발자
  • 장치 간에 일관된 네트워크 동작이 필요한 팀
  • 테스트 가능한 네트워크 코드가 필요한 프로젝트
  • 실시간 데이터 스트리밍 애플리케이션
  • 백엔드에 의존하지 않는 통신 계층

고려 사항

  • 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.