File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
packages/go_router/example Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ class _MyExtraDecoder extends Converter<Object?, Object?> {
116116 if (inputAsList[0 ] == 'ComplexData2' ) {
117117 return ComplexData2 (inputAsList[1 ]! as String );
118118 }
119- throw FormatException ('Unable tp parse input: $input ' );
119+ throw FormatException ('Unable to parse input: $input ' );
120120 }
121121}
122122
Original file line number Diff line number Diff line change @@ -20,4 +20,20 @@ void main() {
2020 expect (find.text ('The extra for this page is: ComplexData2(data: data)' ),
2121 findsOneWidget);
2222 });
23+
24+ test ('invalid extra throws' , () {
25+ const example.MyExtraCodec extraCodec = example.MyExtraCodec ();
26+ const List <Object ?> invalidValue = < Object ? > ['invalid' ];
27+
28+ expect (
29+ () => extraCodec.decode (invalidValue),
30+ throwsA (
31+ predicate (
32+ (Object ? exception) =>
33+ exception is FormatException &&
34+ exception.message == 'Unable to parse input: $invalidValue ' ,
35+ ),
36+ ),
37+ );
38+ });
2339}
You can’t perform that action at this time.
0 commit comments