-
Notifications
You must be signed in to change notification settings - Fork 80
Closed
Labels
Description
Filing an issue to explore this separately.
Consider if it's easier to have just one class with public API and private API, and then an extension type wrapper that exposes public accessors for the private API, and only expose that extension type to the tools that need access to private API.
That is:
final class Architecture { final String _dartPlatform; // ... } extension type ArchitectureModel(Architecture _) implements Architecture { String get dartPlatform => _._dartPlatform; // Other private API exposed. }That will still prevent casual users, who can't import
ArchitectureModel
directly with reaching intosrc/
, from accessing.dartPlaform
dynamically.
Pro:
- This would avoid having two class hierarchies and casts everywhere.
Con:
- None of the private members can be used for interface calls, so we'll have a bunch of switches.