Do I need to dispose mobx's `autorun` instance in Dart and how?

531

If you are using stateful widget, you can dispose autorun at dispose method of the stateful widget. When flutter disposes the widget, your autorun will also be disposed automatically.

Share:
531
Schultz9999
Author by

Schultz9999

Chronological development of my language skills: - Russian - Basic - Pascal - Object Pascal - Assembler - C++ - SQL - English - Java - C#, .NET - Objective C - ???

Updated on December 17, 2022

Comments

  • Schultz9999
    Schultz9999 over 1 year

    I am initializing an instance of a class and starting observing an array of things with autorun. This method returns a disposer. It appears from my experience with Typescript, I need at some point to dispose of this instance or I risk to run into memory leaks. If that's the case, what are my options in Dart? Other than a dispose method called on-demand, I see no other clean way.