refactor: Centralize error and notification handling using a dedicated _errorService across various components.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user