Skip to content

Commit

Permalink
⚡ Upper-cast the return type of the decoder (dart-archive/convert#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 authored Jun 9, 2024
1 parent 449efc9 commit 4dbbc6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkgs/convert/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Require Dart 3.0
- Add chunked decoding support (`startChunkedConversion`) for `CodePage`
encodings.
- Upper-cast the return type of the decoder from `List<int>` to `Uint8List`.

## 3.1.1

Expand Down
7 changes: 5 additions & 2 deletions pkgs/convert/lib/src/hex/decoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ class HexDecoder extends Converter<String, List<int>> {
const HexDecoder._();

@override
List<int> convert(String input) {
Uint8List convert(String input) {
if (!input.length.isEven) {
throw FormatException(
'Invalid input length, must be even.', input, input.length);
'Invalid input length, must be even.',
input,
input.length,
);
}

var bytes = Uint8List(input.length ~/ 2);
Expand Down

0 comments on commit 4dbbc6c

Please sign in to comment.