From 7dad16764cbdf5feff262d2ffcb09e5dc26e6296 Mon Sep 17 00:00:00 2001 From: aligopalpour13 Date: Sat, 16 May 2026 13:14:01 +0330 Subject: [PATCH] fix: resolve directory path access and add existence check before caching gifs in home bloc --- lib/features/home/presentation/bloc/home_bloc.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/features/home/presentation/bloc/home_bloc.dart b/lib/features/home/presentation/bloc/home_bloc.dart index 2132279..6ed2b60 100644 --- a/lib/features/home/presentation/bloc/home_bloc.dart +++ b/lib/features/home/presentation/bloc/home_bloc.dart @@ -92,8 +92,9 @@ class HomeBloc extends Bloc { Future preCacheQuestionGifs() async { try { final Directory directory = Directory( - '${StoragePath.documentDir}/question_image', + '${StoragePath.documentDir.path}/question_image', ); + if (!directory.existsSync()) return; final List files = directory.listSync(); await Future.wait( files.map( @@ -110,8 +111,9 @@ class HomeBloc extends Bloc { Future preCacheAnswerGifs() async { try { final Directory directory = Directory( - '${StoragePath.documentDir}/answer_image', + '${StoragePath.documentDir.path}/answer_image', ); + if (!directory.existsSync()) return; final List files = directory.listSync(); await Future.wait( files.map(