@@ -10,7 +10,7 @@ import 'dart:typed_data';
1010import '../utils.dart' ;
1111
1212/// The canonical instance of [HexDecoder] .
13- const hexDecoder = const HexDecoder ._();
13+ const hexDecoder = HexDecoder ._();
1414
1515/// A converter that decodes hexadecimal strings into byte arrays.
1616///
@@ -22,17 +22,17 @@ class HexDecoder extends Converter<String, List<int>> {
2222
2323 List <int > convert (String string) {
2424 if (! string.length.isEven) {
25- throw new FormatException (
25+ throw FormatException (
2626 "Invalid input length, must be even." , string, string.length);
2727 }
2828
29- var bytes = new Uint8List (string.length ~ / 2 );
29+ var bytes = Uint8List (string.length ~ / 2 );
3030 _decode (string.codeUnits, 0 , string.length, bytes, 0 );
3131 return bytes;
3232 }
3333
3434 StringConversionSink startChunkedConversion (Sink <List <int >> sink) =>
35- new _HexDecoderSink (sink);
35+ _HexDecoderSink (sink);
3636}
3737
3838/// A conversion sink for chunked hexadecimal decoding.
@@ -61,11 +61,11 @@ class _HexDecoderSink extends StringConversionSinkBase {
6161 Uint8List bytes;
6262 int bytesStart;
6363 if (_lastDigit == null ) {
64- bytes = new Uint8List ((end - start) ~ / 2 );
64+ bytes = Uint8List ((end - start) ~ / 2 );
6565 bytesStart = 0 ;
6666 } else {
6767 var hexPairs = (end - start - 1 ) ~ / 2 ;
68- bytes = new Uint8List (1 + hexPairs);
68+ bytes = Uint8List (1 + hexPairs);
6969 bytes[0 ] = _lastDigit + digitForCodeUnit (codeUnits, start);
7070 start++ ;
7171 bytesStart = 1 ;
@@ -78,15 +78,15 @@ class _HexDecoderSink extends StringConversionSinkBase {
7878 }
7979
8080 ByteConversionSink asUtf8Sink (bool allowMalformed) =>
81- new _HexDecoderByteSink (_sink);
81+ _HexDecoderByteSink (_sink);
8282
8383 void close () => _close ();
8484
8585 /// Like [close] , but includes [string] and [index] in the [FormatException]
8686 /// if one is thrown.
8787 void _close ([String string, int index]) {
8888 if (_lastDigit != null ) {
89- throw new FormatException (
89+ throw FormatException (
9090 "Input ended with incomplete encoded byte." , string, index);
9191 }
9292
@@ -121,11 +121,11 @@ class _HexDecoderByteSink extends ByteConversionSinkBase {
121121 Uint8List bytes;
122122 int bytesStart;
123123 if (_lastDigit == null ) {
124- bytes = new Uint8List ((end - start) ~ / 2 );
124+ bytes = Uint8List ((end - start) ~ / 2 );
125125 bytesStart = 0 ;
126126 } else {
127127 var hexPairs = (end - start - 1 ) ~ / 2 ;
128- bytes = new Uint8List (1 + hexPairs);
128+ bytes = Uint8List (1 + hexPairs);
129129 bytes[0 ] = _lastDigit + digitForCodeUnit (chunk, start);
130130 start++ ;
131131 bytesStart = 1 ;
@@ -143,7 +143,7 @@ class _HexDecoderByteSink extends ByteConversionSinkBase {
143143 /// if one is thrown.
144144 void _close ([List <int > chunk, int index]) {
145145 if (_lastDigit != null ) {
146- throw new FormatException (
146+ throw FormatException (
147147 "Input ended with incomplete encoded byte." , chunk, index);
148148 }
149149
0 commit comments