@@ -173,63 +173,63 @@ class _Sink extends ByteConversionSinkBase {
173173
174174/// An enumeration of states that [_Sink] can exist in when decoded a chunked
175175/// message.
176- class _State {
176+ enum _State {
177177 /// The parser has fully parsed one chunk and is expecting the header for the
178178 /// next chunk.
179179 ///
180180 /// Transitions to [size] .
181- static const boundary = _State ._ ('boundary' );
181+ boundary ('boundary' ),
182182
183183 /// The parser has parsed at least one digit of the chunk size header, but has
184184 /// not yet parsed the `CR LF` sequence that indicates the end of that header.
185185 ///
186186 /// Transitions to [sizeBeforeLF] .
187- static const size = _State ._ ('size' );
187+ size ('size' ),
188188
189189 /// The parser has parsed the chunk size header and the CR character after it,
190190 /// but not the LF.
191191 ///
192192 /// Transitions to [body] or [bodyBeforeCR] .
193- static const sizeBeforeLF = _State ._ ('size before LF' );
193+ sizeBeforeLF ('size before LF' ),
194194
195195 /// The parser has parsed a chunk header and possibly some of the body, but
196196 /// still needs to consume more bytes.
197197 ///
198198 /// Transitions to [bodyBeforeCR] .
199- static const body = _State ._ ('body' );
199+ body ('body' ),
200200
201201 // The parser has parsed all the bytes in a chunk body but not the CR LF
202202 // sequence that follows it.
203203 //
204204 // Transitions to [bodyBeforeLF].
205- static const bodyBeforeCR = _State ._ ('body before CR' );
205+ bodyBeforeCR ('body before CR' ),
206206
207207 // The parser has parsed all the bytes in a chunk body and the CR that follows
208208 // it, but not the LF after that.
209209 //
210- // Transitions to [bounday ].
211- static const bodyBeforeLF = _State ._ ('body before LF' );
210+ // Transitions to [boundary ].
211+ bodyBeforeLF ('body before LF' ),
212212
213213 /// The parser has parsed the final empty chunk but not the CR LF sequence
214214 /// that follows it.
215215 ///
216216 /// Transitions to [endBeforeLF] .
217- static const endBeforeCR = _State ._ ('end before CR' );
217+ endBeforeCR ('end before CR' ),
218218
219219 /// The parser has parsed the final empty chunk and the CR that follows it,
220220 /// but not the LF after that.
221221 ///
222222 /// Transitions to [end] .
223- static const endBeforeLF = _State ._ ('end before LF' );
223+ endBeforeLF ('end before LF' ),
224224
225225 /// The parser has parsed the final empty chunk as well as the CR LF that
226226 /// follows, and expects no more data.
227- static const end = _State ._ ('end' );
227+ end ('end' );
228228
229- final String _name ;
229+ const _State ( this .name) ;
230230
231- const _State ._( this ._name) ;
231+ final String name ;
232232
233233 @override
234- String toString () => _name ;
234+ String toString () => name ;
235235}
0 commit comments