@@ -90,14 +90,7 @@ Dependency? _fromJson(Object? data, String name) {
90
90
return null ;
91
91
}
92
92
93
- abstract class Dependency {
94
- Dependency ._();
95
-
96
- String get _info;
97
-
98
- @override
99
- String toString () => '$runtimeType : $_info ' ;
100
- }
93
+ sealed class Dependency {}
101
94
102
95
@JsonSerializable ()
103
96
class SdkDependency extends Dependency {
@@ -106,18 +99,17 @@ class SdkDependency extends Dependency {
106
99
final VersionConstraint version;
107
100
108
101
SdkDependency (this .sdk, {VersionConstraint ? version})
109
- : version = version ?? VersionConstraint .any,
110
- super ._();
111
-
112
- @override
113
- String get _info => sdk;
102
+ : version = version ?? VersionConstraint .any;
114
103
115
104
@override
116
105
bool operator == (Object other) =>
117
106
other is SdkDependency && other.sdk == sdk && other.version == version;
118
107
119
108
@override
120
109
int get hashCode => Object .hash (sdk, version);
110
+
111
+ @override
112
+ String toString () => 'SdkDependency: $sdk ' ;
121
113
}
122
114
123
115
@JsonSerializable ()
@@ -127,7 +119,7 @@ class GitDependency extends Dependency {
127
119
final String ? ref;
128
120
final String ? path;
129
121
130
- GitDependency (this .url, {this .ref, this .path}) : super ._() ;
122
+ GitDependency (this .url, {this .ref, this .path});
131
123
132
124
factory GitDependency .fromData (Object ? data) {
133
125
if (data is String ) {
@@ -141,9 +133,6 @@ class GitDependency extends Dependency {
141
133
throw ArgumentError .value (data, 'git' , 'Must be a String or a Map.' );
142
134
}
143
135
144
- @override
145
- String get _info => 'url@$url ' ;
146
-
147
136
@override
148
137
bool operator == (Object other) =>
149
138
other is GitDependency &&
@@ -153,6 +142,9 @@ class GitDependency extends Dependency {
153
142
154
143
@override
155
144
int get hashCode => Object .hash (url, ref, path);
145
+
146
+ @override
147
+ String toString () => 'GitDependency: url@$url ' ;
156
148
}
157
149
158
150
Uri ? parseGitUriOrNull (String ? value) =>
@@ -194,7 +186,7 @@ Uri? _tryParseScpUri(String value) {
194
186
class PathDependency extends Dependency {
195
187
final String path;
196
188
197
- PathDependency (this .path) : super ._() ;
189
+ PathDependency (this .path);
198
190
199
191
factory PathDependency .fromData (Object ? data) {
200
192
if (data is String ) {
@@ -203,15 +195,15 @@ class PathDependency extends Dependency {
203
195
throw ArgumentError .value (data, 'path' , 'Must be a String.' );
204
196
}
205
197
206
- @override
207
- String get _info => 'path@$path ' ;
208
-
209
198
@override
210
199
bool operator == (Object other) =>
211
200
other is PathDependency && other.path == path;
212
201
213
202
@override
214
203
int get hashCode => path.hashCode;
204
+
205
+ @override
206
+ String toString () => 'PathDependency: path@$path ' ;
215
207
}
216
208
217
209
@JsonSerializable (disallowUnrecognizedKeys: true )
@@ -223,11 +215,7 @@ class HostedDependency extends Dependency {
223
215
final HostedDetails ? hosted;
224
216
225
217
HostedDependency ({VersionConstraint ? version, this .hosted})
226
- : version = version ?? VersionConstraint .any,
227
- super ._();
228
-
229
- @override
230
- String get _info => version.toString ();
218
+ : version = version ?? VersionConstraint .any;
231
219
232
220
@override
233
221
bool operator == (Object other) =>
@@ -237,6 +225,9 @@ class HostedDependency extends Dependency {
237
225
238
226
@override
239
227
int get hashCode => Object .hash (version, hosted);
228
+
229
+ @override
230
+ String toString () => 'HostedDependency: $version ' ;
240
231
}
241
232
242
233
@JsonSerializable (disallowUnrecognizedKeys: true )
0 commit comments