Skip to content

Commit 154798c

Browse files
committed
bump 1.0.0 version for sound null safety.
1 parent 6b13a19 commit 154798c

10 files changed

+64
-84
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 1.0.0-nullsafety.0
1+
## 1.0.0
22

33
**New Feature:**
44

analysis_options.yaml

+9-8
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ analyzer:
77
# Lint rules and documentation, see http://dart-lang.github.io/linter/lints
88
linter:
99
rules:
10-
- cancel_subscriptions
11-
- close_sinks
12-
- hash_and_equals
13-
- iterable_contains_unrelated_type
14-
- list_remove_unrelated_type
15-
- test_types_in_equals
16-
- unrelated_type_equality_checks
17-
- valid_regexps
10+
unsafe_html: false
11+
cancel_subscriptions: true
12+
close_sinks: true
13+
hash_and_equals: true
14+
iterable_contains_unrelated_type: true
15+
list_remove_unrelated_type: true
16+
test_types_in_equals: true
17+
unrelated_type_equality_checks: true
18+
valid_regexps: true

lib/src/engine/socket.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ class Socket extends EventEmitter {
464464
break;
465465
}
466466
} else {
467-
_logger.fine('packet received with socket readyState "${readyState}"');
467+
_logger.fine('packet received with socket readyState "$readyState"');
468468
}
469469
}
470470

