2

I'm trying to save a value back to InheritedWidget before the widget is disposed of,

void disposed() {
  AppInheritedWidget.of(context).update(value);
  super.disposed();
}

but got the following error:

enter image description here

Is there a good way to save value before the widget got destroyed?

I do see that the error message suggest keeping a reference during didChangeDependencies(), but that's like the native mobile way of doing things. Having an instance variable around instead of the flutter way to get the "AppInheritedWidget.of(context)" during build(), not ideal.

Any suggestion?

Nikos Hidalgo
  • 3,666
  • 9
  • 25
  • 39
Panda World
  • 1,704
  • 1
  • 20
  • 28

0 Answers0