diff --git a/lib/services/activity_places_service.dart b/lib/services/activity_places_service.dart index 3d15a15..b89e9e1 100644 --- a/lib/services/activity_places_service.dart +++ b/lib/services/activity_places_service.dart @@ -1,7 +1,7 @@ import 'dart:io'; import 'dart:convert'; import 'package:http/http.dart' as http; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import '../firebase_options.dart'; // Add this import import '../models/activity.dart'; import '../services/error_service.dart'; import '../services/logger_service.dart'; @@ -16,7 +16,14 @@ class ActivityPlacesService { final ErrorService _errorService = ErrorService(); static String get _apiKey { - return dotenv.env['GOOGLE_MAPS_API_KEY'] ?? ''; + try { + return DefaultFirebaseOptions.currentPlatform.apiKey; + } catch (e) { + LoggerService.error( + 'ActivityPlacesService: Impossible de récupérer la clé API Firebase: $e', + ); + return ''; + } } /// Recherche des activités près d'une destination @@ -107,10 +114,8 @@ class ActivityPlacesService { LoggerService.error( 'ActivityPlacesService: Clé API Google Maps manquante', ); - // Debug: Lister les clés disponibles pour comprendre le problème - final availableKeys = dotenv.env.keys.join(', '); throw Exception( - 'Clé API Google Maps non configurée. Clés disponibles: [$availableKeys]. Platform: ${Platform.isAndroid + 'Clé API Google Maps non configurée dans DefaultFirebaseOptions. Platform: ${Platform.isAndroid ? 'Android' : Platform.isIOS ? 'iOS' diff --git a/pubspec.yaml b/pubspec.yaml index 1bd1fda..6898eac 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 2025.12.1+3 +version: 2025.12.1+4 environment: sdk: ^3.9.2