feat: Integrate dotenv for environment variable management and update .gitignore
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:geolocator/geolocator.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'dart:ui' as ui;
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
class MapContent extends StatefulWidget {
|
||||
const MapContent({super.key});
|
||||
@@ -25,7 +26,7 @@ class _MapContentState extends State<MapContent> {
|
||||
|
||||
List<PlaceSuggestion> _suggestions = [];
|
||||
|
||||
static const String _apiKey = 'AIzaSyBPxanjGyrWVjI4-hZmi086VdQFSEYT_2U';
|
||||
static final String _apiKey = dotenv.env['GOOGLE_MAPS_API_KEY'] ?? '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:travel_mate/services/error_service.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'blocs/auth/auth_bloc.dart';
|
||||
import 'blocs/auth/auth_event.dart';
|
||||
import 'blocs/auth/auth_state.dart';
|
||||
import 'blocs/theme/theme_bloc.dart';
|
||||
import 'blocs/theme/theme_event.dart';
|
||||
import 'blocs/theme/theme_state.dart';
|
||||
@@ -22,6 +22,7 @@ import 'pages/resetpswd.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await dotenv.load(fileName: ".env");
|
||||
await Firebase.initializeApp();
|
||||
|
||||
runApp(const MyApp());
|
||||
|
||||
Reference in New Issue
Block a user