feat(api): Improve file and prompt parsing with type safety

This commit is contained in:
cogwheel0
2025-11-01 15:21:34 +05:30
parent 42ef62d565
commit fe09583c6b
2 changed files with 30 additions and 15 deletions

View File

@@ -13,12 +13,7 @@ class PromptsService {
Future<List<Prompt>> getPrompts() async {
try {
final List<Map<String, dynamic>> response = await _apiService
.getPrompts();
return response
.map((item) => Prompt.fromJson(item))
.where((prompt) => prompt.command.isNotEmpty)
.toList();
return await _apiService.getPrompts();
} on DioException catch (error) {
throw ApiErrorHandler().transformError(error);
}