Aidra Driver
1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
session_local_datasource.dart
Go to the documentation of this file.
1
import
'dart:convert';
2
3
import
'../../../../../core/constants/strings.dart';
4
import
'../../../../../core/services/secure_storage_service.dart';
5
import
'../../models/session_model.dart';
6
7
class
SessionLocalDataSource
extends
SecureStorageService
{
8
SessionLocalDataSource
({super.key =
Strings
.
sessionKey
});
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
}
SecureStorageService
Definition
secure_storage_service.dart:3
SecureStorageService::saveSession
Future< void > saveSession({required SessionModel session}) async
Definition
session_local_datasource.dart:10
SecureStorageService::deleteSession
Future< void > deleteSession() async
Definition
session_local_datasource.dart:22
SecureStorageService::SessionLocalDataSource
SessionLocalDataSource({super.key=Strings.sessionKey})
SecureStorageService::fetchSession
Future< SessionModel?> fetchSession() async
Definition
session_local_datasource.dart:14
Strings
Definition
strings.dart:1
Strings::sessionKey
static const String sessionKey
Definition
strings.dart:6
SessionModel
const SessionModel({ super.id, super.jsonrpc, super.processType, super.db, super.isAdmin, super.isSystem, super.name, super.partnerId, super.statusCode, super.supportUrl, super.uid, super.userContext, super.username, super.token, super.role, })
lib
features
auth
data
datasources
local_datasource
session_local_datasource.dart
Generated by
1.16.1