Closed jinyus closed 3 months ago
This is just some small improvements to the code.
You don't have to check context.dirty because markNeedsBuild() already does this:
context.dirty
markNeedsBuild()
https://github.com/flutter/flutter/blob/34b454f42dd6f8721dfe43fc7de5d215705b5e52/packages/flutter/lib/src/widgets/framework.dart#L5060
void markNeedsBuild() { //...// if (dirty) { return; } _dirty = true; owner!.scheduleBuildFor(this); }
I should have looked at the code, glad it is an early return.
This is just some small improvements to the code.
You don't have to check
context.dirty
becausemarkNeedsBuild()
already does this:https://github.com/flutter/flutter/blob/34b454f42dd6f8721dfe43fc7de5d215705b5e52/packages/flutter/lib/src/widgets/framework.dart#L5060