import 'package:vitalapp/architecture/storage/text_storage.dart'; import 'package:vitalapp/managers/interfaces/cachedRecord.dart'; class CachedRecordManager implements ICachedRecordManager { @override Future saveCachedRecord( String key, String patientCode, String type, String cached, ) async { TextStorage cachedRecord = TextStorage( fileName: key, directory: "patient/$patientCode/$type", ); return cachedRecord.save(cached); } @override Future readCachedRecord( String key, String patientCode, String type, ) async { TextStorage cachedRecord = TextStorage( fileName: key, directory: "patient/$patientCode/$type", ); String? value = await cachedRecord.read(); return value; } @override Future deleteCachedRecord( String key, String patientCode, String type, ) async { TextStorage cachedRecord = TextStorage( fileName: key, directory: "patient/$patientCode/$type", ); return cachedRecord.delete(); } @override Future deleteDirectory( String patientCode, String type, ) async { TextStorage cachedRecord = TextStorage( fileName: '', directory: "patient/$patientCode/$type", ); return cachedRecord.deleteDirectory(); } }