Move Bidi static methods to instance methods on TextDirection #11752
Labels
area-pkg
Used for miscellaneous pkg/ packages not associated with specific area- teams.
closed-not-planned
Closed as we don't intend to take action on the reported issue
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by @seaneagan
In package:intl, Bidi acts as a namespace for static methods, which is generally an anti-pattern in dart, since dart libraries can act as namespaces for static methods, so a separate "bidi.dart" library maybe. However, most of these methods are duplicated for both TextDirections (RTL and LTR), so it seems like making them polymorphic to TextDirection would make sense. For a basic idea of what this would look like, see:
https://gist.github.com/seaneagan/5957736
Of course they wouldn't make sense for TextDirection.UNKNOWN, but I don't think TextDirection.UNKNOWN is necessary. I think it would make more sense just to reuse
null
for that concept.Another option would be to keep them as static/top-level methods which receive a TextDirection, but that doesn't feel quite as nice.
The text was updated successfully, but these errors were encountered: