Use DiagnosticableMixin instead of Diagnosticable for some conditionals.#49726
Use DiagnosticableMixin instead of Diagnosticable for some conditionals.#49726gspencergoog merged 2 commits intoflutter:masterfrom
Conversation
…able, and deprecate Diagnosticable
8d31967 to
73759dd
Compare
|
Actually, after doing the "full" fix here, it occurred to me that there is a simpler fix to the original problem, although it still doesn't fix the structural issues with the way We can just change class DiagnosticableNode<T extends DiagnosticableMixin> extends DiagnosticsNode {and change DiagnosticsNode toDiagnosticsNode({ String name, DiagnosticsTreeStyle style }) {
return DiagnosticableNode<DiagnosticableMixin>(
name: name,
value: this,
style: style,
);
}That wouldn't be a breaking change, and nothing gets deprecated. It does leave a pitfall for people that use |
ds84182
left a comment
There was a problem hiding this comment.
LGTM
Later on, would it be useful to switch the names? With generalized typedefs I think you'd be able to do
mixin Diagnosticable {...}
@Deprecated(...)
typedef DiagnosticableMixin = Diagnosticable;to move everyone over to the new name.
|
I don't think I'd switch the names back, simply because Flutter has a convention of naming mixins with the suffix "Mixin", and What would you think of me doing the simpler change I mentioned in #49726 (comment)? |
|
Gotcha. Having them both around seems like a potential foot-gun, so I think
it's better to have one way of adding DiagnosticableMixin to a class.
…On Wed, Jan 29, 2020, 1:08 PM Greg Spencer ***@***.***> wrote:
I don't think I'd switch the names back, simply because Flutter has a
convention of naming mixins with the suffix "Mixin", and mixin
Diagnosticable wouldn't follow that convention.
What would you think of doing the simpler change I mentioned in #49726
(comment)
<#49726 (comment)>?
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#49726?email_source=notifications&email_token=AARJWZISBJYOHSFWLBLBTA3RAHV47A5CNFSM4KNKYQNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKIX2VA#issuecomment-579960148>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARJWZMLZWQXA54PNLSXF3DRAHV47ANCNFSM4KNKYQNA>
.
|
|
OK, I think deprecating and removing Things like the dart linter will stop reporting lints for Once I commit the simple fix, then I can switch other classes without any breakage, so that when I commit a change that changes the type of the widgets, nothing will stop working. I've reverted the changes that switch widgets to use the mixin, and added |
196553a to
bdfcb32
Compare
bdfcb32 to
c25e02c
Compare
|
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Description
As the code is right now, if you try and print diagnostics for a
Shortcutswidget that has amanagerset (aShortcutManager), it will fail at runtime. This code:will fail with this exception:
The reasons for this are explained in #49647 (comment)
This PR fixes this by changing
DiagnosticableMixin.toDiagnosticsNodeand other things to acceptDiagnosticableMixininstead of requiringDiagnosticable.Eventually, after making some changes to the linter and some other external repos, we can deprecate and them remove
Diagnosticableentirely and just have the mixin.Related Issues
Tests
diagnostics_test.dart, although no functionality changed.Breaking Change