getExpireAt function

Future<DateTime> getExpireAt()

Retrieves the expiration timestamp of the user session.

Throws an Exception if the expiration timestamp is null.

Implementation

Future<DateTime> getExpireAt() async {
  try {
    final expireAt = await _platform.getExpireAt();
    if (expireAt == null) {
      throw Exception('Unable to get the session expiration date.');
    }
    return DateTime.fromMillisecondsSinceEpoch(expireAt * 1000);
  } catch (error, stackTrace) {
    Error.throwWithStackTrace(error, stackTrace);
  }
}