Skip to content
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
2 changes: 1 addition & 1 deletion packages/go_router/example/lib/extra_codec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class _MyExtraDecoder extends Converter<Object?, Object?> {
if (inputAsList[0] == 'ComplexData2') {
return ComplexData2(inputAsList[1]! as String);
}
throw FormatException('Unable tp parse input: $input');
throw FormatException('Unable to parse input: $input');
}
}

Expand Down
16 changes: 16 additions & 0 deletions packages/go_router/example/test/extra_codec_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,20 @@ void main() {
expect(find.text('The extra for this page is: ComplexData2(data: data)'),
findsOneWidget);
});

test('invalid extra throws', () {
const example.MyExtraCodec extraCodec = example.MyExtraCodec();
const List<Object?> invalidValue = <Object?>['invalid'];

expect(
() => extraCodec.decode(invalidValue),
throwsA(
predicate(
(Object? exception) =>
exception is FormatException &&
exception.message == 'Unable to parse input: $invalidValue',
),
),
);
});
}