Description
I tried to find relevant issues via search but it didn't yield anything similar.
This may be me learning, but I find following behavior really confusing.
For instance, this Dart file:
// lib/src/a.dart
final _a = new A();
class A {}
void doWithA(String from) {
print('Hash code of A from $from: ${_a.hashCode}');
}
Up until now I assumed that _a
would always be the same instance, but it turns out not entirely true and there can actually be multiple instances of _a
depending on how import / export statements are organized in a project.
It is a bit verbose to describe in this issue so I created example project here: https://github.com/pulyaevskiy/library-private-issue
Executing dart lib/main.dart
there prints something like this for me:
Hash code of A from main: 931022103
Hash code of A from B: 85304837
Combination of export and import statements in that project is probably far from perfect and normally should be cleaned up. However it seems dangerous to even allow such scenarios.