我正在通过我的Flutter应用进行Facebook身份验证。这是可行的,但是,登录对话框仅显示第一次。
注销后,我再也没有得到登录提示。.再次看到登录对话框的唯一方法是FB并注销
请让我知道我可以从flutter应用程序中注销Facebook并显示登录对话框。
Google身份验证工作很好。我看到登录对话框
注销代码
Future<void> signOut() async {
await googleSignIn.signOut();
await facebookLogin.logOut();
await FirebaseAuth.instance.signOut();
await _firebaseAuth.signOut();
randstadUserProfile = null;
firebaseUser = null;
}
答案 0 :(得分:-1)
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_facebook_login/flutter_facebook_login.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:pixeltech/Body/Onboard/screens/entry_screen.dart';
class NotificationPage extends StatefulWidget {
@override
_NotificationPageState createState() => _NotificationPageState();
}
class _NotificationPageState extends State<NotificationPage> {
final GoogleSignIn googleSignIn = GoogleSignIn();
final FacebookLogin facebookLogIn = FacebookLogin();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child:FlatButton(onPressed: (){
signOutGoogle();
logoutFacebook();
}, child: Icon(Icons.exit_to_app))
)
);
}
///google signout
void signOutGoogle() async{
await googleSignIn.signOut();
Navigator.of(context).push(MaterialPageRoute(builder: (context) {return EntryScreen();},),);
print("Sign Out");
}
//facebook logout
void logoutFacebook() async{
await facebookLogIn.logOut();
Navigator.of(context).push(MaterialPageRoute(builder: (context) {return EntryScreen();},),);
print("User Sign Out");
}
}