'Is it neccessary to manually dispose?

I heard that if you create something, for example AnimationController, you have to manually dispose it or it will cause memory leak.

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(
      duration: Duration(milliseconds: 300),
    );
  }

  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
  }

Is it still need to do this in today version (2.10.3)?

If it still need, which class I need to manually dispose, how do I know that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source