saveToken static method

Future<void> saveToken(
  1. String token, {
  2. required String key,
})

Persist and cache the token. Call this after a successful login.

Implementation

static Future<void> saveToken(String token, {required String key}) async {
  _memoryToken = token;
  final box = await Hive.openBox<String>('server_auth');
  await box.put(key, token);
}