@@ -173,63 +173,63 @@ class _Sink extends ByteConversionSinkBase {
173
173
174
174
/// An enumeration of states that [_Sink] can exist in when decoded a chunked
175
175
/// message.
176
- class _State {
176
+ enum _State {
177
177
/// The parser has fully parsed one chunk and is expecting the header for the
178
178
/// next chunk.
179
179
///
180
180
/// Transitions to [size] .
181
- static const boundary = _State ._ ('boundary' );
181
+ boundary ('boundary' ),
182
182
183
183
/// The parser has parsed at least one digit of the chunk size header, but has
184
184
/// not yet parsed the `CR LF` sequence that indicates the end of that header.
185
185
///
186
186
/// Transitions to [sizeBeforeLF] .
187
- static const size = _State ._ ('size' );
187
+ size ('size' ),
188
188
189
189
/// The parser has parsed the chunk size header and the CR character after it,
190
190
/// but not the LF.
191
191
///
192
192
/// Transitions to [body] or [bodyBeforeCR] .
193
- static const sizeBeforeLF = _State ._ ('size before LF' );
193
+ sizeBeforeLF ('size before LF' ),
194
194
195
195
/// The parser has parsed a chunk header and possibly some of the body, but
196
196
/// still needs to consume more bytes.
197
197
///
198
198
/// Transitions to [bodyBeforeCR] .
199
- static const body = _State ._ ('body' );
199
+ body ('body' ),
200
200
201
201
// The parser has parsed all the bytes in a chunk body but not the CR LF
202
202
// sequence that follows it.
203
203
//
204
204
// Transitions to [bodyBeforeLF].
205
- static const bodyBeforeCR = _State ._ ('body before CR' );
205
+ bodyBeforeCR ('body before CR' ),
206
206
207
207
// The parser has parsed all the bytes in a chunk body and the CR that follows
208
208
// it, but not the LF after that.
209
209
//
210
- // Transitions to [bounday ].
211
- static const bodyBeforeLF = _State ._ ('body before LF' );
210
+ // Transitions to [boundary ].
211
+ bodyBeforeLF ('body before LF' ),
212
212
213
213
/// The parser has parsed the final empty chunk but not the CR LF sequence
214
214
/// that follows it.
215
215
///
216
216
/// Transitions to [endBeforeLF] .
217
- static const endBeforeCR = _State ._ ('end before CR' );
217
+ endBeforeCR ('end before CR' ),
218
218
219
219
/// The parser has parsed the final empty chunk and the CR that follows it,
220
220
/// but not the LF after that.
221
221
///
222
222
/// Transitions to [end] .
223
- static const endBeforeLF = _State ._ ('end before LF' );
223
+ endBeforeLF ('end before LF' ),
224
224
225
225
/// The parser has parsed the final empty chunk as well as the CR LF that
226
226
/// follows, and expects no more data.
227
- static const end = _State ._ ('end' );
227
+ end ('end' );
228
228
229
- final String _name ;
229
+ const _State ( this .name) ;
230
230
231
- const _State ._( this ._name) ;
231
+ final String name ;
232
232
233
233
@override
234
- String toString () => _name ;
234
+ String toString () => name ;
235
235
}
0 commit comments