Skip to content

Commit db28ec5

Browse files
Performance issue on HomePage when creating a new report of any type (#338)
* Revert Utils.dart * Remove Utils.getLocation() * Remove Utils.getLocation * Remove unused import
1 parent 9c68aee commit db28ec5

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

Diff for: lib/utils/Utils.dart

-19
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'package:flutter/cupertino.dart';
88
import 'package:flutter/material.dart';
99
import 'package:flutter_svg/svg.dart';
1010
import 'package:geocoding/geocoding.dart';
11-
import 'package:geolocator/geolocator.dart';
1211
import 'package:google_maps_flutter/google_maps_flutter.dart';
1312
import 'package:in_app_review/in_app_review.dart';
1413
import 'package:mosquito_alert_app/api/api.dart';
@@ -75,23 +74,6 @@ class Utils {
7574
double? lon,
7675
String? locationType,
7776
}) async {
78-
if (lat == null && lon == null) {
79-
bool locationEnabled = await Geolocator.isLocationServiceEnabled();
80-
LocationPermission locPerm = await Geolocator.checkPermission();
81-
bool hasLocationPermission = ![
82-
LocationPermission.denied,
83-
LocationPermission.deniedForever
84-
].contains(locPerm);
85-
86-
if (locationEnabled && hasLocationPermission) {
87-
Position currentPosition = await Geolocator.getCurrentPosition(
88-
desiredAccuracy: LocationAccuracy.high);
89-
lat = currentPosition.latitude;
90-
lon = currentPosition.longitude;
91-
locationType = 'current';
92-
}
93-
}
94-
9577
if (session == null) {
9678
reportsList = [];
9779

@@ -117,7 +99,6 @@ class Utils {
11799

118100
print(language);
119101
session!.id = await ApiSingleton().createSession(session!);
120-
// print("Session: ${jsonEncode(session.toJson())}");
121102
}
122103

123104
if (session!.id != null) {

0 commit comments

Comments
 (0)