5

I want to do some async operations that involve writing to local database only when the state of the app is InActive or Paused but what if the async operation while it is running and suddenly the app is closed

does that operation still working until it finishes it's task or not ??

Karrar
  • 1,273
  • 3
  • 14
  • 30
  • How exactly are you running said operation? How long does it take? What do you mean by "closed"? – Ryan M Jul 01 '20 at 00:12
  • it might involve a writes to a local database and also might include a http post request to a REST Api @RyanM – Karrar Jul 01 '20 at 00:20
  • Again: How exactly are you running said operation? – Ryan M Jul 01 '20 at 00:21
  • inside the didChangeAppLifecycleState I check if the state is InActive, Paused or detached i run the operation @RyanM – Karrar Jul 01 '20 at 00:22
  • Flutter builds single thread apps. So the if the app is closed it will not be running other tasks. If you are writing to a database, it would finish off the batch write and then close the app, if it didn't do this you would corrupt the database. – Glen Jul 01 '20 at 06:28

1 Answers1

1

No Flutter kills the process when you close the app.

Reference : https://medium.com/mindorks/asynchronous-programming-in-dart-flutter-part-1-dde723332698

Tonny Bawembye
  • 496
  • 5
  • 16