+fix
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class SettingsService {
|
||||
SettingsService(){initialize();}
|
||||
static const String _baseUrlKey = 'server_base_url';
|
||||
static const String _defaultBaseUrl =
|
||||
'https://family-safety.onrender.com/api';
|
||||
@@ -13,6 +12,7 @@ class SettingsService {
|
||||
String get baseUrl => _baseUrl;
|
||||
String? login;
|
||||
String? pwd;
|
||||
bool loggedIn=false;
|
||||
|
||||
Future<void> initialize() async {
|
||||
if (_initialized) return;
|
||||
@@ -34,7 +34,14 @@ class SettingsService {
|
||||
pwd = pass;
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString(_loginKey, user);
|
||||
await prefs.setString(_loginKey, user);
|
||||
await prefs.setString(_pwdKey, pass);
|
||||
}
|
||||
Future<void> logOut() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
login = null;
|
||||
pwd = null;
|
||||
await prefs.remove(_loginKey);
|
||||
await prefs.remove(_pwdKey);
|
||||
}
|
||||
|
||||
void resetToDefault() {
|
||||
|
||||
Reference in New Issue
Block a user