Future<String> login() async {
try {
final authorizationTokenRequest = AuthorizationTokenRequest(
auth0ClientID,
auth0RedirectUrl,
issuer: auth0Issuer,
scopes: ['openid', 'profile', 'offline_access', 'email'],
promptValues: ['login'],
);
final AuthorizationTokenResponse? result =
await appAuth.authorizeAndExchangeCode(authorizationTokenRequest);
debugPrint(result?.accessToken);
return await _setLocalVariables(result);
} on PlatformException {
return 'User has Cancelled or no Internet';
} catch (e) {
return 'Unknown Error';
}
}
// logout Function While Logging Out The RefreshToken also will be Deleted
Future<bool> logout() async {
await secureStorage.delete(key: refreshTokenKey);
final url = Uri.https(
auth0Domain,
'/v2/logout',
{
'client_id': auth0ClientID,
'federated': '',
//'returnTo': 'YOUR_RETURN_LOGOUT_URL'
},
);
final response = await http.get(
url,
headers: {'Authorization': 'Bearer $auth0AccessToken'},
);
debugPrint(
'logout: ${response.request} ${response.statusCode} ${response.body}',
);
return response.statusCode == 200;
}
高架按鈕
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: appPrimaryColor, // background
onPrimary: Colors.white, // foreground
fixedSize: Size(context.screenWidth * 0.80,
context.screenHeight * 0.07),
onSurface: appPrimaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
),
onPressed: () {
loginAction(); // Calling the Login fucntion from the HomeScreen to Perform LoginAction
},
當第一次登錄時正確登錄后注銷并再次登錄它會引發錯誤
處理手勢時引發以下 NoSuchMethodError:
類'String'沒有實體方法'call'。接收者:“”嘗試呼叫:call()
拋出例外時,這是堆疊 #0 Object.noSuchMethod #1 LoginScreen.build..
uj5u.com熱心網友回復:
NoSuchMethodError當您嘗試從類或物件訪問不存在的方法時,通常會拋出。造成這種情況的常見原因可能是由于類尚未初始化或為空。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/426617.html
上一篇:為什么flutterscrollController.position.activity不能在普通小部件內部使用?
