@@ -6,7 +6,7 @@ part 'protocol.freezed.dart';
66
77/// A base class shared between all custom_lint requests
88@freezed
9- class CustomLintRequest with _$CustomLintRequest {
9+ sealed class CustomLintRequest with _$CustomLintRequest {
1010 /// A request using the analyzer_plugin protocol
1111 factory CustomLintRequest .analyzerPluginRequest (
1212 Request request, {
@@ -17,10 +17,10 @@ class CustomLintRequest with _$CustomLintRequest {
1717 factory CustomLintRequest .awaitAnalysisDone ({
1818 required String id,
1919 required bool reload,
20- }) = _CustomLintRequestAwaitAnalysisDone ;
20+ }) = CustomLintRequestAwaitAnalysisDone ;
2121
2222 /// Sends a meaningless message to the client, waiting for a response.
23- factory CustomLintRequest .ping ({required String id}) = _CustomLintRequestPing ;
23+ factory CustomLintRequest .ping ({required String id}) = CustomLintRequestPing ;
2424
2525 /// Decode a custom_lint request from JSON
2626 factory CustomLintRequest .fromJson (Map <String , Object ?> json) =>
@@ -33,27 +33,27 @@ class CustomLintRequest with _$CustomLintRequest {
3333
3434/// The base class for all responses to a custom_lint request.
3535@freezed
36- class CustomLintResponse with _$CustomLintResponse {
36+ sealed class CustomLintResponse with _$CustomLintResponse {
3737 /// The response for an analyzer_plugin request
3838 factory CustomLintResponse .analyzerPluginResponse (
3939 Response response, {
4040 required String id,
41- }) = _CustomLintResponseAnalyzerPluginResponse ;
41+ }) = CustomLintResponseAnalyzerPluginResponse ;
4242
4343 /// The message sent when the client has completed its analysis
4444 factory CustomLintResponse .awaitAnalysisDone ({required String id}) =
45- _CustomLintResponseAwaitAnalysisDone ;
45+ CustomLintResponseAwaitAnalysisDone ;
4646
4747 /// The reply to a ping request
4848 factory CustomLintResponse .pong ({required String id}) =
49- _CustomLintResponsePong ;
49+ CustomLintResponsePong ;
5050
5151 /// A request failed
5252 factory CustomLintResponse .error ({
5353 required String id,
5454 required String message,
5555 required String stackTrace,
56- }) = _CustomLintResponseError ;
56+ }) = CustomLintResponseError ;
5757
5858 /// Decode a response from JSON
5959 factory CustomLintResponse .fromJson (Map <String , Object ?> json) =>
@@ -65,8 +65,8 @@ class CustomLintResponse with _$CustomLintResponse {
6565
6666/// A base class between all messages from the client, be it request responses,
6767/// or spontaneous events.
68- @freezed
69- class CustomLintMessage with _$CustomLintMessage {
68+ @Freezed (copyWith : false )
69+ abstract class CustomLintMessage with _$CustomLintMessage {
7070 /// A spontaneous event, not associated with a request
7171 factory CustomLintMessage .event (CustomLintEvent event) =
7272 CustomLintMessageEvent ;
@@ -102,25 +102,25 @@ class NotificationJsonConverter
102102
103103/// A base class for all custom_lint events
104104@freezed
105- class CustomLintEvent with _$CustomLintEvent {
105+ sealed class CustomLintEvent with _$CustomLintEvent {
106106 /// The client sent a [Notification] using the analyzer_plugin protocol
107107 factory CustomLintEvent .analyzerPluginNotification (
108108 @NotificationJsonConverter () Notification notification,
109- ) = _CustomLintEventAnalyzerPluginNotification ;
110- // TOOD add source change event?
109+ ) = CustomLintEventAnalyzerPluginNotification ;
110+ // TODO add source change event?
111111
112112 /// A spontaneous error, unrelated to a request
113113 factory CustomLintEvent .error (
114114 String message,
115115 String stackTrace, {
116116 required String ? pluginName,
117- }) = _CustomLintEventError ;
117+ }) = CustomLintEventError ;
118118
119119 /// A log output
120120 factory CustomLintEvent .print (
121121 String message, {
122122 required String ? pluginName,
123- }) = _CustomLintEventPrint ;
123+ }) = CustomLintEventPrint ;
124124
125125 /// Decode an event from JSON
126126 factory CustomLintEvent .fromJson (Map <String , Object ?> json) =>
0 commit comments