logout method

Future<void> logout()

logs out user. use this before login if user is already logged in

Implementation

Future<void> logout() async {
  EventModel event = EventModel(
      name: Constants.logout,
      eventTime: DateTime.now().millisecondsSinceEpoch + 1);

  _database.insertEvent(event).then((value) async {
    if (_session.data!.stime == null ||
        _isSessionExpired(_session.data!.stime!)) {
      await _createSession();
    }
    await _flushEvents();
  });
}