refactor: Centralize error and notification handling using a dedicated _errorService across various components.

This commit is contained in:
Van Leemput Dayron
2025-12-03 14:50:03 +01:00
parent 6757cb013a
commit f3ae91ccf9
10 changed files with 91 additions and 249 deletions

View File

@@ -5,6 +5,7 @@ import 'dart:convert';
import 'package:http/http.dart' as http;
import 'dart:ui' as ui;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../../services/error_service.dart';
class MapContent extends StatefulWidget {
final String? initialSearchQuery;
@@ -416,13 +417,7 @@ class _MapContentState extends State<MapContent> {
void _showError(String message) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(message),
backgroundColor: Colors.red,
behavior: SnackBarBehavior.floating,
),
);
ErrorService().showError(message: message);
}
}