I hope you you guys are happy and healthy ...well about me i
I am facing an issue with flutter app that it crashes very unexpectedly, this happens when I move from one screen to another. It is not crashing everytime when I am navigating to some other screen But sometimes it crashes with the following error
E/AndroidRuntime(30864): FATAL EXCEPTION: GLThread 53842
E/AndroidRuntime(30864): Process: com.example.customer, PID: 30864
E/AndroidRuntime(30864): java.lang.NullPointerException: Attempt to get length of null array
E/AndroidRuntime(30864): at java.nio.ByteBufferAsIntBuffer.put(ByteBufferAsIntBuffer.java:122)
E/AndroidRuntime(30864): at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.j.l(:com.google.android.gms.dynamite_mapsdynamite@231312028@23.13.12 (100400-0):2)
E/AndroidRuntime(30864): at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.j.o(:com.google.android.gms.dynamite_mapsdynamite@231312028@23.13.12 (100400-0):1)
E/AndroidRuntime(30864): at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.j.g(:com.google.android.gms.dynamite_mapsdynamite@231312028@23.13.12 (100400-0):3)
E/AndroidRuntime(30864): at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ai.s(:com.google.android.gms.dynamite_mapsdynamite@231312028@23.13.12 (100400-0):27)
E/AndroidRuntime(30864): at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.s(:com.google.android.gms.dynamite_mapsdynamite@231312028@23.13.12 (100400-0):10)
E/AndroidRuntime(30864): at com.google.maps.api.android.lib6.gmm6.vector.bx.s(:com.google.android.gms.dynamite_mapsdynamite@231312028@23.13.12 (100400-0):29)
E/AndroidRuntime(30864): at com.google.maps.api.android.lib6.gmm6.vector.bq.b(:com.google.android.gms.dynamite_mapsdynamite@231312028@23.13.12 (100400-0):151)
E/AndroidRuntime(30864): at com.google.maps.api.android.lib6.gmm6.vector.at.run(:com.google.android.gms.dynamite_mapsdynamite@231312028@23.13.12 (100400-0):48)
D/OOMEventManagerFK(30864): checkEventAndDumpForJE: 0
I/Process (30864): Sending signal. PID: 30864 SIG: 9
I really do not have any other hints that why it is happening
But yes 1 thing I could say that 99.99% of time it is crashing while navigating to HomeScreen only...sometimes it build homescreen
Then it crashes
Sometimes it just crashes on the way to home screen
Sometimes it crashes while poping to home screen Navigator.pop(context);
Additionally I am using sockets in this projects..even thought any have doesn't have nothing to do with homescreen
@override
void initState() {
checkIfPermissionAllowed();
futurePrevSearches = getprevSearches();
super.initState();
}
This is initstate of HomeScreen that I am talking about
checkIfPermissionAllowed() async {
_locationPermission = await Geolocator.requestPermission();
if (_locationPermission == LocationPermission.denied) {
_locationPermission = await Geolocator.requestPermission();
if (_locationPermission == LocationPermission.denied) {
checkIfPermissionAllowed();
} else if (_locationPermission == LocationPermission.deniedForever) {
return;
} else if (_locationPermission == LocationPermission.unableToDetermine) {}
}
}
`
Future<PrevSearches> getprevSearches() async {
String url = '$baseUrl/api/user/previousSearches';
Map<String, String> headers = {'Authorization': 'Bearer ${widget.token}'};
try {
http.Response response = await http.get(Uri.parse(url), headers: headers);
if (response.statusCode == 200) {
log(response.body);
final prevSearches = prevSearchesFromMap(response.body);
return prevSearches;
} else {
// return Container();
throw 'Error calling API';
}
} catch (err) {
log(err.toString());
rethrow;
}
// return PrevSearches(previous: []);
// return null;
}
well i can see something related to google maps in that error log that you can see...i am using google maps in this project
Any hints or something that would help me resolving this issue will be appreciated, let me know if i need to share anything else. Thank Coders `