OP correction.
What?
Under the plasma tab, where if you enter the beneficiary address, entering the amount resets the beneficiary address to the current selected address, and you need to change it again.
Why?
A widget’s state is stored in a State
object, separating the widget’s state from its appearance. The state consists of values that can change, like a slider’s current value or whether a checkbox is checked. When the widget’s state changes, the state object calls setState()
, telling the framework to redraw the widget.
The setState()
is called when the amount changes, causing a redraw of the widget.
The beneficiary address is initialized in the build method. A redraw will initialize and consequently overwrite the beneficiary address to the currently selected address. Effectivly overwriting changes made to beneficiary address everytime the amount changes.
How?
By subscribing to the PlasmaBeneficiaryAddressNotifier
in the initState
method, will initializes the beneficiary address one time and overwrite it when the selected address changes and not when the widget gets rebuild.
Anything else?
Using Provider.of<>() within the initState
method requires listen to be false.
The PlasmaBeneficiaryAddressNotifier
ends up with multiple listeners when using an anonymous method which could introduce a memory leak.
Implementation
https://github.com/KingGorrin/syrius/tree/fix-fusing-addr-reset