Flutter package's own import target URI does not exist - flutter

I have a Flutter project that I started as a package in order for it to speak to platform specific native code. I've updated several packages lately along with flutter and my
import: package: mypackage/mypackage.dart
is no longer working. The dart analysis says the target URI doesn't exist and none of the of solutions for outside packages seem to work for me. Any ideas on how I can correct this issue?

Follow these steps:
flutter clean
flutter packages get
flutter packages upgrade (Optional)
Restart Android Studio or Visual Studio

I corrected the issue by downloading the clone that I recently pushed to git. I read through several entries that it could be related to pushing to git - especially is you forced a push.
If this is your situation 1) archive your local working copy 2) clone your project back from github/gitlab 3) run flutter packages get and flutter clean
If you understand how force pushing your project to git may effect package URI dependencies, please elaborate.

Related

<< was unexpected at this time. flutter

i work on a flutter project but after uploading the file to github and trying to debug the code the terminal this response
<< was unexpected at this time.
i have fork repositorie of flutter maybe this cause the prob
i try to remove the flutter fork in my github but nothing happen
i check the FlutterGitUrl in the envirement variable but it was
https://github.com/flutter/flutter.git
i try flutter doctor but same line appear
the only command working is dart
You will need to delete the Flutter SDK folder then re-download again.
This happens when there are conflicts inside the Flutter SDK local repository (Flutter uses Git to manage itself).
I am not sure why it happens though. But since the SDK become unusable, it's far easier to just download a fresh SDK (same version) and delete the old one than searching for and solving conflicts throughout the SDK codebase.
Link to download a specific version of Flutter: https://docs.flutter.dev/development/tools/sdk/releases.

How to specify local Flutter version (e.g. an older release)?

I would like to test my application / package running on an older version of Flutter, e.g. specifically Flutter v2.2.3.
There are 2 commands, flutter upgrade and flutter downgrade which might seem to be relevant, but how do I select the specific version of Flutter I want to use? flutter upgrade --help and flutter downgrade --help do not provide any extra information.
Recommended (git): Just checking out a specific commit in the Flutter repo
Change directory to your flutter installation folder, e.g. /opt/flutter.
git checkout the git tag (change to the branch pointed by the tag). For example, there is a git tag called 2.5.0 for the version 2.5.0, so run git checkout 2.5.0. (Thanks Eugene :) )
Or alternatively, if I want version 2.5.0, I can get the commit SHA (ref) from the Flutter SDK releases page. That website says the ref for 2.5.0 is 4cc385b. At the flutter installation directory, run git checkout 4cc385b.
Then in the terminal, run flutter (or any specific flutter command) to download and build this version of flutter.
Using FVM (Flutter version Management)
You also specify the specific version of Flutter using FVM, e.g. fvm use 2.5.1
Download the specific version of Flutter from Flutter SDK releases and install it.
This is the slowest way, as you would have to download the entire repo again.
Just download that specific flutter version from here. and just set the flutter version in your editor and try to run it will run that specific flutter version but make sure you can't run that with terminal commands. So you need to handle all commands from the Tools option.
set flutter version
Must Run commands from here

How to use both Flutter stable and dev SDK on the same machine?

I'm working with Flutter to make a Mobile App using the stable Flutter SDK release. But I also want to try Flutter Desktop and Flutter Web that are not part of the Flutter stable channel yet, but are present on the Flutter dev channel.
My question is... How can I try Flutter Desktop and Flutter Web without override the Flutter stable release on my machine?
You'll need to setup alias to switch between different environments easily.
See here a detailed article for that.
I found this Dart package called Flutter Version Management that does exactly what I want.
As the docs says:
Flutter Version Management: A simple cli to manage Flutter SDK versions.
Features:
Configure and use Flutter SDK version per project
Ability to install and cache multiple Flutter SDK Versions
Fast switch between Flutter channels & versions
Dynamic SDK paths for IDE debugging support.
Version FVM config with a project for consistency across teams and CI environments.
Set global Flutter version across projects
https://github.com/leoafarias/fvm
Now I just need to add FVM_HOME/default/bin to the PATH and FVM will take care of everything...
Two solutions
Put the installation files in two different directories one with stable and the other dev and add one of them to the path then you can change the path variable when needed to use the other channel.
Put the flutter repository file in two different directories one with stable and the other with dev then,
add the first installation to the path then add an alias to point to the second installation directory.

Add androidx source code to Android Studio project for debugging

I want to to add the androidx source code to my Android Studio project instead of using the provided library (implementation 'androidx.core:core-ktx:1.1.0'). Using the provided library I can only view the source code (it's read only during debugging), but I need to modify it for testing purposes.
So how can I add the androidx source code to Android Studio so I can edit it?
These repositories are usually being accessed with repo -
but for the sake of simplicity, git would also be supported:
git clone --branch androidx-master-dev https://android.googlesource.com/platform/frameworks/support /home/android/androidx-master-dev
Android Studio also supports git; the repository URL to check out would be https://android.googlesource.com/platform/frameworks/support and the branch is to select is eg. androidx-master-dev;. However, manually adding the library modules you need might be better.
Only the pre-built artifacts have version numbers, not the source-code. And it might only be known internally, which commit equals which version number; it doesn't seem to be publicly documented. See Android CI and Android Code Search; it says nothing about any version numbers there either.
(I don't have enough points to add a comment...)
As Martin said, Google has created a step by step guide how to download AndroidX, build it with gradle or Android Studio, make changes, import your custom build libs into your app, even contribute your changes upstream.

Add flutter web and desktop to existing flutter (android/ios) project in android studio

I know it maybe still early but I want to try and use full flutter existing cross-platform support in one project. Stability is not my main concern.
I have started a flutter project in android studio. Naturally I have (android/Ios) going smoothly. But I would love to add Web and desktop to the same project.
Please help me with and direction, or if there is solution any one has created however much experimental.
There is a migration guide for web here. I got it up and running on a very basic existing app.
Best way is to do it in a separate branch since it requires changing packages and I even deleted .packages and pubspec.lock files first. Then I ran pub get (not flutter packages get) to download the required packages and run some precompilers.