@@ -2,6 +2,7 @@ import 'package:json_annotation/json_annotation.dart';
22import 'package:vrchat_dart/src/model/streaming/serializers.dart' ;
33import 'package:vrchat_dart_generated/vrchat_dart_generated.dart' ;
44import 'package:vrchat_dart/src/model/streaming/streamed_current_user.dart' ;
5+ import 'package:meta/meta.dart' ;
56
67part 'vrc_streaming_event.g.dart' ;
78
@@ -96,14 +97,19 @@ extension VrcStreamingEventTypeExtension on VrcStreamingEventType {
9697}
9798
9899/// Base class for [VrcStreamingEvent] s
100+ @immutable
99101abstract 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+ ///
107113class 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,
0 commit comments