How to resolve ( '_debugLifecycleState != _ElementLifecycle.defunct': is not true. ) error?

02.09.2020 14:16

How to resolve ( '_debugLifecycleState != _ElementLifecycle.defunct': is not true. ) error?

The first day I started working with animations in Flutter I encountered "'_debugLifecycleState! = _ElementLifecycle.defunct': is not true." I found the solution of the error after a short research.

The reason for this error is that the controler still work even though we left the current page. This creates errors in the background.

'_debugLifecycleState! = _ElementLifecycle.defunct': is not true. As a very simple method to solve the error, we just need to dispose the controller inside the dispose method.