Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

⚡ Upper-cast the return type of the decoder #99

Merged
merged 2 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 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 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