Reputation: 277447
I would like to make packages that do nothing besides exporting a few classes of another library under a different name.
In javascript I could do the following:
export { foo as bar } from 'package'
But I haven't found anything similar in dart
Upvotes: 3
Views: 1677
Reputation: 657761
There is no such thing in Dart.
Imports allow only to show or hide members of the imported library or specify an import prefix.
I can imagine that typedef
s will be extended to do that eventually.
What you can do is to create subclasses
class Dialog extends CupertinoDialog {}
and in another library
class Dialog extends MaterialDialog {}
Conditional imports might be extended at some point to allow importing one or the other library depending on some condition (probably only build-time setting).
Currently it only allows to distinguish platforms like web, server, Flutter as far as I know.
Upvotes: 2