Skip to content

Commit

Permalink
Remove nodoc
Browse files Browse the repository at this point in the history
  • Loading branch information
PlugFox committed Feb 24, 2024
1 parent 0e3a1c4 commit 5dd71e7
Show file tree
Hide file tree
Showing 14 changed files with 1 addition and 100 deletions.
2 changes: 0 additions & 2 deletions lib/src/client/message_stream.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import 'dart:async';
import 'dart:convert';

/// {@nodoc}
final Converter<String, Map<String, Object?>> _$jsonTextDecoder =
const JsonDecoder().cast<String, Map<String, Object?>>();

/// {@nodoc}
final Converter<List<int>, Map<String, Object?>> _$jsonBytesDecoder =
const Utf8Decoder().fuse<Map<String, Object?>>(
const JsonDecoder().cast<String, Map<String, Object?>>());
Expand Down
1 change: 0 additions & 1 deletion lib/src/client/ws_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ final class WebSocketClient implements IWebSocketClient {
WebSocketConnectionManager(this);

/// Current options.
/// {@nodoc}
final WebSocketOptions _options;

@override
Expand Down
11 changes: 0 additions & 11 deletions lib/src/client/ws_client_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import 'package:ws/src/client/ws_interceptor.dart';
import 'package:ws/src/util/constants.dart';
import 'package:ws/src/util/logger.dart';

/// {@nodoc}
@internal
abstract base class WebSocketClientBase implements IWebSocketClient {
/// {@nodoc}
WebSocketClientBase({
Iterable<String>? protocols,
Iterable<WSInterceptor>? interceptors,
Expand All @@ -36,7 +34,6 @@ abstract base class WebSocketClientBase implements IWebSocketClient {
bool get isClosed => _isClosed; // coverage:ignore-line
bool _isClosed = false;

/// {@nodoc}
@protected
final List<String>? protocols;

Expand All @@ -47,7 +44,6 @@ abstract base class WebSocketClientBase implements IWebSocketClient {
late final void Function(Object data) _onReceivedDataChain;

/// Output stream of data from native WebSocket client.
/// {@nodoc}
@protected
final StreamController<Object> _dataController;

Expand All @@ -56,15 +52,13 @@ abstract base class WebSocketClientBase implements IWebSocketClient {
WebSocketMessagesStream(_dataController.stream);

/// Current ready state of the WebSocket connection.
/// {@nodoc}
abstract final WebSocketReadyState readyState;

@override
WebSocketClientState get state => _state;
WebSocketClientState _state;

/// Output stream of state changes.
/// {@nodoc}
@protected
final StreamController<WebSocketClientState> _stateController;

Expand Down Expand Up @@ -111,7 +105,6 @@ abstract base class WebSocketClientBase implements IWebSocketClient {
_stateController.close().ignore();
}

/// {@nodoc}
@protected
void setState(
WebSocketClientState Function(WebSocketClientState state) change) {
Expand All @@ -121,21 +114,18 @@ abstract base class WebSocketClientBase implements IWebSocketClient {
info('WebSocketClient state changed to $newState');
}

/// {@nodoc}
@protected
void onConnected(String url) {
setState((_) => WebSocketClientState.open(url: url));
}

/// On data received callback.
/// {@nodoc}
@protected
void onReceivedData(Object? data) {
if (data == null) return;
_onReceivedDataChain(data);
}

/// {@nodoc}
@protected
void onDisconnected(int? code, String? reason) {
setState((_) => WebSocketClientState.closed(
Expand All @@ -145,7 +135,6 @@ abstract base class WebSocketClientBase implements IWebSocketClient {
}

/// Error callback.
/// {@nodoc}
@protected
void onError(Object error, StackTrace stackTrace) {}

Expand Down
2 changes: 0 additions & 2 deletions lib/src/client/ws_client_fake.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:ws/src/client/ws_client_interface.dart';
import 'package:ws/src/client/ws_options.dart';

// coverage:ignore-start
/// {@nodoc}
@internal
IWebSocketClient $platformWebSocketClient(WebSocketOptions? options) =>
WebSocketClientFake(protocols: options?.protocols);
Expand All @@ -29,7 +28,6 @@ final class WebSocketClientFake implements IWebSocketClient {
_isClosed = false,
_state = WebSocketClientState.initial();

/// {@nodoc}
@visibleForTesting
final List<String>? protocols;

Expand Down
14 changes: 0 additions & 14 deletions lib/src/client/ws_client_js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:ws/src/client/ws_options.dart';
import 'package:ws/src/client/ws_options_js.dart';
import 'package:ws/src/util/logger.dart';

/// {@nodoc}
@internal
IWebSocketClient $platformWebSocketClient(WebSocketOptions? options) =>
switch (options) {
Expand All @@ -36,42 +35,33 @@ IWebSocketClient $platformWebSocketClient(WebSocketOptions? options) =>
),
};

/// {@nodoc}
@internal
final class WebSocketClient$JS extends WebSocketClientBase {
/// {@nodoc}
WebSocketClient$JS({
super.interceptors,
super.protocols,
$WebSocketOptions$JS? options,
}) : _options = options;

/// {@nodoc}
final $WebSocketOptions$JS? _options;

/// Native WebSocket client.
/// {@nodoc}
html.WebSocket? _client;

/// Blob codec for `Blob <-> List<int>` conversion.
/// {@nodoc}
late final _BlobCodec _blobCodec = _BlobCodec();

/// Binding to data from native WebSocket client.
/// The subscription of [_communication] to [_controller].
/// {@nodoc}
StreamSubscription<Object?>? _dataBindSubscription;

/// Binding to error from native WebSocket client.
/// {@nodoc}
StreamSubscription<html.Event>? _errorBindSubscription;

/// Binding to close event from native WebSocket client.
/// {@nodoc}
StreamSubscription<html.CloseEvent>? _closeBindSubscription;

/// Ready state of the WebSocket client.
/// {@nodoc}
@override
WebSocketReadyState get readyState {
final code = _client?.readyState;
Expand Down Expand Up @@ -211,12 +201,9 @@ final class WebSocketClient$JS extends WebSocketClientBase {
}
}

/// {@nodoc}
final class _BlobCodec {
/// {@nodoc}
_BlobCodec();

/// {@nodoc}
@internal
html.Blob write(Object data) {
switch (data) {
Expand All @@ -239,7 +226,6 @@ final class _BlobCodec {
}
}

/// {@nodoc}
@internal
FutureOr<Object> read(html.Blob blob) async {
final completer = Completer<Object>();
Expand Down
6 changes: 0 additions & 6 deletions lib/src/client/ws_client_vm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import 'package:ws/src/client/ws_options.dart';
import 'package:ws/src/client/ws_options_vm.dart';
import 'package:ws/src/util/logger.dart';

/// {@nodoc}
@internal
IWebSocketClient $platformWebSocketClient(WebSocketOptions? options) =>
switch (options) {
Expand All @@ -34,28 +33,23 @@ IWebSocketClient $platformWebSocketClient(WebSocketOptions? options) =>
),
};

/// {@nodoc}
@internal
final class WebSocketClient$VM extends WebSocketClientBase {
/// {@nodoc}
WebSocketClient$VM({
super.interceptors,
super.protocols,
$WebSocketOptions$VM? options,
}) : _options = options;

/// {@nodoc}
final $WebSocketOptions$VM? _options;

/// Native WebSocket client.
/// {@nodoc}
// Close it at a [disconnect] or [close] method.
// ignore: close_sinks
io.WebSocket? _client;

/// Binding to data from native WebSocket client.
/// The subscription of [_communication] to [_controller].
/// {@nodoc}
StreamSubscription<Object?>? _dataBindSubscription;

@override
Expand Down
2 changes: 0 additions & 2 deletions lib/src/client/ws_options_common.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import 'package:meta/meta.dart';
import 'package:ws/src/client/ws_options.dart';

/// {@nodoc}
@internal
final class $WebSocketOptions$Common extends WebSocketOptions {
/// {@nodoc}
$WebSocketOptions$Common({
super.connectionRetryInterval,
super.protocols,
Expand Down
5 changes: 0 additions & 5 deletions lib/src/client/ws_options_js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:ws/src/client/ws_client_interface.dart';
import 'package:ws/src/client/ws_interceptor.dart';
import 'package:ws/src/client/ws_options.dart';

/// {@nodoc}
@internal
WebSocketOptions $vmOptions({
ConnectionRetryInterval? connectionRetryInterval,
Expand All @@ -30,7 +29,6 @@ WebSocketOptions $vmOptions({
);
}

/// {@nodoc}
@internal
WebSocketOptions $jsOptions({
ConnectionRetryInterval? connectionRetryInterval,
Expand All @@ -49,15 +47,13 @@ WebSocketOptions $jsOptions({
interceptors: interceptors,
);

/// {@nodoc}
@internal
WebSocketOptions $selectorOptions({
required WebSocketOptions Function() vm,
required WebSocketOptions Function() js,
}) =>
js();

/// {@nodoc}
final class $WebSocketOptions$JS extends WebSocketOptions {
/// {@macro ws_options_js}
$WebSocketOptions$JS({
Expand All @@ -69,6 +65,5 @@ final class $WebSocketOptions$JS extends WebSocketOptions {
bool? useBlobForBinary,
}) : useBlobForBinary = useBlobForBinary ?? false;

/// {@nodoc}
final bool useBlobForBinary;
}
5 changes: 0 additions & 5 deletions lib/src/client/ws_options_vm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:ws/src/client/ws_client_interface.dart';
import 'package:ws/src/client/ws_interceptor.dart';
import 'package:ws/src/client/ws_options.dart';

/// {@nodoc}
@internal
WebSocketOptions $vmOptions({
ConnectionRetryInterval? connectionRetryInterval,
Expand Down Expand Up @@ -39,7 +38,6 @@ WebSocketOptions $vmOptions({

// coverage:ignore-start

/// {@nodoc}
@internal
WebSocketOptions $jsOptions({
ConnectionRetryInterval? connectionRetryInterval,
Expand All @@ -61,18 +59,15 @@ WebSocketOptions $jsOptions({

// coverage:ignore-end

/// {@nodoc}
@internal
WebSocketOptions $selectorOptions({
required WebSocketOptions Function() vm,
required WebSocketOptions Function() js,
}) =>
vm();

/// {@nodoc}
@internal
final class $WebSocketOptions$VM extends WebSocketOptions {
/// {@nodoc}
$WebSocketOptions$VM({
super.connectionRetryInterval,
super.protocols,
Expand Down
13 changes: 0 additions & 13 deletions lib/src/manager/connection_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,22 @@ import 'package:ws/src/client/state.dart';
import 'package:ws/src/client/ws_client_interface.dart';
import 'package:ws/src/util/logger.dart';

/// {@nodoc}
@internal
final class WebSocketConnectionManager {
/// {@nodoc}
WebSocketConnectionManager(IWebSocketClient client)
: _client = WeakReference<IWebSocketClient>(client);

/// {@nodoc}
final WeakReference<IWebSocketClient> _client;

/// {@nodoc}
StreamSubscription<void>? _watcher;

/// {@nodoc}
Timer? _timer;

/// {@nodoc}
int? _attempt;

/// {@nodoc}
DateTime? _nextReconnectionAttempt;

/// Recive the current status of reconnection for the client.
/// {@nodoc}
({
int attempt,
bool active,
Expand All @@ -40,7 +32,6 @@ final class WebSocketConnectionManager {
nextReconnectionAttempt: _nextReconnectionAttempt,
);

/// {@nodoc}
void startMonitoringConnection(
String url,
({Duration max, Duration min})? connectionRetryInterval,
Expand All @@ -60,13 +51,11 @@ final class WebSocketConnectionManager {
client.stateChanges.listen(stateChangesHandler, cancelOnError: false);
}

/// {@nodoc}
void stopMonitoringConnection() {
_stopSubscription();
_stopTimer();
}

/// {@nodoc}
void Function(WebSocketClientState state) _handleStateChange(
IWebSocketClient client,
String lastUrl,
Expand Down Expand Up @@ -125,7 +114,6 @@ final class WebSocketConnectionManager {

/// Full jitter technique.
/// https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
/// {@nodoc}
@internal
static Duration backoffDelay(int step, int minDelay, int maxDelay) {
if (minDelay >= maxDelay) return Duration(milliseconds: maxDelay);
Expand All @@ -135,6 +123,5 @@ final class WebSocketConnectionManager {
}

/// Randomizer for full jitter technique.
/// {@nodoc}
static final math.Random _rnd = math.Random();
}
Loading

0 comments on commit 5dd71e7

Please sign in to comment.