I develop a flutter app, define serveral models in 'model' package.
Then I declare a class Example in 'model' for example.
model/example.dart
class Example {
@override
String toString() {
return 'class example';
}
}
test_a.dart
import 'package:example/model/example.dart'
Example testA() {
return Example()
}
test.dart
import 'model/example.dart'
import 'test_a.dart'
test() {
Example example = testA();
if (example is Example) {
print('this class is Example');
} else {
print('$example');
}
}
I will get output class example
If I change from import 'model/example.dart'
to import 'package:example/model/example.dart'
in test.dart, then I will get the output this class is Example
.
So I'm confused what is different between the full path and relative path in dart.