File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
1
// Helper functions for validator and sanitizer.
2
2
3
- T ? shift <T >(List <T > l) {
3
+ T shift <T >(List <T > l) {
4
4
if (l.isNotEmpty) {
5
5
final first = l.first;
6
6
l.removeAt (0 );
7
7
return first;
8
8
}
9
- return null ;
9
+ return null as T ;
10
10
}
11
11
12
12
Map merge (Map ? obj, Map ? defaults) {
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ bool isURL(
45
45
int port;
46
46
String ? protocol;
47
47
String ? auth;
48
- String ? user;
48
+ String user;
49
49
String host;
50
50
String hostname;
51
51
String portStr;
@@ -56,7 +56,7 @@ bool isURL(
56
56
// check protocol
57
57
var split = str.split ('://' );
58
58
if (split.length > 1 ) {
59
- protocol = shift (split)! .toLowerCase ();
59
+ protocol = shift (split).toLowerCase ();
60
60
if (! protocols.contains (protocol)) {
61
61
return false ;
62
62
}
@@ -74,23 +74,23 @@ bool isURL(
74
74
}
75
75
76
76
// check query params
77
- split = str! .split ('?' );
77
+ split = str.split ('?' );
78
78
str = shift (split);
79
79
query = split.join ('?' );
80
80
if (query.isNotEmpty && RegExp (r'\s' ).hasMatch (query)) {
81
81
return false ;
82
82
}
83
83
84
84
// check path
85
- split = str! .split ('/' );
85
+ split = str.split ('/' );
86
86
str = shift (split);
87
87
path = split.join ('/' );
88
88
if (path.isNotEmpty && RegExp (r'\s' ).hasMatch (path)) {
89
89
return false ;
90
90
}
91
91
92
92
// check auth type urls
93
- split = str! .split ('@' );
93
+ split = str.split ('@' );
94
94
if (split.length > 1 ) {
95
95
auth = shift (split);
96
96
if (auth? .contains (':' ) ?? false ) {
@@ -107,7 +107,7 @@ bool isURL(
107
107
// check hostname
108
108
hostname = split.join ('@' );
109
109
split = hostname.split (':' );
110
- host = shift (split)! .toLowerCase ();
110
+ host = shift (split).toLowerCase ();
111
111
if (split.isNotEmpty) {
112
112
portStr = split.join (':' );
113
113
try {
You can’t perform that action at this time.
0 commit comments