From 429ac970d05a453c5fe7d1df78696e78200b7585 Mon Sep 17 00:00:00 2001 From: tkiyohar <98426739+tkiyohar@users.noreply.github.com> Date: Tue, 10 Jan 2023 17:50:44 -0800 Subject: [PATCH] added fix for maps package --- lib/main.dart | 12 ++++++++++++ pubspec.lock | 20 +++++++++++++++++--- pubspec.yaml | 2 +- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 1ebf812d6..43c82a9bc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -16,6 +16,8 @@ import 'package:hive/hive.dart'; import 'package:hive_flutter/hive_flutter.dart'; import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:google_maps_flutter_android/google_maps_flutter_android.dart'; +import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; late bool showOnboardingScreen; @@ -26,6 +28,16 @@ void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); + AndroidMapRenderer mapRenderer = AndroidMapRenderer.platformDefault; +// ยทยทยท + final GoogleMapsFlutterPlatform mapsImplementation = + GoogleMapsFlutterPlatform.instance; + if (mapsImplementation is GoogleMapsFlutterAndroid) { + WidgetsFlutterBinding.ensureInitialized(); + mapRenderer = await mapsImplementation + .initializeWithRenderer(AndroidMapRenderer.latest); + } + /// Record zoned errors - https://firebase.flutter.dev/docs/crashlytics/usage#zoned-errors runZonedGuarded>(() async { /// Enable crash analytics - https://firebase.flutter.dev/docs/crashlytics/usage#toggle-crashlytics-collection diff --git a/pubspec.lock b/pubspec.lock index 181a70a26..1e21ac3c7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -535,14 +535,28 @@ packages: name: google_maps_flutter url: "https://pub.dartlang.org" source: hosted - version: "2.0.6" + version: "2.2.2" + google_maps_flutter_android: + dependency: transitive + description: + name: google_maps_flutter_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" + google_maps_flutter_ios: + dependency: transitive + description: + name: google_maps_flutter_ios + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.12" google_maps_flutter_platform_interface: dependency: transitive description: name: google_maps_flutter_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.7" + version: "2.2.4" graphs: dependency: transitive description: @@ -1149,4 +1163,4 @@ packages: version: "3.1.1" sdks: dart: ">=2.18.0 <3.0.0" - flutter: ">=2.10.0" + flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index de8457ea4..4c7a22396 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -26,7 +26,7 @@ dependencies: flutter_secure_storage: 5.0.2 flutter_sticky_header: 0.6.0 get: 4.1.4 - google_maps_flutter: 2.0.6 + google_maps_flutter: 2.2.2 hive: 2.0.4 hive_flutter: 1.0.0 intl: 0.17.0