@@ -17,18 +17,10 @@ class Address {
1717 if (type == 'user' ) {
1818 return "${host }search/users?q=$q &page=$page &per_page=$pageSize " ;
1919 }
20- if (sort == null ) {
21- sort = "best%20match" ;
22- }
23- if (order == null ) {
24- order = "desc" ;
25- }
26- if (page == null ) {
27- page = 1 ;
28- }
29- if (pageSize == null ) {
30- pageSize = Config .PAGE_SIZE ;
31- }
20+ sort ?? = "best%20match" ;
21+ order ?? = "desc" ;
22+ page ?? = 1 ;
23+ pageSize ?? = Config .PAGE_SIZE ;
3224 return "${host }search/repositories?q=$q &sort=$sort &order=$order &page=$page &per_page=$pageSize " ;
3325 }
3426
@@ -39,9 +31,7 @@ class Address {
3931
4032 ///用户的仓库 get
4133 static userRepos (userName, sort) {
42- if (sort == null ) {
43- sort = 'pushed' ;
44- }
34+ sort ?? = 'pushed' ;
4535 return "${host }users/$userName /repos?sort=$sort " ;
4636 }
4737
@@ -82,15 +72,9 @@ class Address {
8272
8373 ///仓库Issue get
8474 static getReposIssue (reposOwner, reposName, state, sort, direction) {
85- if (state == null ) {
86- state = 'all' ;
87- }
88- if (sort == null ) {
89- sort = 'created' ;
90- }
91- if (direction == null ) {
92- direction = 'desc' ;
93- }
75+ state ?? = 'all' ;
76+ sort ?? = 'created' ;
77+ direction ?? = 'desc' ;
9478 return "${host }repos/$reposOwner /$reposName /issues?state=$state &sort=$sort &direction=$direction " ;
9579 }
9680
@@ -152,17 +136,15 @@ class Address {
152136
153137 ///自己的star get
154138 static myStar (sort) {
155- if (sort == null ) {
156- sort = 'updated' ;
157- }
139+ sort ?? = 'updated' ;
140+
158141 return "${host }users/starred?sort=$sort " ;
159142 }
160143
161144 ///用户的star get
162145 static userStar (userName, sort) {
163- if (sort == null ) {
164- sort = 'updated' ;
165- }
146+ sort ?? = 'updated' ;
147+
166148 return "${host }users/$userName /starred?sort=$sort " ;
167149 }
168150
@@ -233,9 +215,7 @@ class Address {
233215
234216 ///fork get
235217 static getForker (reposOwner, reposName, sort) {
236- if (sort == null ) {
237- sort = 'newest' ;
238- }
218+ sort ?? = 'newest' ;
239219 return "${host }repos/$reposOwner /$reposName /forks?sort=$sort " ;
240220 }
241221
@@ -269,12 +249,8 @@ class Address {
269249 if (all == null && participating == null ) {
270250 return "${host }notifications" ;
271251 }
272- if (all == null ) {
273- all = false ;
274- }
275- if (participating == null ) {
276- participating = false ;
277- }
252+ all ?? = false ;
253+ participating ?? = false ;
278254 return "${host }notifications?all=$all &participating=$participating " ;
279255 }
280256
0 commit comments