rodydavis / signals.dart

Reactive programming made simple for Dart and Flutter
http://dartsignals.dev
Apache License 2.0
378 stars 44 forks source link

Minor refactor #228

Closed jinyus closed 3 months ago

jinyus commented 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:

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);
}
rodydavis commented 3 months ago

I should have looked at the code, glad it is an early return.