Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
session_local_datasource.dart
Go to the documentation of this file.
1import 'dart:convert';
2
3import '../../../../../core/constants/strings.dart';
4import '../../../../../core/storage/flutter_secure_storage.dart';
5import '../../models/session_model.dart';
6
7class SessionLocalDataSource extends SecureStorage {
9
10 Future<void> saveSession({required SessionModel session}) async {
11 await super.save(value: jsonEncode(session.toJson()));
12 }
13
14 Future<SessionModel?> fetchSession() async {
15 final json = await super.get();
16 if (json != null) {
17 return SessionModel.fromJson(jsonDecode(json) as Map<String, dynamic>);
18 }
19 return null;
20 }
21
22 Future<void> deleteSession() async {
23 await super.delete();
24 }
25}
SessionLocalDataSource({super.key=Strings.sessionKey})
Future< SessionModel?> fetchSession() async
Future< void > saveSession({required SessionModel session}) async
Future< void > deleteSession() async
static const String sessionKey
Definition strings.dart:6
final double value
const SessionModel({ super.id, super.jsonrpc, super.parentId, super.processType, super.db, super.isAdmin, super.isSystem, super.name, super.partnerId, super.statusCode, super.supportUrl, super.uid, super.userContext, super.username, super.token, })