How I can make mixin class "C" as sealed class cannot be extended outside its library?
class A extends B with C{}
sealed class B{}
mixin class C{}
I don't want C class to be used by a class other than "A" class
How I can make mixin class "C" as sealed class cannot be extended outside its library?
class A extends B with C{}
sealed class B{}
mixin class C{}
I don't want C class to be used by a class other than "A" class
Copyright © 2021 Jogjafile Inc.
There are some tricky ways to accomplish this purpose:
mark your mixin as private mixin as you know (privacy in dart is library level rather than class level) so it can't be used outside it's library.
another way, you can convert your mixin to sealed class which achieve your purpose also, and implement it (multiple inheritance is not allowed in dart: Diamond Problem)
at last, class C can't be used outside the library in which it's declared, there may still other ways to accomplish your purpose. for more info see Class Modifiers Reference
hope it helps you.