diff --git a/android/build.gradle b/android/build.gradle
index 68a64275..fcd7dcdc 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -2,7 +2,7 @@ group 'com.humazed.google_map_location_picker'
version '1.0-SNAPSHOT'
buildscript {
- ext.kotlin_version = '1.3.31'
+ ext.kotlin_version = '1.3.40'
repositories {
google()
jcenter()
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index 56abd65b..10906082 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.humazed.google_map_location_picker_example"
- minSdkVersion 16
+ minSdkVersion 20
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
index a41588c0..7cafa901 100644
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -38,11 +38,11 @@
-
+
+
+
+ android:value="API_KEY" />
diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..1f83a33f
--- /dev/null
+++ b/example/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/example/android/build.gradle b/example/android/build.gradle
index 56ace55b..7c1a7619 100644
--- a/example/android/build.gradle
+++ b/example/android/build.gradle
@@ -6,7 +6,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.6.3'
+ classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties
index 56228224..82d78d74 100644
--- a/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh
new file mode 100755
index 00000000..f5b00c5f
--- /dev/null
+++ b/example/ios/Flutter/flutter_export_environment.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# This is a generated file; do not edit or check into version control.
+export "FLUTTER_ROOT=/Users/blb/Development/flutter"
+export "FLUTTER_APPLICATION_PATH=/Users/blb/Development/google_map_location_picker/example"
+export "COCOAPODS_PARALLEL_CODE_SIGN=true"
+export "FLUTTER_TARGET=lib/main.dart"
+export "FLUTTER_BUILD_DIR=build"
+export "FLUTTER_BUILD_NAME=1.0.0"
+export "FLUTTER_BUILD_NUMBER=1.0.0"
+export "DART_OBFUSCATION=false"
+export "TRACK_WIDGET_CREATION=false"
+export "TREE_SHAKE_ICONS=false"
+export "PACKAGE_CONFIG=.packages"
diff --git a/example/lib/generated/i18n.dart b/example/lib/generated/i18n.dart
index b5e27a19..5636c73b 100644
--- a/example/lib/generated/i18n.dart
+++ b/example/lib/generated/i18n.dart
@@ -11,12 +11,12 @@ import 'package:flutter/material.dart';
class S implements WidgetsLocalizations {
const S();
- static S current;
+ static S? current;
static const GeneratedLocalizationsDelegate delegate =
GeneratedLocalizationsDelegate();
- static S of(BuildContext context) => Localizations.of(context, S);
+ static S? of(BuildContext context) => Localizations.of(context, S);
@override
TextDirection get textDirection => TextDirection.ltr;
@@ -33,7 +33,7 @@ class $en extends S {
const $en();
}
-class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
+class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
const GeneratedLocalizationsDelegate();
List get supportedLocales {
@@ -44,8 +44,8 @@ class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
}
LocaleListResolutionCallback listResolution(
- {Locale fallback, bool withCountry = true}) {
- return (List locales, Iterable supported) {
+ {Locale? fallback, bool withCountry = true}) {
+ return (List? locales, Iterable supported) {
if (locales == null || locales.isEmpty) {
return fallback ?? supported.first;
} else {
@@ -55,29 +55,29 @@ class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
}
LocaleResolutionCallback resolution(
- {Locale fallback, bool withCountry = true}) {
- return (Locale locale, Iterable supported) {
+ {Locale? fallback, bool withCountry = true}) {
+ return (Locale? locale, Iterable supported) {
return _resolve(locale, fallback, supported, withCountry);
};
}
@override
- Future load(Locale locale) {
- final String lang = getLang(locale);
+ Future load(Locale locale) {
+ final String? lang = getLang(locale);
if (lang != null) {
switch (lang) {
case "ar":
S.current = const $ar();
- return SynchronousFuture(S.current);
+ return SynchronousFuture(S.current);
case "en":
S.current = const $en();
- return SynchronousFuture(S.current);
+ return SynchronousFuture(S.current);
default:
// NO-OP.
}
}
S.current = const S();
- return SynchronousFuture(S.current);
+ return SynchronousFuture(S.current);
}
@override
@@ -89,7 +89,7 @@ class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
///
/// Internal method to resolve a locale from a list of locales.
///
- Locale _resolve(Locale locale, Locale fallback, Iterable supported,
+ Locale _resolve(Locale? locale, Locale? fallback, Iterable supported,
bool withCountry) {
if (locale == null || !_isSupported(locale, withCountry)) {
return fallback ?? supported.first;
@@ -125,7 +125,7 @@ class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
// If no country requirement is requested, check if this locale has no country.
if (true != withCountry &&
(supportedLocale.countryCode == null ||
- supportedLocale.countryCode.isEmpty)) {
+ supportedLocale.countryCode!.isEmpty)) {
return true;
}
}
@@ -134,8 +134,8 @@ class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
}
}
-String getLang(Locale l) => l == null
+String? getLang(Locale l) => l == null
? null
- : l.countryCode != null && l.countryCode.isEmpty
+ : l.countryCode != null && l.countryCode!.isEmpty
? l.languageCode
: l.toString();
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 4b345412..b2c19b27 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -3,7 +3,6 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:google_map_location_picker/generated/l10n.dart'
as location_picker;
import 'package:google_map_location_picker/google_map_location_picker.dart';
-import 'package:google_map_location_picker_example/keys.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'generated/i18n.dart';
@@ -16,7 +15,7 @@ class MyApp extends StatefulWidget {
}
class _MyAppState extends State {
- LocationResult _pickedLocation;
+ LocationResult? _pickedLocation;
@override
Widget build(BuildContext context) {
@@ -50,9 +49,9 @@ class _MyAppState extends State {
children: [
RaisedButton(
onPressed: () async {
- LocationResult result = await showLocationPicker(
+ LocationResult? result = await showLocationPicker(
context,
- apiKey,
+ "API_KEY",
initialCenter: LatLng(31.1975844, 29.9598339),
// automaticallyAnimateToCurrentLocation: true,
// mapStylePath: 'assets/mapStyle.json',
diff --git a/example/pubspec.lock b/example/pubspec.lock
index b1713335..39edd966 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -7,14 +7,14 @@ packages:
name: android_intent
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.0.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.5.0"
+ version: "2.8.2"
boolean_selector:
dependency: transitive
description:
@@ -28,14 +28,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.3.1"
clock:
dependency: transitive
description:
@@ -56,7 +56,7 @@ packages:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.0"
+ version: "1.0.3"
fake_async:
dependency: transitive
description:
@@ -80,7 +80,7 @@ packages:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.0.2"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -97,49 +97,70 @@ packages:
name: geolocator
url: "https://pub.dartlang.org"
source: hosted
- version: "6.2.1"
+ version: "8.2.0"
+ geolocator_android:
+ dependency: transitive
+ description:
+ name: geolocator_android
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.1.0"
+ geolocator_apple:
+ dependency: transitive
+ description:
+ name: geolocator_apple
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.1+1"
geolocator_platform_interface:
dependency: transitive
description:
name: geolocator_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.9"
+ version: "4.0.3"
geolocator_web:
dependency: transitive
description:
name: geolocator_web
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.1"
+ version: "2.1.4"
+ geolocator_windows:
+ dependency: transitive
+ description:
+ name: geolocator_windows
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.1.0"
google_map_location_picker:
dependency: "direct dev"
description:
path: ".."
relative: true
source: path
- version: "4.1.6"
+ version: "4.1.7"
google_maps_flutter:
dependency: transitive
description:
name: google_maps_flutter
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.1"
+ version: "2.1.1"
google_maps_flutter_platform_interface:
dependency: transitive
description:
name: google_maps_flutter_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.1.5"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
- version: "0.13.0"
+ version: "0.13.4"
http_parser:
dependency: transitive
description:
@@ -167,14 +188,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.10"
+ version: "0.12.11"
+ material_color_utilities:
+ dependency: transitive
+ description:
+ name: material_color_utilities
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.1.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.7.0"
nested:
dependency: transitive
description:
@@ -188,7 +216,7 @@ packages:
name: package_info
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.0.2"
path:
dependency: transitive
description:
@@ -196,13 +224,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
- pedantic:
- dependency: transitive
- description:
- name: pedantic
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.11.0"
platform:
dependency: transitive
description:
@@ -216,14 +237,14 @@ packages:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.3"
+ version: "2.1.2"
provider:
dependency: transitive
description:
name: provider
url: "https://pub.dartlang.org"
source: hosted
- version: "5.0.0"
+ version: "6.0.2"
sky_engine:
dependency: transitive
description: flutter
@@ -235,7 +256,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0"
+ version: "1.8.1"
stack_trace:
dependency: transitive
description:
@@ -277,7 +298,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.19"
+ version: "0.4.8"
typed_data:
dependency: transitive
description:
@@ -291,7 +312,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.1.1"
sdks:
- dart: ">=2.12.0-259.9.beta <3.0.0"
- flutter: ">=2.0.0"
+ dart: ">=2.15.0 <3.0.0"
+ flutter: ">=2.8.0"
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 862594e4..096e2893 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -4,7 +4,7 @@ publish_to: 'none'
version: 1.0.0
environment:
- sdk: ">=2.2.2 <3.0.0"
+ sdk: '>=2.12.0 <3.0.0'
dependencies:
flutter:
@@ -15,7 +15,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
- cupertino_icons: ^1.0.0
+ cupertino_icons: ^1.0.3
dev_dependencies:
flutter_test:
diff --git a/lib/generated/intl/messages_all.dart b/lib/generated/intl/messages_all.dart
index f633e6ff..b22af192 100644
--- a/lib/generated/intl/messages_all.dart
+++ b/lib/generated/intl/messages_all.dart
@@ -40,7 +40,7 @@ Map _deferredLibraries = {
'tr': () => new Future.value(null),
};
-MessageLookupByLibrary _findExact(String localeName) {
+MessageLookupByLibrary? _findExact(String localeName) {
switch (localeName) {
case 'ar':
return messages_ar.messages;
@@ -91,7 +91,7 @@ bool _messagesExistFor(String locale) {
}
}
-MessageLookupByLibrary _findGeneratedMessagesFor(String locale) {
+MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
onFailure: (_) => null);
if (actualLocale == null) return null;
diff --git a/lib/generated/intl/messages_ar.dart b/lib/generated/intl/messages_ar.dart
index be032a5c..be4ccfb8 100644
--- a/lib/generated/intl/messages_ar.dart
+++ b/lib/generated/intl/messages_ar.dart
@@ -19,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'ar';
- final messages = _notInlinedMessages(_notInlinedMessages);
+ final Map messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => {
"access_to_location_denied" : MessageLookupByLibrary.simpleMessage("تم رفض إذن الوصل الي الموقع الجغرافي"),
"access_to_location_permanently_denied" : MessageLookupByLibrary.simpleMessage("تم رفض إذن الوصل الي الموقع الجغرافي بشكل نهائي"),
diff --git a/lib/generated/intl/messages_de.dart b/lib/generated/intl/messages_de.dart
index 2b6ee3f8..b8df1d3f 100644
--- a/lib/generated/intl/messages_de.dart
+++ b/lib/generated/intl/messages_de.dart
@@ -19,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'de';
- final messages = _notInlinedMessages(_notInlinedMessages);
+ final Map messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => {
"access_to_location_denied" : MessageLookupByLibrary.simpleMessage("Zugriff auf Standort verweigert"),
"access_to_location_permanently_denied" : MessageLookupByLibrary.simpleMessage("Zugriff auf Standort permanent verweigert"),
diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart
index 5bd6290e..dba6fb53 100644
--- a/lib/generated/intl/messages_en.dart
+++ b/lib/generated/intl/messages_en.dart
@@ -19,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';
- final messages = _notInlinedMessages(_notInlinedMessages);
+ final Map messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => {
"access_to_location_denied" : MessageLookupByLibrary.simpleMessage("Access to location denied"),
"access_to_location_permanently_denied" : MessageLookupByLibrary.simpleMessage("Access to location permanently denied"),
diff --git a/lib/generated/intl/messages_es.dart b/lib/generated/intl/messages_es.dart
index 0a301e0c..858ed892 100644
--- a/lib/generated/intl/messages_es.dart
+++ b/lib/generated/intl/messages_es.dart
@@ -19,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'es';
- final messages = _notInlinedMessages(_notInlinedMessages);
+ final Map messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => {
"access_to_location_denied" : MessageLookupByLibrary.simpleMessage("Acceso a la ubicación denegado"),
"access_to_location_permanently_denied" : MessageLookupByLibrary.simpleMessage("Acceso a la ubicación denegado permanentemente"),
diff --git a/lib/generated/intl/messages_fr.dart b/lib/generated/intl/messages_fr.dart
index c3924468..fdd2d342 100644
--- a/lib/generated/intl/messages_fr.dart
+++ b/lib/generated/intl/messages_fr.dart
@@ -19,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'fr';
- final messages = _notInlinedMessages(_notInlinedMessages);
+ final Map messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => {
"access_to_location_denied" : MessageLookupByLibrary.simpleMessage("Accès à l\'emplacement refusé"),
"access_to_location_permanently_denied" : MessageLookupByLibrary.simpleMessage("Accès à l\'emplacement refusé définitivement"),
diff --git a/lib/generated/intl/messages_it.dart b/lib/generated/intl/messages_it.dart
index 969dbf5a..f22c4622 100644
--- a/lib/generated/intl/messages_it.dart
+++ b/lib/generated/intl/messages_it.dart
@@ -19,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'it';
- final messages = _notInlinedMessages(_notInlinedMessages);
+ final Map messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => {
"access_to_location_denied" : MessageLookupByLibrary.simpleMessage("Accesso alla posizione rifiutato"),
"access_to_location_permanently_denied" : MessageLookupByLibrary.simpleMessage("Accesso alla posizione rifiutato permanentemente"),
diff --git a/lib/generated/intl/messages_pt.dart b/lib/generated/intl/messages_pt.dart
index 869c0e3c..1b178bf0 100644
--- a/lib/generated/intl/messages_pt.dart
+++ b/lib/generated/intl/messages_pt.dart
@@ -19,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'pt';
- final messages = _notInlinedMessages(_notInlinedMessages);
+ final Map messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => {
"access_to_location_denied" : MessageLookupByLibrary.simpleMessage("Acesso ao local negado"),
"access_to_location_permanently_denied" : MessageLookupByLibrary.simpleMessage("Acesso ao local negado permanentemente"),
diff --git a/lib/generated/intl/messages_ru.dart b/lib/generated/intl/messages_ru.dart
index ad0dd019..a4e5c343 100644
--- a/lib/generated/intl/messages_ru.dart
+++ b/lib/generated/intl/messages_ru.dart
@@ -19,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'ru';
- final messages = _notInlinedMessages(_notInlinedMessages);
+ final Map messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => {
"access_to_location_denied" : MessageLookupByLibrary.simpleMessage("Доступ к местоположению запрещен"),
"access_to_location_permanently_denied" : MessageLookupByLibrary.simpleMessage("Доступ к местоположению запрещен навсегда"),
diff --git a/lib/generated/intl/messages_sr.dart b/lib/generated/intl/messages_sr.dart
index f7120d17..d2f40758 100644
--- a/lib/generated/intl/messages_sr.dart
+++ b/lib/generated/intl/messages_sr.dart
@@ -19,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'sr';
- final messages = _notInlinedMessages(_notInlinedMessages);
+ final Map messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => {
"access_to_location_denied" : MessageLookupByLibrary.simpleMessage("Onemogućen pristup lokaciji"),
"allow_access_to_the_location_services" : MessageLookupByLibrary.simpleMessage("Omogućite pristup Vašoj lokaciji"),
diff --git a/lib/generated/intl/messages_tr.dart b/lib/generated/intl/messages_tr.dart
index 690a4d2a..87db67f6 100644
--- a/lib/generated/intl/messages_tr.dart
+++ b/lib/generated/intl/messages_tr.dart
@@ -19,7 +19,7 @@ typedef String MessageIfAbsent(String messageStr, List args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'tr';
- final messages = _notInlinedMessages(_notInlinedMessages);
+ final Map messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => {
"access_to_location_denied" : MessageLookupByLibrary.simpleMessage("Konum erişimi reddedildi"),
"access_to_location_permanently_denied" : MessageLookupByLibrary.simpleMessage("Konuma erişim kalıcı olarak reddedildi"),
diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart
index 5591ce10..3558b672 100644
--- a/lib/generated/l10n.dart
+++ b/lib/generated/l10n.dart
@@ -15,7 +15,7 @@ import 'intl/messages_all.dart';
class S {
S();
- static S current;
+ static late S current;
static const AppLocalizationDelegate delegate =
AppLocalizationDelegate();
@@ -31,7 +31,7 @@ class S {
});
}
- static S of(BuildContext context) {
+ static S? of(BuildContext context) {
return Localizations.of(context, S);
}
diff --git a/lib/src/google_map_location_picker.dart b/lib/src/google_map_location_picker.dart
index b06dfda0..30d1511d 100644
--- a/lib/src/google_map_location_picker.dart
+++ b/lib/src/google_map_location_picker.dart
@@ -22,7 +22,7 @@ import 'utils/location_utils.dart';
class LocationPicker extends StatefulWidget {
LocationPicker(
this.apiKey, {
- Key key,
+ Key? key,
this.initialCenter,
this.initialZoom,
this.requiredGPS,
@@ -44,28 +44,28 @@ class LocationPicker extends StatefulWidget {
final String apiKey;
- final LatLng initialCenter;
- final double initialZoom;
- final List countries;
+ final LatLng? initialCenter;
+ final double? initialZoom;
+ final List? countries;
- final bool requiredGPS;
- final bool myLocationButtonEnabled;
- final bool layersButtonEnabled;
- final bool automaticallyAnimateToCurrentLocation;
+ final bool? requiredGPS;
+ final bool? myLocationButtonEnabled;
+ final bool? layersButtonEnabled;
+ final bool? automaticallyAnimateToCurrentLocation;
- final String mapStylePath;
+ final String? mapStylePath;
- final Color appBarColor;
- final BoxDecoration searchBarBoxDecoration;
- final String hintText;
- final Widget resultCardConfirmIcon;
- final Alignment resultCardAlignment;
- final Decoration resultCardDecoration;
- final EdgeInsets resultCardPadding;
+ final Color? appBarColor;
+ final BoxDecoration? searchBarBoxDecoration;
+ final String? hintText;
+ final Widget? resultCardConfirmIcon;
+ final Alignment? resultCardAlignment;
+ final Decoration? resultCardDecoration;
+ final EdgeInsets? resultCardPadding;
- final String language;
+ final String? language;
- final LocationAccuracy desiredAccuracy;
+ final LocationAccuracy? desiredAccuracy;
@override
LocationPickerState createState() => LocationPickerState();
@@ -73,12 +73,12 @@ class LocationPicker extends StatefulWidget {
class LocationPickerState extends State {
/// Result returned after user completes selection
- LocationResult locationResult;
+ LocationResult? locationResult;
/// Overlay to display autocomplete suggestions
- OverlayEntry overlayEntry;
+ OverlayEntry? overlayEntry;
- List nearbyPlaces = List();
+ List nearbyPlaces = [];
/// Session token required for autocomplete API call
String sessionToken = Uuid().generateV4();
@@ -94,7 +94,7 @@ class LocationPickerState extends State {
/// Hides the autocomplete overlay
void clearOverlay() {
if (overlayEntry != null) {
- overlayEntry.remove();
+ overlayEntry!.remove();
overlayEntry = null;
}
}
@@ -112,14 +112,14 @@ class LocationPickerState extends State {
if (place.length < 1) return;
- final RenderBox renderBox = context.findRenderObject();
+ final RenderBox renderBox = context.findRenderObject() as RenderBox;
Size size = renderBox.size;
- final RenderBox appBarBox = appBarKey.currentContext.findRenderObject();
+ final RenderBox? appBarBox = appBarKey.currentContext!.findRenderObject() as RenderBox?;
overlayEntry = OverlayEntry(
builder: (context) => Positioned(
- top: appBarBox.size.height,
+ top: appBarBox!.size.height,
width: size.width,
child: Material(
elevation: 1,
@@ -146,7 +146,7 @@ class LocationPickerState extends State {
),
);
- Overlay.of(context).insert(overlayEntry);
+ Overlay.of(context)!.insert(overlayEntry!);
autoCompleteSearch(place);
}
@@ -159,7 +159,7 @@ class LocationPickerState extends State {
// Currently, you can use components to filter by up to 5 countries. from https://developers.google.com/places/web-service/autocomplete
String regionParam = countries?.isNotEmpty == true
- ? "&components=country:${countries.sublist(0, min(countries.length, 5)).join('|country:')}"
+ ? "&components=country:${countries!.sublist(0, min(countries.length, 5)).join('|country:')}"
: "";
var endpoint =
@@ -169,12 +169,12 @@ class LocationPickerState extends State {
"language=${widget.language}";
if (locationResult != null) {
- endpoint += "&location=${locationResult.latLng.latitude}," +
- "${locationResult.latLng.longitude}";
+ endpoint += "&location=${locationResult!.latLng!.latitude}," +
+ "${locationResult!.latLng!.longitude}";
}
LocationUtils.getAppHeaders()
- .then((headers) => http.get(Uri.parse(endpoint), headers: headers))
+ .then((headers) => http.get(Uri.parse(endpoint), headers: headers as Map?))
.then((response) {
if (response.statusCode == 200) {
Map data = jsonDecode(response.body);
@@ -214,7 +214,7 @@ class LocationPickerState extends State {
/// To navigate to the selected place from the autocomplete list to the map,
/// the lat,lng is required. This method fetches the lat,lng of the place and
/// proceeds to moving the map to that location.
- void decodeAndSelectPlace(String placeId) {
+ void decodeAndSelectPlace(String? placeId) {
clearOverlay();
final endpoint =
@@ -223,7 +223,7 @@ class LocationPickerState extends State {
'&language=${widget.language}';
LocationUtils.getAppHeaders()
- .then((headers) => http.get(Uri.parse(endpoint), headers: headers))
+ .then((headers) => http.get(Uri.parse(endpoint), headers: headers as Map?))
.then((response) {
if (response.statusCode == 200) {
Map location =
@@ -240,17 +240,17 @@ class LocationPickerState extends State {
/// Display autocomplete suggestions with the overlay.
void displayAutoCompleteSuggestions(List suggestions) {
- final RenderBox renderBox = context.findRenderObject();
+ final RenderBox renderBox = context.findRenderObject() as RenderBox;
Size size = renderBox.size;
- final RenderBox appBarBox = appBarKey.currentContext.findRenderObject();
+ final RenderBox? appBarBox = appBarKey.currentContext!.findRenderObject() as RenderBox?;
clearOverlay();
overlayEntry = OverlayEntry(
builder: (context) => Positioned(
width: size.width,
- top: appBarBox.size.height,
+ top: appBarBox!.size.height,
child: Material(
elevation: 1,
child: Column(
@@ -260,7 +260,7 @@ class LocationPickerState extends State {
),
);
- Overlay.of(context).insert(overlayEntry);
+ Overlay.of(context)!.insert(overlayEntry!);
}
/// Utility function to get clean readable name of a location. First checks
@@ -292,7 +292,7 @@ class LocationPickerState extends State {
"location=${latLng.latitude},${latLng.longitude}&radius=150" +
"&language=${widget.language}";
- return http.get(Uri.parse(endpoint), headers: headers);
+ return http.get(Uri.parse(endpoint), headers: headers as Map?);
}).then((response) {
if (response.statusCode == 200) {
nearbyPlaces.clear();
@@ -330,14 +330,14 @@ class LocationPickerState extends State {
"&language=${widget.language}";
final response = await http.get(Uri.parse(endpoint),
- headers: await LocationUtils.getAppHeaders());
+ headers: await (LocationUtils.getAppHeaders() as FutureOr