import 'package:http/http.dart' as http; import 'dart:convert'; import 'package:p_tits_pas/config/env.dart'; class BugReportService { static final String _apiUrl = Env.apiV1('/bug-reports'); static Future sendReport(String description) async { try { final response = await http.post( Uri.parse(_apiUrl), headers: { 'Content-Type': 'application/json', }, body: jsonEncode({ 'description': description, 'timestamp': DateTime.now().toIso8601String(), 'platform': 'web', // TODO: Ajouter la détection de la plateforme }), ); if (response.statusCode != 200) { throw Exception('Erreur lors de l\'envoi du rapport'); } } catch (e) { rethrow; } } }