@@ -6,7 +6,7 @@ part 'protocol.freezed.dart';
6
6
7
7
/// A base class shared between all custom_lint requests
8
8
@freezed
9
- class CustomLintRequest with _$CustomLintRequest {
9
+ sealed class CustomLintRequest with _$CustomLintRequest {
10
10
/// A request using the analyzer_plugin protocol
11
11
factory CustomLintRequest .analyzerPluginRequest (
12
12
Request request, {
@@ -17,10 +17,10 @@ class CustomLintRequest with _$CustomLintRequest {
17
17
factory CustomLintRequest .awaitAnalysisDone ({
18
18
required String id,
19
19
required bool reload,
20
- }) = _CustomLintRequestAwaitAnalysisDone ;
20
+ }) = CustomLintRequestAwaitAnalysisDone ;
21
21
22
22
/// 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 ;
24
24
25
25
/// Decode a custom_lint request from JSON
26
26
factory CustomLintRequest .fromJson (Map <String , Object ?> json) =>
@@ -33,27 +33,27 @@ class CustomLintRequest with _$CustomLintRequest {
33
33
34
34
/// The base class for all responses to a custom_lint request.
35
35
@freezed
36
- class CustomLintResponse with _$CustomLintResponse {
36
+ sealed class CustomLintResponse with _$CustomLintResponse {
37
37
/// The response for an analyzer_plugin request
38
38
factory CustomLintResponse .analyzerPluginResponse (
39
39
Response response, {
40
40
required String id,
41
- }) = _CustomLintResponseAnalyzerPluginResponse ;
41
+ }) = CustomLintResponseAnalyzerPluginResponse ;
42
42
43
43
/// The message sent when the client has completed its analysis
44
44
factory CustomLintResponse .awaitAnalysisDone ({required String id}) =
45
- _CustomLintResponseAwaitAnalysisDone ;
45
+ CustomLintResponseAwaitAnalysisDone ;
46
46
47
47
/// The reply to a ping request
48
48
factory CustomLintResponse .pong ({required String id}) =
49
- _CustomLintResponsePong ;
49
+ CustomLintResponsePong ;
50
50
51
51
/// A request failed
52
52
factory CustomLintResponse .error ({
53
53
required String id,
54
54
required String message,
55
55
required String stackTrace,
56
- }) = _CustomLintResponseError ;
56
+ }) = CustomLintResponseError ;
57
57
58
58
/// Decode a response from JSON
59
59
factory CustomLintResponse .fromJson (Map <String , Object ?> json) =>
@@ -65,8 +65,8 @@ class CustomLintResponse with _$CustomLintResponse {
65
65
66
66
/// A base class between all messages from the client, be it request responses,
67
67
/// or spontaneous events.
68
- @freezed
69
- class CustomLintMessage with _$CustomLintMessage {
68
+ @Freezed (copyWith : false )
69
+ abstract class CustomLintMessage with _$CustomLintMessage {
70
70
/// A spontaneous event, not associated with a request
71
71
factory CustomLintMessage .event (CustomLintEvent event) =
72
72
CustomLintMessageEvent ;
@@ -102,25 +102,25 @@ class NotificationJsonConverter
102
102
103
103
/// A base class for all custom_lint events
104
104
@freezed
105
- class CustomLintEvent with _$CustomLintEvent {
105
+ sealed class CustomLintEvent with _$CustomLintEvent {
106
106
/// The client sent a [Notification] using the analyzer_plugin protocol
107
107
factory CustomLintEvent .analyzerPluginNotification (
108
108
@NotificationJsonConverter () Notification notification,
109
- ) = _CustomLintEventAnalyzerPluginNotification ;
110
- // TOOD add source change event?
109
+ ) = CustomLintEventAnalyzerPluginNotification ;
110
+ // TODO add source change event?
111
111
112
112
/// A spontaneous error, unrelated to a request
113
113
factory CustomLintEvent .error (
114
114
String message,
115
115
String stackTrace, {
116
116
required String ? pluginName,
117
- }) = _CustomLintEventError ;
117
+ }) = CustomLintEventError ;
118
118
119
119
/// A log output
120
120
factory CustomLintEvent .print (
121
121
String message, {
122
122
required String ? pluginName,
123
- }) = _CustomLintEventPrint ;
123
+ }) = CustomLintEventPrint ;
124
124
125
125
/// Decode an event from JSON
126
126
factory CustomLintEvent .fromJson (Map <String , Object ?> json) =>
0 commit comments