AOSSIE-Org / AOSSIE-Org/Resonate

Refactor ApiService to improve robustness and eliminate duplicated execution logic

Abierto
#766 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Dart
Estrellas
344
Forks
350
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### 🐛 Describe the bug

A clear and concise description of what the bug is.

The current ApiService implementation repeats the same function execution logic across multiple methods (createRoom, joinRoom, deleteRoom, createLiveChapterRoom, etc.).

Each method individually:
- Calls an Appwrite function
- Checks for HTTP 200 status
- Decodes the JSON response
- Returns Map

This results in duplicated logic and assumes that:
- The response body is always valid JSON
- The decoded value is always a JSON object (Map)
- The function call will always return without hanging

If the response format changes or returns malformed JSON, jsonDecode may throw a runtime error. Additionally, the current implementation has no timeout protection, meaning a hanging function call could block indefinitely.

This is not currently causing a visible bug, but it introduces unnecessary risk and maintenance overhead.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.