In Unity sample you can restore session by saving its authToken and retrieve it via prefs because it is a string like on the fish game example.
var authToken = PlayerPrefs.GetString(SessionPrefName);
if (!string.IsNullOrEmpty(authToken))
{
var session = Nakama.Session.Restore(authToken);
if (!session.IsExpired)
{
this.session = session;
}
}
But in Dart it is asking for a session object which I can’t just simply save to a preference to refresh a session as said in the documentation.
try {
final session = await client.sessionRefresh(
session: expiringSession,
);
} catch(e) {
print('Error refreshing the session');
}
Since this session is a runtime object, how I can refresh it if the app is closed and launch again?