5
Hello, I have the following problem in flutter: I currently have an application with the plugin flutter_background_geolocation based on the example that is provided by the plugin. While performing some tests and analyzing the results my teacher requested that I fire two threads with the plugin and implement on the server side a logic to read only one at a time(the second thread would be a reserve for in case the first one fails) the sending and receiving logic has already been implemented. The question that stuck with me was how to implement a second thread in the flutter with that I started researching and I got the following questions:
1) Would the use of omissions be enough to carry out this action? I read that they are not suitable for lengthy things because they are not separate threads but use a system of Event loop similar to the Node.
2) I found in the documentation a function called Compute, but I was in doubt about its implementation and if it would meet me, all the examples I saw of it performed short actions (few seconds) and I need something that will run indefinitely.
3) It would be the use of Platform Channels an option? I believe that is the most complicated but the most robust option.
4) The use of a second thread itself is a good option to ensure the sending of the data? what other possible solutions?
Do an analysis of possible problems to see if it is really necessary to use two threads... Two threads running, is 2x more resource use, is 2x more processing use. What are the reasons for one of them failing? How to ensure that if one fails, the other also will not fail for the same reason? I find it more valid you do very well a control in a single thread than having two with the same purpose.
– Matheus Ribeiro
It was what the teacher responsible for the project requested, I already corrected the mistakes that made fail but he still thinks necessary
– Matheus Lima