Skip to content

Conversation

paraflu
Copy link

@paraflu paraflu commented Sep 13, 2024

I've overrided the didUpdateWidget and seem work.

@override
  void didUpdateWidget(covariant oldWidget) {
    print("didUpdateWidget json ${widget.json}");
    print("didUpdateWidget data: $_data");
    _data = jsonDecode(widget.json);
    super.didUpdateWidget(oldWidget);
  }

@paraflu paraflu changed the title Develop fix #3 Sep 13, 2024
@henry-hoang-91
Copy link

It only works if edit mode is tree, for support text mode you must update also value in _controller :

_controller.text = _stringifyData(_data, 0, true);

completed code:

@override
  void didUpdateWidget(covariant oldWidget) {
    print("didUpdateWidget json ${widget.json}");
    print("didUpdateWidget data: $_data");
    _data = jsonDecode(widget.json);
    _controller.text = _stringifyData(_data, 0, true);
    super.didUpdateWidget(oldWidget);
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants