Skip to content

Commit d39c623

Browse files
committed
Upgrade lints and fix issues
1 parent 28de378 commit d39c623

12 files changed

Lines changed: 41 additions & 22 deletions

File tree

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: ^10.0.1
14+
rexios_lints: ^11.0.4
1515

1616
dependency_overrides:
1717
vrchat_dart_generated:

vrchat_dart/example_flutter/lib/vrc_api_container.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:vrchat_dart/vrchat_dart.dart';
66
class VrcApiContainer {
77
/// I do not recommend storing a reference to [VrchatDart.api] or you will
88
/// have a bad time with the type checker and conditional imports
9-
Future<VrchatDart> create() async {
9+
Future<VrchatDart> create() {
1010
return VrcApiContainerImpl().create();
1111
}
1212
}

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: ^8.0.0
1616

1717
dev_dependencies:
18-
rexios_lints: ^10.0.1
18+
rexios_lints: ^11.0.4
1919

2020
dependency_overrides:
2121
vrchat_dart_generated:

vrchat_dart/lib/src/api/vrc_api_base.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import 'package:vrchat_dart/src/api/src/auth_api.dart';
55
import 'package:vrchat_dart/src/streaming/vrc_streaming.dart';
66
import 'package:vrchat_dart/src/api/vrc_api_native.dart'
77
if (dart.library.js) 'package:vrchat_dart/src/api/vrc_api_web.dart';
8+
import 'package:meta/meta.dart';
89

910
/// Shared code between the web and native implementations
11+
@immutable
1012
abstract class VrcApi {
1113
/// Access to auth convenience methods
1214
final AuthApi auth;

vrchat_dart/lib/src/model/api/vrc_response.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import 'package:dio/dio.dart';
22
import 'package:dio_response_validator/dio_response_validator.dart';
3+
import 'package:meta/meta.dart';
34

45
/// A response from the auth API
6+
@immutable
57
class AuthResponse {
68
/// True if this account requires two factor auth
79
final bool requiresTwoFactorAuth;
@@ -28,6 +30,7 @@ enum TwoFactorAuthType {
2830
}
2931

3032
/// An error returned from the VRChat API
33+
@immutable
3134
class VrcError {
3235
/// Error message returned from the API
3336
final String message;
@@ -36,7 +39,7 @@ class VrcError {
3639
final int statusCode;
3740

3841
/// Create a custom [VrcError]
39-
VrcError({required this.message, required this.statusCode});
42+
const VrcError({required this.message, required this.statusCode});
4043

4144
/// Construct a [VrcError] from json
4245
static VrcError? fromDioError(DioException error) {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import 'package:json_annotation/json_annotation.dart';
22
import 'package:vrchat_dart_generated/vrchat_dart_generated.dart';
3+
import 'package:meta/meta.dart';
34

45
part 'streamed_current_user.g.dart';
56

67
/// A user object representing the signed in user streamed from the VRChat websocket connection
8+
@immutable
79
@JsonSerializable()
810
class StreamedCurrentUser {
911
/// The user's bio
@@ -49,7 +51,7 @@ class StreamedCurrentUser {
4951
final String username;
5052

5153
/// Create a [StreamedCurrentUser]
52-
StreamedCurrentUser({
54+
const StreamedCurrentUser({
5355
required this.bio,
5456
required this.currentAvatar,
5557
required this.currentAvatarAssetUrl,

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

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:json_annotation/json_annotation.dart';
22
import 'package:vrchat_dart/src/model/streaming/serializers.dart';
33
import 'package:vrchat_dart_generated/vrchat_dart_generated.dart';
44
import 'package:vrchat_dart/src/model/streaming/streamed_current_user.dart';
5+
import 'package:meta/meta.dart';
56

67
part 'vrc_streaming_event.g.dart';
78

@@ -96,14 +97,19 @@ extension VrcStreamingEventTypeExtension on VrcStreamingEventType {
9697
}
9798

9899
/// Base class for [VrcStreamingEvent]s
100+
@immutable
99101
abstract class VrcStreamingEvent {
100102
/// The type of [VrcStreamingEvent] received
101103
VrcStreamingEventType get type;
104+
105+
/// Constructor
106+
const VrcStreamingEvent();
102107
}
103108

104109
/// These shouldn't happen unless VRChat adds more events
105110
///
106111
/// If you end up getting [UnknownEvent]s please create an issue on GitHub
112+
///
107113
class UnknownEvent extends VrcStreamingEvent {
108114
@override
109115
VrcStreamingEventType get type => VrcStreamingEventType.unknown;
@@ -112,7 +118,7 @@ class UnknownEvent extends VrcStreamingEvent {
112118
final String rawString;
113119

114120
/// Create an [UnknownEvent] with the given [rawString]
115-
UnknownEvent({required this.rawString});
121+
const UnknownEvent({required this.rawString});
116122
}
117123

118124
/// An error message returned from the server
@@ -121,7 +127,7 @@ class ErrorEvent extends VrcStreamingEvent {
121127
VrcStreamingEventType get type => VrcStreamingEventType.error;
122128

123129
/// Create an [ErrorEvent] with the given [message]
124-
ErrorEvent({required this.message});
130+
const ErrorEvent({required this.message});
125131

126132
/// The error message
127133
final String message;
@@ -133,7 +139,7 @@ abstract class FriendEvent extends VrcStreamingEvent {
133139
final String userId;
134140

135141
/// Create a [FriendEvent] with the given [userId]
136-
FriendEvent({required this.userId});
142+
const FriendEvent({required this.userId});
137143
}
138144

139145
/// Base class for [FriendEvent]s that contain a user object
@@ -142,7 +148,7 @@ abstract class FriendEventWithUser extends FriendEvent {
142148
final User user;
143149

144150
/// Create a [FriendEventWithUser] with the given [userId] and [user]
145-
FriendEventWithUser({required super.userId, required this.user});
151+
const FriendEventWithUser({required super.userId, required this.user});
146152
}
147153

148154
/// Base class for [UserEvent]s
@@ -151,7 +157,7 @@ abstract class UserEvent extends VrcStreamingEvent {
151157
final String userId;
152158

153159
/// Create a [UserEvent] with the given [userId]
154-
UserEvent({required this.userId});
160+
const UserEvent({required this.userId});
155161
}
156162

157163
/// Base class for [NotificationEvent]s
@@ -179,7 +185,7 @@ class FriendOnlineEvent extends FriendEventWithUser {
179185
final bool canRequestInvite;
180186

181187
/// Create a [FriendOnlineEvent]
182-
FriendOnlineEvent({
188+
const FriendOnlineEvent({
183189
required super.userId,
184190
required super.user,
185191
required this.world,
@@ -204,7 +210,7 @@ class FriendOfflineEvent extends FriendEvent {
204210
VrcStreamingEventType get type => VrcStreamingEventType.friendOffline;
205211

206212
/// Create a [FriendOnlineEvent] with the given [userId]
207-
FriendOfflineEvent({required super.userId});
213+
const FriendOfflineEvent({required super.userId});
208214

209215
/// Create a [FriendOfflineEvent] from json
210216
factory FriendOfflineEvent.fromJson(Map<String, dynamic> json) =>
@@ -222,7 +228,7 @@ class FriendActiveEvent extends FriendEventWithUser {
222228
VrcStreamingEventType get type => VrcStreamingEventType.friendActive;
223229

224230
/// Create a [FriendActiveEvent] with the given [userId] and [user]
225-
FriendActiveEvent({required super.userId, required super.user});
231+
const FriendActiveEvent({required super.userId, required super.user});
226232

227233
/// Create a [FriendActiveEvent] from json
228234
factory FriendActiveEvent.fromJson(Map<String, dynamic> json) =>
@@ -240,7 +246,7 @@ class FriendAddEvent extends FriendEventWithUser {
240246
VrcStreamingEventType get type => VrcStreamingEventType.friendAdd;
241247

242248
/// Create a [FriendAddEvent] with the given [userId] and [user]
243-
FriendAddEvent({required super.userId, required super.user});
249+
const FriendAddEvent({required super.userId, required super.user});
244250

245251
/// Create a [FriendAddEvent] from json
246252
factory FriendAddEvent.fromJson(Map<String, dynamic> json) =>
@@ -258,7 +264,7 @@ class FriendDeleteEvent extends FriendEvent {
258264
VrcStreamingEventType get type => VrcStreamingEventType.friendDelete;
259265

260266
/// Create a [FriendDeleteEvent] with the given [userId]
261-
FriendDeleteEvent({required super.userId});
267+
const FriendDeleteEvent({required super.userId});
262268

263269
/// Create a [FriendDeleteEvent] from json
264270
factory FriendDeleteEvent.fromJson(Map<String, dynamic> json) =>
@@ -276,7 +282,7 @@ class FriendUpdateEvent extends FriendEventWithUser {
276282
VrcStreamingEventType get type => VrcStreamingEventType.friendUpdate;
277283

278284
/// Create a [FriendUpdateEvent] with the given [userId] and [user]
279-
FriendUpdateEvent({required super.userId, required super.user});
285+
const FriendUpdateEvent({required super.userId, required super.user});
280286

281287
/// Create a [FriendUpdateEvent] from json
282288
factory FriendUpdateEvent.fromJson(Map<String, dynamic> json) =>
@@ -308,7 +314,7 @@ class FriendLocationEvent extends FriendEventWithUser {
308314
final bool canRequestInvite;
309315

310316
/// Create a [FriendLocationEvent]
311-
FriendLocationEvent({
317+
const FriendLocationEvent({
312318
required super.userId,
313319
required super.user,
314320
required this.world,
@@ -339,7 +345,7 @@ class UserUpdateEvent extends UserEvent {
339345
final StreamedCurrentUser user;
340346

341347
/// Create a [UserUpdateEvent] with the given [userId] and [user]
342-
UserUpdateEvent({required super.userId, required this.user});
348+
const UserUpdateEvent({required super.userId, required this.user});
343349

344350
/// Create a [UserUpdateEvent] from json
345351
factory UserUpdateEvent.fromJson(Map<String, dynamic> json) =>
@@ -365,7 +371,7 @@ class UserLocationEvent extends UserEvent {
365371
final String instance;
366372

367373
/// Create a [UserLocationEvent]
368-
UserLocationEvent({
374+
const UserLocationEvent({
369375
required super.userId,
370376
required this.world,
371377
required this.location,

vrchat_dart/lib/src/model/vrchat_user_agent.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
import 'package:meta/meta.dart';
2+
13
/// A user agent that satisfies the VRChat guidelines
24
///
35
/// > Applications must identify themselves properly using the User-Agent
46
/// > request header. Use this format: `applicationName/Version contactInfo`.
57
/// > For example: `VRCAPIApp/1.5.1 contact@example.com`. Failing to identify
68
/// > yourself clearly or identifying yourself improperly will result in
79
/// > moderation action.
10+
@immutable
811
class VrchatUserAgent {
912
/// The name of this application
1013
final String applicationName;

vrchat_dart/lib/src/streaming/vrc_streaming.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class VrcStreaming {
2121
final VrchatDartGenerated _rawApi;
2222
final String _baseUrl;
2323

24-
bool _started = false;
24+
var _started = false;
2525
WebSocketChannel? _channel;
2626

2727
/// Create a [VrcStreaming] instance

vrchat_dart/lib/src/vrchat_dart_base.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import 'package:vrchat_dart_generated/vrchat_dart_generated.dart';
44
import 'package:vrchat_dart/src/api/src/auth_api.dart';
55
import 'package:vrchat_dart/src/api/vrc_api_base.dart';
66
import 'package:vrchat_dart/src/streaming/vrc_streaming.dart';
7+
import 'package:meta/meta.dart';
78

89
/// VrchatDart
10+
@immutable
911
class VrchatDart {
1012
/// The user agent
1113
final VrchatUserAgent userAgent;

0 commit comments

Comments
 (0)