You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Design / types section of the style guide gives recommendations when and how to extend or mixin classes from other packages. However, using implements on a class from another package can also lead to errors, if that package uses is expressions to guard accesses to protected class members.
I just encountered this problem while working with package:built_collection. I want to write a class that implements BuiltSet, but doing that would break this line.
I guess the only way to resolve this is
AVOID implementing a class that isn’t intended to be implemented.
The other option,
DO guard accesses to protected members with a obj.runtimeType == MyClass check
would solve the implements problem, but is unnecessarily restrictive in the extends case.
Best regards,
Philipp
The text was updated successfully, but these errors were encountered:
munificent
changed the title
style guide: add recommendation when to implement 3rd party class interfaces
Style guidelines for allowing implementing interfaces
Apr 2, 2018
The Design / types section of the style guide gives recommendations when and how to
extend
ormixin
classes from other packages. However, usingimplements
on a class from another package can also lead to errors, if that package usesis
expressions to guard accesses to protected class members.I just encountered this problem while working with package:built_collection. I want to write a class that implements
BuiltSet
, but doing that would break this line.I guess the only way to resolve this is
The other option,
would solve the
implements
problem, but is unnecessarily restrictive in theextends
case.Best regards,
Philipp
The text was updated successfully, but these errors were encountered: