Skip to content

Latest commit

 

History

History
148 lines (103 loc) · 3.82 KB

v3.0.0.md

File metadata and controls

148 lines (103 loc) · 3.82 KB

Upgrade Guide: v2.x to v3.0.0

The 3.0.0 release of w_transport is intended to be completely backwards-compatible with version 2. If you are already on version >=2.0.0, you can update the version range to the 3.x line without having to make any code changes:

dependencies:
  w_transport: ^3.0.0

If you have any issues or find any breaking changes while upgrading from v2.x to v3.0.0, this is a bug and should be fixed - please file an issue.

Dart SDK

The minimum Dart SDK version has been raised to 1.14.0.

Deprecations

Library Entry Points

The entry point filenames (excluding the main w_transport.dart) have been shortened. The old entry points have been deprecated and will be removed in version 4. Until then, they will continue to function as expected.

  • w_transport_browser.dart --> browser.dart

    - import 'package:w_transport/w_transport_browser.dart';
    + import 'package:w_transport/browser.dart';
  • w_transport_mock.dart --> mock.dart

    - import 'package:w_transport/w_transport_mock.dart';
    + import 'package:w_transport/mock.dart';
  • w_transport_vm.dart --> vm.dart

    - import 'package:w_transport/w_transport_vm.dart';
    + import 'package:w_transport/vm.dart';

Renames

The following public API members have been renamed. In order to maintain backwards compatibility, the old versions will remain (in a deprecated state) and will continue to function as expected until version 4.

  • Client --> HttpClient

    (entry point: w_transport/w_transport.dart)

    - new Client();
    + new HttpClient();
  • WSocket --> WebSocket

    (entry point: w_transport/w_transport.dart)

    - WSocket.connect(...);
    + WebSocket.connect(...);
  • WSocketException --> WebSocketException

    (entry point: w_transport/w_transport.dart)

    try {
      await WebSocket.connect(...);
    - } on WSocketException {
    + } on WebSocketException {
      // Handle connection failure.
    }
  • RetryBackOff.duration --> RetryBackOff.interval

    (entry point: w_transport/w_transport.dart)

    This will not affect most consumers as the properties on RetryBackOff are most likely only read by internal w_transport code.

    final backOff = const RetryBackOff.fixed(const Duration(seconds: 5));
    - print(backOff.duration);
    + print(backOff.interval);

Future Removals

The following public API members have been deprecated in anticipation of them being removed in version 4.

  • WSocketCloseEvent

    (entry point: w_transport/w_transport.dart)

    This was previously only used internally, but was erroneously exported as a part of the public API. It is no longer used at all, and has thus been deprecated and will be removed in version 4.

  • Unnecessary mock classes:

    • MockBaseRequest
    • MockClient
    • MockFormRequest
    • MockJsonRequest
    • MockPlainTextRequest
    • MockResponse
    • MockStreamedRequest
    • MockStreamedResponse
    • MockWSocket

    (entry point: w_transport/mock.dart)

    All of these classes were exposed prior to the full transport mocks API being available. They provided a way to control mock instances of requests and WebSockets, but it required having access to the instances (which isn't always possible) and required type checks/casts. They will be removed in version 4.

    If you were constructing any of these classes, the correct way to update your usage is to first install the mock transports, and then construct the corresponding class from the main w_transport.dart entry point.

    + MockTransports.install();
    
    - new MockClient();
    + new transport.HttpClient();
    
    - new MockJsonRequest();
    + new transport.JsonRequest();
    
    // etc