use .env for key instead of hardcoding (and rotate key)
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io' show Platform;
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
|
||||||
class Debouncer {
|
class Debouncer {
|
||||||
final int milliseconds;
|
final int milliseconds;
|
||||||
@@ -17,3 +19,7 @@ class Debouncer {
|
|||||||
_timer?.cancel();
|
_timer?.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getGooglePlacesApiKey() {
|
||||||
|
return dotenv.env['GMS_API_KEY'] ?? Platform.environment['GMS_API_KEY'] ?? "";
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_maps_flutter/google_maps_flutter.dart' as gmaps;
|
|
||||||
import 'package:flutter_google_places_sdk/flutter_google_places_sdk.dart'
|
import 'package:flutter_google_places_sdk/flutter_google_places_sdk.dart'
|
||||||
as places;
|
as places;
|
||||||
import 'package:wheres_my_sign/common/constants.dart';
|
import 'package:wheres_my_sign/common/constants.dart';
|
||||||
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
||||||
|
import 'package:wheres_my_sign/common/functions.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:wheres_my_sign/models/property.dart';
|
import 'package:wheres_my_sign/models/property.dart';
|
||||||
@@ -35,9 +35,10 @@ class CustomDialogBoxState extends State<CustomDialogBox> {
|
|||||||
final _addressFocusNode = FocusNode();
|
final _addressFocusNode = FocusNode();
|
||||||
Timer? _debouncer;
|
Timer? _debouncer;
|
||||||
List<places.AutocompletePrediction> _predictions = [];
|
List<places.AutocompletePrediction> _predictions = [];
|
||||||
|
String apiKey = getGooglePlacesApiKey();
|
||||||
|
|
||||||
final places.FlutterGooglePlacesSdk _places = places.FlutterGooglePlacesSdk(
|
final places.FlutterGooglePlacesSdk _places = places.FlutterGooglePlacesSdk(
|
||||||
'AIzaSyBLSUk32a5qGm3M_n9Yii66I7wi0rmA8oM',
|
getGooglePlacesApiKey(),
|
||||||
);
|
);
|
||||||
|
|
||||||
late Property property; // Declare property to store final details
|
late Property property; // Declare property to store final details
|
||||||
|
|||||||
Reference in New Issue
Block a user