feat: Switch API key retrieval from flutter_dotenv to firebase_options.dart and update build version.
All checks were successful
Deploy Flutter to Firebase (Mac) / deploy-android (push) Successful in 3m4s
All checks were successful
Deploy Flutter to Firebase (Mac) / deploy-android (push) Successful in 3m4s
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user