Skip to content

Commit ab7c868

Browse files
authored
Upgrade lints and fix issues (#48)
1 parent 2eb60d8 commit ab7c868

File tree

10 files changed

+23
-18
lines changed

10 files changed

+23
-18
lines changed

vrchat_dart/build.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ targets:
66
ignore_for_file:
77
- document_ignores
88
- require_trailing_commas
9+
- not_null_assertion

vrchat_dart/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
otp: ^3.1.3
1212

1313
dev_dependencies:
14-
rexios_lints: ^15.0.0
14+
rexios_lints: ^16.0.0
1515

1616
dependency_overrides:
1717
vrchat_dart_generated:

vrchat_dart/example_flutter/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
package_info_plus: ^9.0.0
1616

1717
dev_dependencies:
18-
rexios_lints: ^15.0.0
18+
rexios_lints: ^16.0.0
1919

2020
dependency_overrides:
2121
vrchat_dart_generated:

vrchat_dart/lib/src/model/api/limited_user.g.dart

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vrchat_dart/lib/src/model/streaming/streamed_current_user.g.dart

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vrchat_dart/lib/src/model/streaming/vrc_streaming_event.g.dart

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vrchat_dart/lib/src/streaming/vrc_streaming.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:async';
22
import 'dart:convert';
3+
import 'package:vrchat_dart/src/model/api/vrc_response.dart';
34
import 'package:vrchat_dart/src/model/vrchat_user_agent.dart';
45
import 'package:vrchat_dart_generated/vrchat_dart_generated.dart';
56
import 'package:web_socket_channel/web_socket_channel.dart';
@@ -32,19 +33,20 @@ class VrcStreaming {
3233
void start() async {
3334
_started = true;
3435

35-
final String authToken;
36-
try {
37-
final authResponse = await _rawApi
38-
.getAuthenticationApi()
39-
.verifyAuthToken();
40-
authToken = authResponse.data!.token;
41-
} catch (error) {
36+
final (success, failure) = await _rawApi
37+
.getAuthenticationApi()
38+
.verifyAuthToken()
39+
.validateVrc();
40+
41+
if (success == null) {
4242
print(
4343
'ERROR: Unable to fetch auth token. Make sure to successfully login before starting to stream.',
4444
);
4545
return;
4646
}
4747

48+
final authToken = success.data.token;
49+
4850
_channel = connect(
4951
Uri.parse('$_baseUrl?authToken=$authToken'),
5052
userAgent: _userAgent.toString(),

vrchat_dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies:
1717
meta: ^1.16.0
1818

1919
dev_dependencies:
20-
rexios_lints: ^15.0.0
20+
rexios_lints: ^16.0.0
2121
build_runner: ^2.0.6
2222
json_serializable: ^6.0.1
2323
yaml: ^3.1.1

vrchat_dart/tool/patch_input.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ Future<Map<String, dynamic>> getSpec({required bool local}) async {
3636
final response = await dio.get(
3737
'https://vrchatapi.github.io/specification/openapi.yaml',
3838
);
39-
yaml = loadYaml(response.data!);
39+
final data = response.data;
40+
if (data == null) throw 'Failed to fetch spec';
41+
yaml = loadYaml(data);
4042
}
4143

4244
// Make the map modifiable

vrchat_dart/tool/patch_output.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,13 @@ void patchAnalysisIssues() {
165165
'// ignore: deprecated_member_use_from_same_package\n$line',
166166
'non_constant_identifier_names': (diagnostic, line) {
167167
final fieldMatch = RegExp(r'final .+ (\w+);').firstMatch(line);
168-
if (fieldMatch != null) {
169-
final group = fieldMatch[1]!;
168+
final group1 = fieldMatch?[1];
169+
if (fieldMatch != null && group1 != null) {
170170
final file = diagnostic.location.file;
171171
identifierIssues.update(
172172
file,
173-
(value) => value..add(group),
174-
ifAbsent: () => {group},
173+
(value) => value..add(group1),
174+
ifAbsent: () => {group1},
175175
);
176176
}
177177
return line;

0 commit comments

Comments
 (0)