File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,18 +4,14 @@ extension IntPick on RequiredPick {
44 /// Returns the picked [value] as [int]
55 ///
66 /// {@template Pick.asInt}
7- /// Parses the picked value as [int] . Other types are parsable as well
8- /// - [String] is gets parsed via [int.tryParse]
9- /// - [double] is gets converted to [int] via [num.toInt()]
7+ /// Parses the picked value as [int] . Also tries to parse [String] as [int]
8+ /// via [int.tryParse]
109 /// {@endtemplate}
1110 int asInt () {
1211 final value = this .value;
1312 if (value is int ) {
1413 return value;
1514 }
16- if (value is num ) {
17- return value.toInt ();
18- }
1915 if (value is String ) {
2016 final parsed = int .tryParse (value);
2117 if (parsed != null ) {
Original file line number Diff line number Diff line change @@ -11,10 +11,6 @@ void main() {
1111 expect (pick (35 ).asIntOrThrow (), 35 );
1212 });
1313
14- test ('parse double' , () {
15- expect (pick (1.0 ).asIntOrThrow (), 1 );
16- });
17-
1814 test ('parse int String' , () {
1915 expect (pick ('1' ).asIntOrThrow (), 1 );
2016 expect (pick ('123' ).asIntOrThrow (), 123 );
You can’t perform that action at this time.
0 commit comments