-
Notifications
You must be signed in to change notification settings - Fork 23
Use late final for _timer fields #53
Conversation
The field in `AnsiProgress`had been non-final so that it could be initialized in the constructor, the initialization expression needs access to `this`. With null safety this pattern can be expressed with a `late final` field. The field in `VerboseLogger` could have been `final` before the migration. Append `-dev` to the version since this can't be published until it is rolled and validated internally.
pq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, nice!
I didn't know about this pattern. I'll have to read-up.
Thanks!
pubspec.yaml
Outdated
| @@ -1,5 +1,5 @@ | |||
| name: cli_util | |||
| version: 0.3.0-nullsafety.0 | |||
| version: 0.3.0-nullsafety.0-dev | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the goal is to publish this once it rolls through the sdk etc, so we likely don't need the -dev here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we could also drop the -dev and publish after the role - we wouldn't need to wait for a subsequent sync for a changelog and pubspec change, and it gives us more of a signal to verify things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya I just question if its worth doing this for every single package or not?
Not sure what precedent we want to set here, I can see it either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that our existing guidelines do not say to do this (they suggest doing what @pq already did and just waiting to publish until the internal validation happens)
Optimistically we'll publish right after validation.
The field in `AnsiProgress`had been non-final so that it could be initialized in the constructor, the initialization expression needs access to `this`. With null safety this pattern can be expressed with a `late final` field. The field in `VerboseLogger` could have been `final` before the migration.
The field in
AnsiProgresshad been non-final so that it could beinitialized in the constructor, the initialization expression needs
access to
this. With null safety this pattern can be expressed with alate finalfield.The field in
VerboseLoggercould have beenfinalbefore themigration.
Append
-devto the version since this can't be published until it isrolled and validated internally.