What is the difference between diactivate() and dispose()?

pleas, i couldn’t catch the difference between the diactivate and dispose method in flutter and when the widget is deleted permanently and when it deleted temporarily from the widget tree. can any one help,please?

Screen Shot 2021-10-30 at 9.38.41 AM

@belalgamal hello!

  • deactivate is called when the widget is removed from the tree. However the framework may decide to reinsert into another part of the widget tree. For example, when you are reordering a list of items!
  • dispose is called when the widget is removed from the tree permanently! The life cycle of this is terminated.

For more info you can dive deeper into the flutter documentation!

2 Likes

thanks a lot for your explanation :heart_eyes: