native icon indicating copy to clipboard operation
native copied to clipboard

[jnigen] What to name the file that exports the whole package

Open HosseinYousefi opened this issue 10 months ago • 3 comments

This is analogous to importing foo.bar.* in Java.

The file is currently named _package.dart and there are currently a few problems with it.

  • A Java class named _package could technically exist.
  • It is only one level deep, so we have import 'foo/bar/_package.dart' but not import 'foo/_package.dart', we should generate this at each level.
  • It's not immediately obvious to the user that _package.dart, especially starting with an underscore is the file to look for.

Some thoughts:

  • *.dart is not supported in Windows so that's not possible
  • In Dart usually the file that exports everything in foo/bar is called bar.dart, but a class bar or Bar could exist which clashes with this name.
  • We could do -.dart or anything that has a dash in it since it won't clash with a class name
  • Same with +.dart or anything with a plus – Maybe this looks the most like import everything?

cc @dcharkes @liamappelbe

HosseinYousefi avatar Mar 05 '25 12:03 HosseinYousefi

Yeah, I pondered this question when we first started this project. And, I still don't know a good solution. 🙃

dcharkes avatar Mar 05 '25 12:03 dcharkes

Is this a configurable option? Making it a config option is an easy work around. Then it doesn't matter so much what the default is.

liamappelbe avatar Mar 05 '25 22:03 liamappelbe

Sure. We could make it configurable as well.

HosseinYousefi avatar Mar 06 '25 08:03 HosseinYousefi