currentSession property
Future<TwitterAuthSession?>
get
currentSession
Retrieves the currently active session, if any.
A common use case for this is logging the user automatically in if they have already logged in before and the session is still active.
For example:
final TwitterAuthSession session = await twitterAuth.currentSession;
if (session != null) {
_fetchTweets(session);
} else {
_showLoginRequiredUI();
}
If the user is not logged in, this returns null.
Implementation
Future<TwitterAuthSession?> get currentSession async {
final Map<dynamic, dynamic>? session =
await _channel.invokeMethod(_kMethodGetSession);
if (session == null) return null;
return TwitterAuthSession.fromMap(session.cast<String, dynamic>());
}