Closed yulkin2002 closed 3 years ago
I believe you can wrap createGeohashes with async
to prevent it from blocking you main code.
Future<List<String>> asyncCreateGeohashes(int id) async {
return createGeohashes(id)
check out this for some more examples. let me know is this doesn't work for you and i can look into adding it into the package.
@anovis I tried doing that, but for some reason it still puts everything on hold and I cannot figure out why. One possibility and based on my app behaviour that's probably what is happening, is that it has nothing to do with async and it simply freezes my app while the code executes
hmm without looking at the code its hard too see whats going on, it could be the parts of the screen are waiting for the response so will not render until the future completes.
another option is to use flutter's isolation feature with compute
. this page has some good examples.
for example:
var geohashes = await compute(createGeohashes, params...);
meanwhile i will try to take a look at the function calls for 16km and up with precision of 7 and see if i can come up with any performance improvements
thank you, I will try that out
i took a look at the overall performance and there is not much I can do with high precision and a larger radius. I added some benchmark times to the readme if you want to see the performance for radius 1000 at different precisions.
so I've been doing some testing and once I get to 16km and up with precision of 7, createGeohashes starts taking a while to execute.
this is understandable, but my problem is that it blocks all my other code from executing until it's done processing which is a poor user experience. Is it possible to have it return a Future so all other code can still run while it's generating the results?