Hi, I configured the app as per docs but it's not working properly after login it's not showing user details instead it's showing this page: https://imgur.com/XdW82TU
Here's my flutter doctor:
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on Mac OS X 10.15.1 19B88 darwin-x64, locale en-GB)
• Flutter version 2.2.3 at /Users/mamun/Developer/flutter
• Framework revision f4abaa0735 (9 days ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/mamun/Library/Android/sdk/
• Platform android-30, build-tools 30.0.2
• Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C505
✗ Xcode 11.3.1 out of date (12.0.1 is recommended).
Download the latest version or update via the Mac App Store.
! CocoaPods 1.9.1 out of date (1.10.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the
Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[!] Android Studio
• Android Studio at /path/to/android/studio/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Android Studio not found at /path/to/android/studio/Contents
• Try updating or re-installing Android Studio.
[✓] VS Code (version 1.57.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114
! Doctor found issues in 2 categories.
here's my code:
static Future signInWithTwitter(
{BuildContext? context}) async {
String? newMessage;
// Create a TwitterLogin instance
final TwitterLogin twitterLogin = new TwitterLogin(
consumerKey: '',
consumerSecret: '',
);
// Trigger the sign-in flow
final TwitterLoginResult result = await twitterLogin.authorize();
// Get the Logged In session
final TwitterSession twitterSession = result.session;
// Create a credential from the access token
final twitterAuthCredential = TwitterAuthProvider.credential(
accessToken: twitterSession.token,
secret: twitterSession.secret,
);
// Once signed in, return the UserCredential
UserCredential userCredential =
await FirebaseAuth.instance.signInWithCredential(twitterAuthCredential);
log('your message here');
log('userCredential.user');
log(userCredential.user.toString());
User? user = userCredential.user;
DocumentSnapshot? doc = await Globals.userRef.doc(user!.uid).get();
if (!doc.exists) {
Globals.userRef.doc(user!.uid).set({
'uid': user!.uid,
'email': user.email,
'firstName': "firstName",
'lastName': "lastName",
'displayName': user!.displayName,
'password': 'hashedPassword',
'userName': user.email,
'bio': Globals.loremText,
'photoUrl': user!.photoURL,
'phoneNumber': "phoneNumber",
'userType': "Facebook",
'publicUrl': "url",
"isAdmin": false,
'createdAt': FieldValue.serverTimestamp(),
'updatedAt': FieldValue.serverTimestamp(),
'lastLoggedIn': FieldValue.serverTimestamp(),
});
switch (result.status) {
case TwitterLoginStatus.loggedIn:
newMessage = 'User ${user.email} LoggedIn Successfully!';
ScaffoldMessenger.of(context!).showSnackBar(
Globals.customSnackBar(
content: newMessage,
),
);
break;
case TwitterLoginStatus.cancelledByUser:
newMessage = 'Login cancelled by user.';
ScaffoldMessenger.of(context!).showSnackBar(
Globals.customSnackBar(
content: newMessage,
),
);
break;
case TwitterLoginStatus.error:
newMessage = 'Login error: ${result.errorMessage}';
ScaffoldMessenger.of(context!).showSnackBar(
Globals.customSnackBar(
content: newMessage,
),
);
break;
}
}
Navigator.push(
context!,
MaterialPageRoute(
builder: (context) => WelcomeScreen(
user: user,
)));
return userCredential;
}