toggleLocalAuth method

Future<void> toggleLocalAuth(
  1. bool localAuth
)

Implementation

Future<void> toggleLocalAuth(bool localAuth) async {
  if (localAuth != _localLoginEnabled) {
    _localLoginEnabled = localAuth;
    var storage = new FlutterSecureStorage();
    if (localAuth) {
      await storage.write(key: 'localLoginEnabled', value: 'true');
    } else {
      await storage.write(key: 'localLoginEnabled', value: 'false');
    }
    await storage.delete(key: 'localLoginEmail');
    await storage.delete(key: 'localLoginPassword');
    await storage.delete(key: 'localLoginInitialised');
    await storage.delete(key: 'localLoginUid');
    _localLoginInitialised = false;
    _localLoginUid = null;
  }
  notifyListeners();
}