@@ -10,24 +10,24 @@ import 'package:webview_flutter/webview_flutter.dart';
1010/// for OAuth 2.0 Authentication.
1111class OAuth {
1212 OAuth (
13- {@ required this .baseUrl,
14- @ required this .clientID,
15- @ required this .redirectUri,
16- @ required this .state,
17- @ required this .scope,
18- @ required this .debugMode,
13+ {required this .baseUrl,
14+ required this .clientID,
15+ required this .redirectUri,
16+ required this .state,
17+ required this .scope,
18+ required this .debugMode,
1919 this .clientSecret,
2020 this .responseType,
2121 this .otherQueryParams});
2222
2323 final String baseUrl; // OAuth url
2424 final String clientID; // OAuth clientID
25- final String clientSecret; // OAuth clientSecret
26- final String responseType; // OAuth clientSecret
25+ final String ? clientSecret; // OAuth clientSecret
26+ final String ? responseType; // OAuth clientSecret
2727 final String redirectUri; // OAuth redirectUri
2828 final String state; // OAuth state
2929 final String scope; // OAuth scope
30- final Map <String , String > otherQueryParams;
30+ final Map <String , String >? otherQueryParams;
3131 final bool debugMode; // Debug mode?
3232 static const String TOKEN_KEY = 'access_token' ; // OAuth token key
3333 static const String CODE_KEY = 'code' ; // OAuth code key
@@ -45,16 +45,16 @@ class OAuth {
4545 /// Sets up a [WebView] for OAuth authentication.
4646 /// [onDone] is called when authentication is
4747 /// completed successfully.
48- WebView authenticate ({@ required Function onDone, bool clearCache = false }) {
48+ WebView authenticate ({required Function onDone, bool clearCache = false }) {
4949 String clientSecretQuery =
5050 clientSecret != null ? '&client_secret=$clientSecret ' : '' ;
5151 String responseTypeQuery =
5252 '&response_type=${responseType == null ? 'token' : responseType }' ;
5353 String otherParams = '' ;
5454
5555 if (otherQueryParams != null ) {
56- for (String key in otherQueryParams.keys) {
57- otherParams += '&$key =${otherQueryParams [key ]}' ;
56+ for (String key in otherQueryParams! .keys) {
57+ otherParams += '&$key =${otherQueryParams ! [key ]}' ;
5858 }
5959 }
6060
@@ -103,14 +103,14 @@ class OAuth {
103103 returnedData[STATE_KEY ] = state;
104104
105105 if (clientSecret != null ) {
106- returnedData[CLIENT_SECRET_KEY ] = clientSecret;
106+ returnedData[CLIENT_SECRET_KEY ] = clientSecret! ;
107107 }
108108
109109 onDone (returnedData);
110110 } else if (debugMode) {
111111 _debug.info ('Redirect Url Not Found' );
112112 _debug.info ('Url = $url ' );
113- _debug.info ('Redirect Url = $redirectUri ' );
113+ // _debug.info('Redirect Url = $redirectUri');
114114 }
115115
116116 return NavigationDecision .navigate;
0 commit comments