<< was unexpected at this time. flutter - 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.

Related

I get this error in my flutter app. migrate this app to the V2 embedding

I get this error in my Flutter Project,
C:\src\flutter\bin\flutter.bat --no-color pub get
Running "flutter pub get" in source_code... 34.3s
This app is using a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.
Take a look at the docs for migrating an app: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
The plugin firebase_core requires your app to be migrated to the Android embedding v2. Follow the steps on https://flutter.dev/go/android-project-migration and re-run this command.
Process finished with exit code 1
Flutter Embedding Error
Since Flutter 1.12 the way how Flutter plugins communicate with the native Android side has been improved. Allowing plugins to better integrate with the native Android lifecycle.
Some plugins support both the new and the old structure, however many plugins (like firebase_core) dropped support for the legacy structure to ensure optimal integration with the Android system.
Apps created using Flutter 1.12 and higher automatically generate the correct Android integration logic, however Flutter applications created with an earlier version of Flutter need to be manually migrated. There are two options to fix this for your app:
The easiest solution is to delete the android folder in your project and let Flutter (using Flutter 1.12 or higher) recreate it for you by running the following command in the root folder of the Flutter project: flutter create --platform=android . (don't forget the . at the end of the command). You should only do this if you haven't made any custom changes to the Android code and of course make sure to make a backup first.
The more safe option is to manually migrate the Android project using the instructions provided on the GitHub Wiki page mentioned in the error message.
When following the instructions on the GitHub Wiki page make sure to keep an eye on all the details. Personally I forgot to update the <application android:name="MyApp" to the recommended <application android:name="${applicationName}" which resulted in the same error you are reporting.
What helped me was to create a new "dummy" application with the latest version of Flutter (for example flutter create --platforms=android test_app) and compare the files in the Android folder with the files of my current App and make changes where necessary.

Flutter package's own import target URI does not exist

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.

Flutter - I can't see any channel

I am trying to upgrade my flutter. When I hit flutter upgrade in the terminal in the android studio I receive the error 'Unable to upgrade Flutter: no origin repository configured. Run 'git remote add origin https://github.com/flutter/flutter''.
When I try to see flutter channels, I type flutter channel in the terminal in android studio, but I can't see any channels. The list is empty. Check the screenshot
After running the flutter channel stable in the terminal, it switched successfully. I ran the flutter upgrade command again and the same issue happened again. The screenshot is attached. New screenshot
Try flutter doctor, you will see flutter channel unknown. That is the reason, Flutter uses git to manage the Framework and when you checkout to different commit code / tags flutter channel changed to unknown.
Here is what you have to do:
flutter channel stable
Above I mentioned stable, if you need change the channel that you want to checkout (see available channels by flutter channel in terminal / cmd).
Then:
flutter upgrade
Everything should work now.
If not try below:
Go to flutter framework located directory and set upstream by git branch --set-upstream-to=origin/stable stable.
Please note that flutter channel stable is equivalent to git checkout stable if you try in flutter framework located directory.
Learn lot more info about this issue from already reported issue tracker.
Originally answered here.
try to run flutter stable channel and then flutter upgrade.
That should work.

Flutter: When I debug my App, my App creates this files

My App have a Problem so I Need to do flutter clean before I can debug my app.
So I do flutter clean and after that flutter run in my Terminal.
Then my App debug. After that flutter creates a new build folder, new .flutter-plugins and .flutter-plugins-dependencies.
Now I think the problem is not there but sometimes it creates the files.
Can I delete the files? And how can I fix it?
PS: I have the newest version of flutter and Xcode. And I work with VSCode and I work on a MacBook with the newest Version.
I'm not sure about this, but in one case I tried adding resource permission from info.plist(I messed with internal storage permission), I noticed similar behaviour.

Can't find recent announcement that the Flutter master branch can now enable flutter_web with command line operations

I should have bookmarked it, but the googles aren't being helpful.
There was a recent (past week or so) that the standard flutter command on the master branch can now eliminate the difference between Flutter and flutter_web repositories. This will be helpful for an upcoming demo.
Since the question is asking where the announcement link was, I bookmarked them. (Probably you don't need anymore though).
https://groups.google.com/forum/#!topic/flutter-announce/-LQPz3C3JAM
https://www.reddit.com/r/FlutterDev/comments/cl6cul/flutter_for_web_preview/
Edited:
I just tried the new approach and made some mistakes. So I would like to share more on this.
Steps at Flutter (Channel master, v1.9.1-pre.91):
First create a new project:
flutter create --web project
OR
$ flutter create project
$ cd project
$ flutter create --web .
Compile and Run the project with chrome (will launch chrome)
$ flutter run
That's all.
Another thing I found out: if you add the plugin which flutter web does not support, you can still pub get, compile successfully. The error will only happen when the unsupported code is triggered and then report some exceptions such as NoSuchMethodError: '<Unexpected Null Value>'.
Another Note: If you don't connect any mobile devices, flutter run by default will launch the chrome device. If you connect a mobile device, flutter run will pick the mobile device, compile and install it to your mobile device (at least it's the case in my env). So when you have both mobile and chrome devices, to launch the web case, simply execute flutter run -d chrome.
More links:
https://github.com/flutter/flutter/issues/34082
https://github.com/flutter/flutter/wiki/Building-a-web-application-with-Flutter