Skip to content

Commit e95cd68

Browse files
committed
chore: fix dart and flutter analysis errors
1 parent ff6eb83 commit e95cd68

File tree

10 files changed

+17
-15
lines changed

10 files changed

+17
-15
lines changed

templates/dart/base/requests/oauth.twig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
params.forEach((key, value) {
1717
if (value is List) {
1818
for (var item in value) {
19-
query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item));
19+
query.add(
20+
'${Uri.encodeComponent('$key[]')}=${Uri.encodeComponent(item)}');
2021
}
2122
} else if (value != null) {
22-
query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value));
23+
query.add('${Uri.encodeComponent(key)}=${Uri.encodeComponent(value)}');
2324
}
2425
});
2526

templates/dart/lib/query.dart.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Query {
66
final String? attribute;
77
final dynamic values;
88

9-
Query._(this.method, [this.attribute = null, this.values = null]);
9+
Query._(this.method, [this.attribute, this.values]);
1010

1111
Map<String, dynamic> toJson() {
1212
final result = <String, dynamic>{};

templates/dart/lib/src/client.dart.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ abstract class Client {
4242
///
4343
/// {{header.description}}
4444
{% endif %}
45-
Client set{{header.key | caseUcfirst}}(value);
45+
Client set{{header.key | caseUcfirst}}(String value);
4646

4747
{% endfor %}
4848
/// Add headers that should be sent with all API calls.

templates/dart/lib/src/client_mixin.dart.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mixin ClientMixin {
4545
return MapEntry(key, value.toString());
4646
}
4747
if (value is List) {
48-
return MapEntry(key + "[]", value);
48+
return MapEntry("$key[]", value);
4949
}
5050
return MapEntry(key, value);
5151
});

templates/flutter/base/requests/oauth.twig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
params.forEach((key, value) {
1717
if (value is List) {
1818
for (var item in value) {
19-
query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item));
19+
query.add(
20+
'${Uri.encodeComponent('$key[]')}=${Uri.encodeComponent(item)}');
2021
}
2122
} else if(value != null) {
22-
query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value));
23+
query.add('${Uri.encodeComponent(key)}=${Uri.encodeComponent(value)}');
2324
}
2425
});
2526

templates/flutter/lib/src/client.dart.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ abstract class Client {
6161
///
6262
/// {{header.description}}.
6363
{% endif %}
64-
Client set{{header.key | caseUcfirst}}(value);
64+
Client set{{header.key | caseUcfirst}}(String value);
6565

6666
{% endfor %}
6767
/// Add headers that should be sent with all API calls.

templates/flutter/lib/src/client_io.dart.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class ClientIO extends ClientBase with ClientMixin {
181181
} catch (e) {
182182
debugPrint('Error getting device info: $e');
183183
device = Platform.operatingSystem;
184-
addHeader('user-agent', '$device');
184+
addHeader('user-agent', device);
185185
}
186186

187187
_initialized = true;

templates/flutter/lib/src/client_mixin.dart.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mixin ClientMixin {
4545
return MapEntry(key, value.toString());
4646
}
4747
if (value is List) {
48-
return MapEntry(key + "[]", value);
48+
return MapEntry("$key[]", value);
4949
}
5050
return MapEntry(key, value);
5151
});

templates/flutter/lib/src/realtime_io.dart.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ class RealtimeIO extends RealtimeBase with RealtimeMixin {
3232
final cookies = await (client as ClientIO).cookieJar.loadForRequest(uri);
3333
headers = {HttpHeaders.cookieHeader: CookieManager.getCookies(cookies)};
3434

35-
final _websok = IOWebSocketChannel((client as ClientIO).selfSigned
35+
final websok = IOWebSocketChannel((client as ClientIO).selfSigned
3636
? await _connectForSelfSignedCert(uri, headers)
3737
: await WebSocket.connect(uri.toString(), headers: headers));
38-
return _websok;
38+
return websok;
3939
}
4040

4141
/// Subscribe

templates/flutter/lib/src/realtime_mixin.dart.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ mixin RealtimeMixin {
2121
late WebSocketFactory getWebSocket;
2222
GetFallbackCookie? getFallbackCookie;
2323
int? get closeCode => _websok?.closeCode;
24-
Map<int, RealtimeSubscription> _subscriptions = {};
24+
final Map<int, RealtimeSubscription> _subscriptions = {};
2525
bool _reconnect = true;
2626
int _retries = 0;
2727
StreamSubscription? _websocketSubscription;
@@ -53,7 +53,7 @@ mixin RealtimeMixin {
5353
_heartbeatTimer = null;
5454
}
5555

56-
_createSocket() async {
56+
Future<void> _createSocket() async {
5757
if(_creatingSocket || _channels.isEmpty) return;
5858
_creatingSocket = true;
5959
final uri = _prepareUri();
@@ -164,7 +164,7 @@ mixin RealtimeMixin {
164164
"project": client.config['project'],
165165
"channels[]": _channels.toList(),
166166
},
167-
path: uri.path + "/realtime",
167+
path: "${uri.path}/realtime",
168168
);
169169
}
170170

0 commit comments

Comments
 (0)