lib/src/engine/transport/jsonp_transport.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class JSONPTransport extends PollingTransport {
145145
if (form == null) {
146146
var form = document.createElement('form') as FormElement;
147147
var area = document.createElement('textarea') as TextAreaElement;
148-
var id = iframeId = 'eio_iframe_${index}';
148+
var id = iframeId = 'eio_iframe_$index';
149149

150150
form.className = 'socketio';
151151
form.style.position = 'absolute';

lib/src/engine/transport/polling_transport.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ abstract class PollingTransport extends Transport {
139139
if ('open' == readyState) {
140140
poll();
141141
} else {
142-
_logger.fine('ignoring poll - transport state "${readyState}"');
142+
_logger.fine('ignoring poll - transport state "$readyState"');
143143
}
144144
}
145145
}

lib/src/engine/transport/xhr_transport.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class Request extends EventEmitter {
160160
var self = this;
161161

162162
try {
163-
_logger.fine('xhr open ${method}: ${uri}');
163+
_logger.fine('xhr open $method: $uri');
164164
xhr.open(method, uri, async: async);
165165

166166
try {
@@ -233,7 +233,7 @@ class Request extends EventEmitter {
233233
});
234234
/*}*/
235235

236-
_logger.fine('xhr data ${data}');
236+
_logger.fine('xhr data $data');
237237
xhr.send(data);
238238
} catch (e) {
239239
// Need to defer since .create() is called directly fhrom the constructor

lib/src/manager.dart

+31-48
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,34 @@ class Manager extends EventEmitter {
2727
List subs = [];
2828
late Map options;
2929

30-
bool? _reconnection;
31-
num? _reconnectionAttempts;
32-
num? _reconnectionDelay;
30+
///
31+
/// Sets the `reconnection` config.
32+
///
33+
/// @param {Boolean} true/false if it should automatically reconnect
34+
/// @return {Manager} self or value
35+
/// @api public
36+
///
37+
bool? reconnection;
38+
39+
///
40+
/// Sets the reconnection attempts config.
41+
///
42+
/// @param {Number} max reconnection attempts before giving up
43+
/// @return {Manager} self or value
44+
/// @api public
45+
///
46+
num? reconnectionAttempts;
47+
num? reconnectionDelay;
3348
num? _randomizationFactor;
3449
num? _reconnectionDelayMax;
35-
num? _timeout;
50+
51+
///
52+
/// Sets the connection timeout. `false` to disable
53+
///
54+
/// @return {Manager} self or value
55+
/// @api public
56+
///
57+
num? timeout;
3658
_Backoff? backoff;
3759
String readyState = 'closed';
3860
late String uri;
@@ -103,36 +125,6 @@ class Manager extends EventEmitter {
103125
return (nsp.isEmpty ? '' : (nsp + '#')) + (engine.id ?? '');
104126
}
105127

106-
///
107-
/// Sets the `reconnection` config.
108-
///
109-
/// @param {Boolean} true/false if it should automatically reconnect
110-
/// @return {Manager} self or value
111-
/// @api public
112-
///
113-
bool? get reconnection => _reconnection;
114-
set reconnection(bool? v) => _reconnection = v;
115-
116-
///
117-
/// Sets the reconnection attempts config.
118-
///
119-
/// @param {Number} max reconnection attempts before giving up
120-
/// @return {Manager} self or value
121-
/// @api public
122-
///
123-
num? get reconnectionAttempts => _reconnectionAttempts;
124-
set reconnectionAttempts(num? v) => _reconnectionAttempts = v;
125-
126-
///
127-
/// Sets the delay between reconnections.
128-
///
129-
/// @param {Number} delay
130-
/// @return {Manager} self or value
131-
/// @api public
132-
///
133-
num? get reconnectionDelay => _reconnectionDelay;
134-
set reconnectionDelay(num? v) => _reconnectionDelay = v;
135-
136128
num? get randomizationFactor => _randomizationFactor;
137129
set randomizationFactor(num? v) {
138130
_randomizationFactor = v;
@@ -152,15 +144,6 @@ class Manager extends EventEmitter {
152144
backoff?.max = v;
153145
}
154146

155-
///
156-
/// Sets the connection timeout. `false` to disable
157-
///
158-
/// @return {Manager} self or value
159-
/// @api public
160-
///
161-
num? get timeout => _timeout;
162-
set timeout(num? v) => _timeout = v;
163-
164147
///
165148
/// Starts trying to reconnect if reconnection is enabled and we have not
166149
/// started reconnecting yet
@@ -169,7 +152,7 @@ class Manager extends EventEmitter {
169152
///
170153
void maybeReconnectOnOpen() {
171154
// Only try to reconnect if it's the first time we're connecting
172-
if (!reconnecting && _reconnection == true && backoff!.attempts == 0) {
155+
if (!reconnecting && reconnection == true && backoff!.attempts == 0) {
173156
// keeps reconnection from firing twice for the same reconnection loop
174157
reconnect();
175158
}
@@ -216,8 +199,8 @@ class Manager extends EventEmitter {
216199
});
217200

218201
// emit `connect_timeout`
219-
if (_timeout != null) {
220-
var timeout = _timeout!;
202+
var timeout = this.timeout;
203+
if (timeout != null) {
221204
_logger.fine('connect attempt will timeout after $timeout');
222205

223206
// set timer
@@ -450,7 +433,7 @@ class Manager extends EventEmitter {
450433
readyState = 'closed';
451434
emit('close', error['reason']);
452435

453-
if (_reconnection == true && !skipReconnect!) {
436+
if (reconnection == true && !skipReconnect!) {
454437
reconnect();
455438
}
456439
}
@@ -463,7 +446,7 @@ class Manager extends EventEmitter {
463446
Manager reconnect() {
464447
if (reconnecting || skipReconnect!) return this;
465448

466-
if (backoff!.attempts >= _reconnectionAttempts!) {
449+
if (backoff!.attempts >= reconnectionAttempts!) {
467450
_logger.fine('reconnect failed');
468451
backoff!.reset();
469452
emitAll('reconnect_failed');

lib/src/socket.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class Socket extends EventEmitter {
155155
// event ack callback
156156
if (ack != null) {
157157
_logger.fine('emitting packet with ack id $ids');
158-
acks['${ids}'] = ack;
158+
acks['$ids'] = ack;
159159
packet['id'] = '${ids++}';
160160
}
161161

@@ -354,7 +354,7 @@ class Socket extends EventEmitter {
354354
///
355355
/// @api private
356356
void ondisconnect() {
357-
_logger.fine('server disconnect (${nsp})');
357+
_logger.fine('server disconnect ($nsp)');
358358
destroy();
359359
onclose('io server disconnect');
360360
}
@@ -387,7 +387,7 @@ class Socket extends EventEmitter {
387387

388388
Socket disconnect() {
389389
if (connected == true) {
390-
_logger.fine('performing disconnect (${nsp})');
390+
_logger.fine('performing disconnect ($nsp)');
391391
packet({'type': DISCONNECT});
392392
}
393393

pubspec.yaml

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
name: socket_io_client
22
description: Dartlang port of socket.io-client for web, flutter, dartvm to use
3-
version: 1.0.0-nullsafety.0
3+
version: 1.0.0
44
homepage: https://www.zkoss.org
55
repository: https://github.com/rikulo/socket.io-client-dart
66
issue_tracker: https://github.com/rikulo/socket.io-client-dart/issues
77

88
environment:
9-
sdk: '>=2.12.0-0 <3.0.0'
9+
sdk: '>=2.12.0 <3.0.0'
1010

1111
dependencies:
12-
socket_io_common: '^1.0.0-nullsafety.1'
13-
js: '^0.6.3-nullsafety.3'
14-
logging: '^1.0.0-nullsafety.0'
12+
socket_io_common: '^1.0.0'
13+
js: '^0.6.3'
14+
logging: '^1.0.1'
1515

16-
dependency_overrides:
17-
logging: '^1.0.0-nullsafety.0'
1816

1917
dev_dependencies:
2018
socket_io: any

test/server.dart

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
/**
2-
* server.dart
3-
*
4-
* Purpose:
5-
*
6-
* Description:
7-
*
8-
* History:
9-
* 26/07/2017, Created by jumperchen
10-
*
11-
* Copyright (C) 2017 Potix Corporation. All Rights Reserved.
12-
*/
1+
/// server.dart
2+
///
3+
/// Purpose:
4+
///
5+
/// Description:
6+
///
7+
/// History:
8+
/// 26/07/2017, Created by jumperchen
9+
///
10+
/// Copyright (C) 2017 Potix Corporation. All Rights Reserved.
1311
import 'package:socket_io/socket_io.dart';
1412

1513
void main() {

0 commit comments

Comments
 (0)