Handle expensive or long-running tasks with an isolate to prevent an app from freezing

This article shows a simple and steady illustration of how to use an Isolate.

  • The picture below shows that the app freezes when performing an expensive or long-running task.

The code below will make the app freeze

  • App free from freezing when performing an expensive/long-running task with an Isolate.

The code below will make the app free from freezing. Note that the method should be declared at the top level.

To see the full implementation, please click on the link below.

check heavy_task_without_isolate branch for the implementation performed without an isolate

check heavy_task_with_isolate branch for the implementation performed with an isolate