Skip to content

RenderObject is not updated when users provide new values #112038

@fzyzcjy

Description

@fzyzcjy

Hi thanks for the wonderful framework! I am filing a series of PRs to fix a category of bugs: RenderObject will not be updated when users provide new values.

Bug description: As we know, when implementing a RenderObjectWidget, we need to correctly implement createRenderObject and updateRenderObject. If we forget to set a field in updateRenderObject, that value will never be updated when user provides new values, i.e. a bug.

How I find it: At dart-code-checker/dart-code-metrics#996, I proposed that we could write a linter to automatically check updateRenderObject should be consistent with createRenderObject, and apply the linter to flutter framework. Then, in dart-code-checker/dart-code-metrics#1004, @incendial implemented it and applied it. Then the bugs were founds.

Thus, thanks for @incendial for implementing the linter and running it to scan flutter code!

By the way, I split the work into multiple PRs, because Flutter's official contributing guide points to this article, saying that:

One PR for one fix, no matter how small the fix is. Consider if you land three changes in a single PR, and due to some reasons maintainers need to revert one change, your other two changes will also get reverted along with it. It also helps the team to keep track of changes and review them easily.

So I submit one PR for one fix.

Related PRs:

Metadata

Metadata

Assignees

No one assigned

    Labels

    frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions