dart-lang / sdk

The Dart SDK, including the VM, dart2js, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
9.94k stars 1.53k forks source link

false negative/positive `uri_does_not_exist` with relative imports #50198

Open tenhobi opened 1 year ago

tenhobi commented 1 year ago

flutter analyze, dart analyze etc. don't show uri_does_not_exist in the output when using relative imports. Android Studio, on the other hand, offers this information.

Consider import '../../shared/router/router.dart'; as the correct import path. These should be wrong:

are ergo wrong paths and the analyzer should mark them as errors. But it say nothing about them. IDE (Android Studio) on the other hand marks it as an error (uri_does_not_exist). VS Code does not.

There are two issues with this: 1) why Android Studio and analyzer have different results? 2) how can I use even import '../../../../../../../../../../../../../../../../../../../../shared/router/router.dart'; and it still compiles and work all right? 🤡

> fvm flutter --version

Flutter 3.3.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision e3c29ec00c (4 weeks ago) • 2022-09-14 08:46:55 -0500
Engine • revision a4ff2c53d8
Tools • Dart 2.18.1 • DevTools 2.15.0
> fvm flutter analyze .\lib\alpha\beta\gama.dart --fatal-infos --fatal-warnings

Analyzing gama.dart...
No issues found! (ran in 2.7s)

But if I change the input import '../../../shared/router/routerx.dart'; (added letter x), the analyzer suddenly starts to recognize the path as not existing.

> fvm flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.2, on Microsoft Windows [Version 10.0.22623.741], locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.5)
[✓] Android Studio (version 2021.3)
[!] Android Studio (version 2022.2)
    ✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2)
[✓] VS Code (version 1.72.1)
[✓] Connected device (4 available)
[✓] HTTP Host Availability
Verbose analyze log ```bash > fvm flutter analyze .\lib\alpha\beta\gama.dart --fatal-infos --fatal-warnings --verbose [ +61 ms] executing: [C:\Users\Honza\fvm\versions\3.3.2/] git -c log.showSignature=false log -n 1 --pretty=format:%H [ +88 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H [ ] e3c29ec00c9c825c891d75054c63fcc46454dca1 [ ] executing: [C:\Users\Honza\fvm\versions\3.3.2/] git tag --points-at e3c29ec00c9c825c891d75054c63fcc46454dca1 [ +72 ms] Exit code 0 from: git tag --points-at e3c29ec00c9c825c891d75054c63fcc46454dca1 [ ] 3.3.2 [ +41 ms] executing: [C:\Users\Honza\fvm\versions\3.3.2/] git rev-parse --abbrev-ref --symbolic @{upstream} [ +144 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream} [ ] origin/stable [ ] executing: [C:\Users\Honza\fvm\versions\3.3.2/] git ls-remote --get-url origin [ +59 ms] Exit code 0 from: git ls-remote --get-url origin [ ] https://github.com/flutter/flutter.git [ +89 ms] executing: [C:\Users\Honza\fvm\versions\3.3.2/] git rev-parse --abbrev-ref HEAD [ +62 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ ] stable [ +78 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +42 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update. [ ] Artifact Instance of 'GradleWrapper' is not required, skipping update. [ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ ] Artifact Instance of 'FlutterSdk' is not required, skipping update. [ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update. [ ] Artifact Instance of 'PubDependencies' is not required, skipping update. [ +48 ms] Skipping pub get: version match. [ +44 ms] Found plugin better_open_file at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\better_open_file-3.6.3\ [ +39 ms] Found plugin device_info_plus at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus-4.1.2\ [ +2 ms] Found plugin device_info_plus_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_linux-3.0.0\ [ +2 ms] Found plugin device_info_plus_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_macos-3.0.0\ [ +3 ms] Found plugin device_info_plus_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_web-3.0.0\ [ +2 ms] Found plugin device_info_plus_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_windows-4.0.0\ [ +20 ms] Found plugin file_picker at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-5.0.1\ [ +8 ms] Found plugin firebase_analytics at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_analytics-9.3.3\ [ +3 ms] Found plugin firebase_analytics_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_analytics_web-0.4.2+3\ [ +2 ms] Found plugin firebase_core at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_core-1.21.1\ [ +3 ms] Found plugin firebase_core_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_core_web-1.7.2\ [ +2 ms] Found plugin firebase_crashlytics at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_crashlytics-2.8.9\ [ +4 ms] Found plugin firebase_messaging at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_messaging-12.0.3\ [ +5 ms] Found plugin firebase_messaging_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_messaging_web-3.1.3\ [ +2 ms] Found plugin firebase_performance at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_performance-0.8.2+4\ [ +3 ms] Found plugin firebase_performance_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_performance_web-0.1.1+4\ [ +4 ms] Found plugin flutter_bugfender at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_bugfender-2.1.0\ [ +1 ms] Found plugin flutter_downloader at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_downloader-1.8.3\ [ +11 ms] Found plugin flutter_plugin_android_lifecycle at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-2.0.7\ [ +1 ms] Found plugin flutter_secure_storage at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage-5.1.2\ [ +1 ms] Found plugin flutter_secure_storage_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_linux-1.1.1\ [ +2 ms] Found plugin flutter_secure_storage_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_macos-1.1.1\ [ +2 ms] Found plugin flutter_secure_storage_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_web-1.0.2\ [ +2 ms] Found plugin flutter_secure_storage_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_windows-1.1.2\ [ +21 ms] Found plugin image_picker at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker-0.8.5+3\ [ +1 ms] Found plugin image_picker_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker_android-0.8.5+2\ [ +1 ms] Found plugin image_picker_for_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker_for_web-2.1.8\ [ +1 ms] Found plugin image_picker_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker_ios-0.8.5+6\ [ +22 ms] Found plugin package_info_plus at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus-1.4.3+1\ [ +1 ms] Found plugin package_info_plus_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_linux-1.0.5\ [ +1 ms] Found plugin package_info_plus_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_macos-1.3.0\ [ +2 ms] Found plugin package_info_plus_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_web-1.0.5\ [ +1 ms] Found plugin package_info_plus_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_windows-2.0.0\ [ +5 ms] Found plugin path_provider at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider-2.0.11\ [ +1 ms] Found plugin path_provider_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_android-2.0.20\ [ +1 ms] Found plugin path_provider_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_ios-2.0.11\ [ +1 ms] Found plugin path_provider_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_linux-2.1.7\ [ +1 ms] Found plugin path_provider_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_macos-2.0.6\ [ +2 ms] Found plugin path_provider_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_windows-2.1.2\ [ +10 ms] Found plugin shared_preferences at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-2.0.15\ [ +1 ms] Found plugin shared_preferences_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_android-2.0.12\ [ +1 ms] Found plugin shared_preferences_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_ios-2.1.1\ [ +1 ms] Found plugin shared_preferences_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_linux-2.1.1\ [ +1 ms] Found plugin shared_preferences_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_macos-2.0.4\ [ +2 ms] Found plugin shared_preferences_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_web-2.0.4\ [ +1 ms] Found plugin shared_preferences_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_windows-2.1.1\ [ +11 ms] Found plugin sqlcipher_flutter_libs at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\sqlcipher_flutter_libs-0.5.1\ [ +10 ms] Found plugin url_launcher at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher-6.1.5\ [ +1 ms] Found plugin url_launcher_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_android-6.0.17\ [ +1 ms] Found plugin url_launcher_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_ios-6.0.17\ [ +1 ms] Found plugin url_launcher_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_linux-3.0.1\ [ +1 ms] Found plugin url_launcher_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_macos-3.0.1\ [ +1 ms] Found plugin url_launcher_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_web-2.0.13\ [ +1 ms] Found plugin url_launcher_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_windows-3.0.1\ [ +2 ms] Found plugin video_player at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player-2.4.7\ [ +1 ms] Found plugin video_player_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player_android-2.3.9\ [ +1 ms] Found plugin video_player_avfoundation at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player_avfoundation-2.3.5\ [ +2 ms] Found plugin video_player_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player_web-2.0.12\ [ +2 ms] Found plugin wakelock at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\wakelock-0.6.2\ [ +1 ms] Found plugin wakelock_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\wakelock_macos-0.4.0\ [ +2 ms] Found plugin wakelock_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\wakelock_web-0.4.0\ [ +5 ms] Found plugin webview_flutter at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter-2.8.0\ [ +1 ms] Found plugin webview_flutter_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter_android-2.9.5\ [ +2 ms] Found plugin webview_flutter_wkwebview at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter_wkwebview-2.9.3\ [ +40 ms] Found plugin better_open_file at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\better_open_file-3.6.3\ [ +10 ms] Found plugin device_info_plus at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus-4.1.2\ [ ] Found plugin device_info_plus_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_linux-3.0.0\ [ ] Found plugin device_info_plus_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_macos-3.0.0\ [ +1 ms] Found plugin device_info_plus_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_web-3.0.0\ [ ] Found plugin device_info_plus_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_windows-4.0.0\ [ +4 ms] Found plugin file_picker at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-5.0.1\ [ +2 ms] Found plugin firebase_analytics at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_analytics-9.3.3\ [ +1 ms] Found plugin firebase_analytics_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_analytics_web-0.4.2+3\ [ ] Found plugin firebase_core at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_core-1.21.1\ [ +1 ms] Found plugin firebase_core_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_core_web-1.7.2\ [ ] Found plugin firebase_crashlytics at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_crashlytics-2.8.9\ [ +1 ms] Found plugin firebase_messaging at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_messaging-12.0.3\ [ ] Found plugin firebase_messaging_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_messaging_web-3.1.3\ [ ] Found plugin firebase_performance at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_performance-0.8.2+4\ [ +1 ms] Found plugin firebase_performance_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_performance_web-0.1.1+4\ [ +1 ms] Found plugin flutter_bugfender at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_bugfender-2.1.0\ [ ] Found plugin flutter_downloader at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_downloader-1.8.3\ [ +2 ms] Found plugin flutter_plugin_android_lifecycle at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-2.0.7\ [ ] Found plugin flutter_secure_storage at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage-5.1.2\ [ ] Found plugin flutter_secure_storage_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_linux-1.1.1\ [ +1 ms] Found plugin flutter_secure_storage_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_macos-1.1.1\ [ ] Found plugin flutter_secure_storage_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_web-1.0.2\ [ ] Found plugin flutter_secure_storage_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_windows-1.1.2\ [ +5 ms] Found plugin image_picker at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker-0.8.5+3\ [ +1 ms] Found plugin image_picker_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker_android-0.8.5+2\ [ ] Found plugin image_picker_for_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker_for_web-2.1.8\ [ ] Found plugin image_picker_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker_ios-0.8.5+6\ [ +7 ms] Found plugin package_info_plus at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus-1.4.3+1\ [ ] Found plugin package_info_plus_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_linux-1.0.5\ [ ] Found plugin package_info_plus_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_macos-1.3.0\ [ ] Found plugin package_info_plus_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_web-1.0.5\ [ ] Found plugin package_info_plus_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_windows-2.0.0\ [ +2 ms] Found plugin path_provider at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider-2.0.11\ [ ] Found plugin path_provider_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_android-2.0.20\ [ ] Found plugin path_provider_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_ios-2.0.11\ [ ] Found plugin path_provider_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_linux-2.1.7\ [ ] Found plugin path_provider_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_macos-2.0.6\ [ +1 ms] Found plugin path_provider_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_windows-2.1.2\ [ +3 ms] Found plugin shared_preferences at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-2.0.15\ [ ] Found plugin shared_preferences_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_android-2.0.12\ [ +1 ms] Found plugin shared_preferences_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_ios-2.1.1\ [ ] Found plugin shared_preferences_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_linux-2.1.1\ [ ] Found plugin shared_preferences_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_macos-2.0.4\ [ ] Found plugin shared_preferences_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_web-2.0.4\ [ ] Found plugin shared_preferences_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_windows-2.1.1\ [ +4 ms] Found plugin sqlcipher_flutter_libs at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\sqlcipher_flutter_libs-0.5.1\ [ +4 ms] Found plugin url_launcher at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher-6.1.5\ [ ] Found plugin url_launcher_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_android-6.0.17\ [ ] Found plugin url_launcher_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_ios-6.0.17\ [ ] Found plugin url_launcher_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_linux-3.0.1\ [ ] Found plugin url_launcher_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_macos-3.0.1\ [ +1 ms] Found plugin url_launcher_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_web-2.0.13\ [ ] Found plugin url_launcher_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_windows-3.0.1\ [ +1 ms] Found plugin video_player at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player-2.4.7\ [ ] Found plugin video_player_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player_android-2.3.9\ [ ] Found plugin video_player_avfoundation at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player_avfoundation-2.3.5\ [ ] Found plugin video_player_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player_web-2.0.12\ [ ] Found plugin wakelock at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\wakelock-0.6.2\ [ ] Found plugin wakelock_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\wakelock_macos-0.4.0\ [ ] Found plugin wakelock_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\wakelock_web-0.4.0\ [ +1 ms] Found plugin webview_flutter at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter-2.8.0\ [ ] Found plugin webview_flutter_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter_android-2.9.5\ [ +1 ms] Found plugin webview_flutter_wkwebview at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter_wkwebview-2.9.3\ [ +26 ms] Found plugin better_open_file at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\better_open_file-3.6.3\ [ +8 ms] Found plugin device_info_plus at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus-4.1.2\ [ ] Found plugin device_info_plus_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_linux-3.0.0\ [ ] Found plugin device_info_plus_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_macos-3.0.0\ [ ] Found plugin device_info_plus_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_web-3.0.0\ [ ] Found plugin device_info_plus_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info_plus_windows-4.0.0\ [ +4 ms] Found plugin file_picker at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-5.0.1\ [ +1 ms] Found plugin firebase_analytics at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_analytics-9.3.3\ [ ] Found plugin firebase_analytics_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_analytics_web-0.4.2+3\ [ ] Found plugin firebase_core at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_core-1.21.1\ [ ] Found plugin firebase_core_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_core_web-1.7.2\ [ +1 ms] Found plugin firebase_crashlytics at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_crashlytics-2.8.9\ [ +1 ms] Found plugin firebase_messaging at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_messaging-12.0.3\ [ ] Found plugin firebase_messaging_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_messaging_web-3.1.3\ [ ] Found plugin firebase_performance at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_performance-0.8.2+4\ [ +1 ms] Found plugin firebase_performance_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_performance_web-0.1.1+4\ [ +1 ms] Found plugin flutter_bugfender at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_bugfender-2.1.0\ [ ] Found plugin flutter_downloader at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_downloader-1.8.3\ [ +2 ms] Found plugin flutter_plugin_android_lifecycle at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-2.0.7\ [ ] Found plugin flutter_secure_storage at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage-5.1.2\ [ +1 ms] Found plugin flutter_secure_storage_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_linux-1.1.1\ [ ] Found plugin flutter_secure_storage_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_macos-1.1.1\ [ ] Found plugin flutter_secure_storage_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_web-1.0.2\ [ ] Found plugin flutter_secure_storage_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_secure_storage_windows-1.1.2\ [ +4 ms] Found plugin image_picker at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker-0.8.5+3\ [ ] Found plugin image_picker_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker_android-0.8.5+2\ [ ] Found plugin image_picker_for_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker_for_web-2.1.8\ [ ] Found plugin image_picker_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\image_picker_ios-0.8.5+6\ [ +7 ms] Found plugin package_info_plus at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus-1.4.3+1\ [ ] Found plugin package_info_plus_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_linux-1.0.5\ [ ] Found plugin package_info_plus_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_macos-1.3.0\ [ +1 ms] Found plugin package_info_plus_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_web-1.0.5\ [ ] Found plugin package_info_plus_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\package_info_plus_windows-2.0.0\ [ +1 ms] Found plugin path_provider at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider-2.0.11\ [ ] Found plugin path_provider_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_android-2.0.20\ [ +1 ms] Found plugin path_provider_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_ios-2.0.11\ [ ] Found plugin path_provider_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_linux-2.1.7\ [ ] Found plugin path_provider_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_macos-2.0.6\ [ +1 ms] Found plugin path_provider_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_windows-2.1.2\ [ +3 ms] Found plugin shared_preferences at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-2.0.15\ [ ] Found plugin shared_preferences_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_android-2.0.12\ [ ] Found plugin shared_preferences_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_ios-2.1.1\ [ ] Found plugin shared_preferences_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_linux-2.1.1\ [ ] Found plugin shared_preferences_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_macos-2.0.4\ [ +1 ms] Found plugin shared_preferences_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_web-2.0.4\ [ ] Found plugin shared_preferences_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences_windows-2.1.1\ [ +3 ms] Found plugin sqlcipher_flutter_libs at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\sqlcipher_flutter_libs-0.5.1\ [ +4 ms] Found plugin url_launcher at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher-6.1.5\ [ ] Found plugin url_launcher_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_android-6.0.17\ [ ] Found plugin url_launcher_ios at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_ios-6.0.17\ [ ] Found plugin url_launcher_linux at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_linux-3.0.1\ [ ] Found plugin url_launcher_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_macos-3.0.1\ [ ] Found plugin url_launcher_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_web-2.0.13\ [ ] Found plugin url_launcher_windows at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher_windows-3.0.1\ [ +1 ms] Found plugin video_player at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player-2.4.7\ [ ] Found plugin video_player_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player_android-2.3.9\ [ ] Found plugin video_player_avfoundation at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player_avfoundation-2.3.5\ [ ] Found plugin video_player_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\video_player_web-2.0.12\ [ ] Found plugin wakelock at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\wakelock-0.6.2\ [ ] Found plugin wakelock_macos at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\wakelock_macos-0.4.0\ [ ] Found plugin wakelock_web at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\wakelock_web-0.4.0\ [ +1 ms] Found plugin webview_flutter at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter-2.8.0\ [ ] Found plugin webview_flutter_android at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter_android-2.9.5\ [ ] Found plugin webview_flutter_wkwebview at C:\Users\Honza\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter_wkwebview-2.9.3\ [ +84 ms] Generating C:\Users\Honza\xxx\yyy\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java [ +657 ms] dart --disable-dart-dev C:\Users\Honza\fvm\versions\3.3.2\bin\cache\dart-sdk\bin\snapshots\analysis_server.dart.snapshot --disable-server-feature-completion --disable-server-feature-search --sdk C:\Users\Honza\fvm\versions\3.3.2\bin\cache\dart-sdk [ +22 ms] ==> {"id":"1","method":"server.setSubscriptions","params":{"subscriptions":["STATUS"]}} [ ] ==> {"id":"2","method":"analysis.setAnalysisRoots","params":{"included":["c:\\users\\honza\\xxx\\yyy\\lib\\alpha\\beta\\gama.dart"],"excluded":[]}} [ ] Analyzing gama.dart... [ +309 ms] <== {"event":"server.connected","params":{"version":"1.33.1","pid":7244}} [ +32 ms] <== {"id":"1"} [+4244 ms] <== {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}} [ +5 ms] <== {"event":"analysis.errors","params":{"file":"c:\\users\\honza\\xxx\\yyy\\lib\\alpha\\beta\\gama.dart","errors":[]}} [ +4 ms] <== {"id":"2"} [ ] <== {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}} [ +8 ms] Analyzing gama.dart... (completed in 4.6s) [ ] No issues found! (ran in 4.6s) [ ] "flutter analyze" took 6,069ms. [ +261 ms] ensureAnalyticsSent: 258ms [ ] Running shutdown hooks [ ] Shutdown hooks complete [ ] exiting with code 0 ```
lrhn commented 1 year ago

It works because the Uri class ignores ..s that go past the root.

The Dart language does not handle relative import paths, it just applies the URI path merge to the URI of the importing library and the relative path. Then it takes the result, which always exists, and checks whether that refers to a library.

Take var u = Uri.parse("http://example.com/foo/bar"); and do u.resolve("../../../../../baz"). The result is http://example.com/baz, because extra ..s after reaching the root are ignored (because the spec we follow says so.

Package URIs treat the path as starting after the package-name, so package:example/foo/bar is treated, for relative path resolution purposes, as if it was package://example/foo/bar, and then doing ../../../../baz gives you package:example/baz again.

I'm guessing Android Studio does its own look-up on the relative path, instead of resolving it against the URI of the importing library. Or maybe it uses a different URL implementation than the Dart one for it. In any case, it disagrees with the Dart language.

Checking whether a relative path contains too many leading ..s seems like a reasonable lint. (Maybe also check that it doesn't contain embedded /./ or /../ segments, because those are also unnecessary.)