Skip to content

Target of URI doesn't exist even if the file & class actually exist #55747

@MichelMelhem

Description

@MichelMelhem

Context

Hello,
I recently decided to automate the compilation of my application through docker containers.
However, I have some very special problems that happen for no apparent reason.
I have two similar pieces of code that I just cloned from git and on my mac Os environment flutter analyze finds no problem in my project while in the version that I clone in my docker container missing link errors appear even though the files are present. I'm not able to figure out from were this issue is coming from and this is why I'm here today.

Error and flutter doctor

This is the fluter analyze output from my mac os computer :

flutter analyze
Analyzing smartwork...                                                 
No issues found! (ran in 7.8s)

Flutter doctor output :


[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287, locale en-FR)
    • Flutter version 1.12.13+hotfix.9 at /Users/michel/developement/flutter
    • Framework revision f139b11009 (4 weeks ago), 2020-03-30 13:57:30 -0700
    • Engine revision af51afceb8
    • Dart version 2.7.2

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/michel/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Users/michel/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6392135/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.4.1, Build version 11E503a
    • CocoaPods version 1.8.4

[!] Android Studio (version 3.6)
    • Android Studio at /Users/michel/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6392135/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[!] IntelliJ IDEA Ultimate Edition (version 2019.3.4)
    • IntelliJ at /Users/michel/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] VS Code (version 1.44.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.9.1

[!] Connected device
    ! No devices available

Bellow you will be able to see the flutter analyze of the project that is cloned from my docker container :

Analyzing smartwork...                                          

  error • Target of URI doesn't exist: 'package:best_report/src/components/imputs/FormInput.dart' • lib/src/components/form/WorkSiteForm.dart:11:8 • uri_does_not_exist
  error • The method 'FormInput' isn't defined for the class '_WorkSiteFormState' • lib/src/components/form/WorkSiteForm.dart:67:25 • undefined_method
  error • The method 'FormInput' isn't defined for the class '_WorkSiteFormState' • lib/src/components/form/WorkSiteForm.dart:78:25 • undefined_method
  error • The method 'FormInput' isn't defined for the class '_WorkSiteFormState' • lib/src/components/form/WorkSiteForm.dart:84:25 • undefined_method
  error • Target of URI doesn't exist: 'package:best_report/src/pages/WorkSite.dart' • lib/src/navigators/WorkSiteNavigator.dart:12:8 • uri_does_not_exist
  error • The constructor returns type 'dynamic' that isn't of expected type 'Widget' • lib/src/navigators/WorkSiteNavigator.dart:53:48 • invalid_cast_new_expr
  error • Undefined class 'WorkSitePage' • lib/src/navigators/WorkSiteNavigator.dart:53:52 • undefined_class
  error • Target of URI doesn't exist: 'package:best_report/src/pages/Intervener.dart' • lib/src/pages/MasterIntervener.dart:3:8 • uri_does_not_exist
  error • The method 'IntervenerPage' isn't defined for the class '_MasterIntervenerPageState' • lib/src/pages/MasterIntervener.dart:34:26 • undefined_method
  error • The method 'IntervenerPage' isn't defined for the class '_MasterIntervenerPageState' • lib/src/pages/MasterIntervener.dart:44:22 • undefined_method

10 issues found. (ran in 32.2s)

I cheked more than 10 times and i can confirm you that the files that are as mentioned "missing" are actually here and the missing classes too.

Flutter doctor output from my docker container :

bash: warning: setlocale: LC_ALL: cannot change locale (fr_FR.UTF-8)
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Linux, locale fr_FR.UTF-8)
[!] Android toolchain - develop for Android devices
    ! Android SDK contains licenses only.
      Your first build of an Android application will take longer than usual, while gradle downloads the missing components. This functionality will only work if the licenses in the licenses folder in ANDROID_HOME are valid.
      If the Android SDK has been installed to another location, set ANDROID_HOME to that location.
      You may also want to add it to your PATH environment variable.

      Certain features, such as `flutter emulators` and `flutter devices`, will not work without the currently missing SDK components.
[!] Android Studio (not installed)
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

Thank you for your help !

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions