refactor: Replace HubsConstants.googlePlacesApiKey with AppConfig.googlePlacesApiKey for better configuration management
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
|
/// AppConfig class that holds configuration constants for the application.
|
||||||
|
/// This class is used to access various API keys and other configuration values
|
||||||
|
/// throughout the app.
|
||||||
class AppConfig {
|
class AppConfig {
|
||||||
AppConfig._();
|
AppConfig._();
|
||||||
|
|
||||||
|
/// The Google Places API key used for address autocomplete functionality.
|
||||||
static const String googlePlacesApiKey = String.fromEnvironment('GOOGLE_PLACES_API_KEY');
|
static const String googlePlacesApiKey = String.fromEnvironment('GOOGLE_PLACES_API_KEY');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:convert';
|
|||||||
import 'package:firebase_auth/firebase_auth.dart' as firebase;
|
import 'package:firebase_auth/firebase_auth.dart' as firebase;
|
||||||
import 'package:firebase_data_connect/firebase_data_connect.dart';
|
import 'package:firebase_data_connect/firebase_data_connect.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:krow_core/core.dart';
|
||||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||||
import 'package:krow_domain/krow_domain.dart' as domain;
|
import 'package:krow_domain/krow_domain.dart' as domain;
|
||||||
import 'package:krow_domain/krow_domain.dart'
|
import 'package:krow_domain/krow_domain.dart'
|
||||||
@@ -262,7 +263,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
|||||||
<String, String>{
|
<String, String>{
|
||||||
'place_id': placeId,
|
'place_id': placeId,
|
||||||
'fields': 'address_component',
|
'fields': 'address_component',
|
||||||
'key': HubsConstants.googlePlacesApiKey,
|
'key': AppConfig.googlePlacesApiKey,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:design_system/design_system.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_places_flutter/google_places_flutter.dart';
|
import 'package:google_places_flutter/google_places_flutter.dart';
|
||||||
import 'package:google_places_flutter/model/prediction.dart';
|
import 'package:google_places_flutter/model/prediction.dart';
|
||||||
|
import 'package:krow_core/core.dart';
|
||||||
|
|
||||||
import '../../util/hubs_constants.dart';
|
import '../../util/hubs_constants.dart';
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ class HubAddressAutocomplete extends StatelessWidget {
|
|||||||
return GooglePlaceAutoCompleteTextField(
|
return GooglePlaceAutoCompleteTextField(
|
||||||
textEditingController: controller,
|
textEditingController: controller,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
googleAPIKey: HubsConstants.googlePlacesApiKey,
|
googleAPIKey: AppConfig.googlePlacesApiKey,
|
||||||
debounceTime: 500,
|
debounceTime: 500,
|
||||||
countries: HubsConstants.supportedCountries,
|
countries: HubsConstants.supportedCountries,
|
||||||
isLatLngRequired: true,
|
isLatLngRequired: true,
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
import 'package:krow_core/krow_core.dart';
|
|
||||||
|
|
||||||
class HubsConstants {
|
class HubsConstants {
|
||||||
static const String googlePlacesApiKey = AppConfig.googlePlacesApiKey;
|
|
||||||
static const List<String> supportedCountries = <String>['us'];
|
static const List<String> supportedCountries = <String>['us'];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user