fix: some problems are fixed

This commit is contained in:
2026-07-05 18:40:53 +03:30
parent 5017e9a613
commit e94f03c499
16 changed files with 384 additions and 152 deletions
+11 -2
View File
@@ -1,8 +1,9 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
/// ذخیره‌ی امن توکن JWT.
/// ذخیره‌ی امن توکن JWT و شماره‌ی موبایلِ کاربر.
class TokenStorage {
static const _key = 'jwt_token';
static const _mobileKey = 'user_mobile';
final FlutterSecureStorage _storage;
TokenStorage([FlutterSecureStorage? storage])
@@ -12,5 +13,13 @@ class TokenStorage {
Future<void> write(String token) => _storage.write(key: _key, value: token);
Future<void> clear() => _storage.delete(key: _key);
Future<String?> readMobile() => _storage.read(key: _mobileKey);
Future<void> writeMobile(String mobile) =>
_storage.write(key: _mobileKey, value: mobile);
Future<void> clear() async {
await _storage.delete(key: _key);
await _storage.delete(key: _mobileKey);
}
}