Browse Source

fix: resolve directory path access and add existence check before caching gifs in home bloc

develop
Ali Gopal Pour 5 days ago
parent
commit
7dad16764c
  1. 6
      lib/features/home/presentation/bloc/home_bloc.dart

6
lib/features/home/presentation/bloc/home_bloc.dart

@ -92,8 +92,9 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
Future<void> preCacheQuestionGifs() async {
try {
final Directory directory = Directory(
'${StoragePath.documentDir}/question_image',
'${StoragePath.documentDir.path}/question_image',
);
if (!directory.existsSync()) return;
final List<FileSystemEntity> files = directory.listSync();
await Future.wait(
files.map(
@ -110,8 +111,9 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
Future<void> preCacheAnswerGifs() async {
try {
final Directory directory = Directory(
'${StoragePath.documentDir}/answer_image',
'${StoragePath.documentDir.path}/answer_image',
);
if (!directory.existsSync()) return;
final List<FileSystemEntity> files = directory.listSync();
await Future.wait(
files.map(

Loading…
Cancel
Save