Skip to content

Commit

Permalink
Merge pull request #1913 from tkiyohar/fixMapsCrashingIssue
Browse files Browse the repository at this point in the history
Fix maps crashing issue #1908
  • Loading branch information
c3bryant authored Jan 18, 2023
2 parents 5f72715 + 05f3c2f commit 814169f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
12 changes: 12 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<Future<void>>(() async {
/// Enable crash analytics - https://firebase.flutter.dev/docs/crashlytics/usage#toggle-crashlytics-collection
Expand Down
20 changes: 17 additions & 3 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -1149,4 +1163,4 @@ packages:
version: "3.1.1"
sdks:
dart: ">=2.18.0 <3.0.0"
flutter: ">=2.12.0"
flutter: ">=3.0.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 814169f

Please sign in to comment.