flutter code suggestions aren't working after v1.0.0 update - flutter

i didn't write any flutter code for a long time, when i came back i had a really annoying problem and it is slowing me down.
the code completion/suggestions (when hitting ctrl+space) is working fine, except when i want to see suggestions for a property of a widget.
i can't remember the specific update that messes this up, but when i go to download an older version of flutter, it seems the last working update is v1.0.0, after that the problem appears.
i've tried different PCs and IDEs, they all have the same problem.
screenshot of it working when pressing ctrl+space on:
Container(
alignment: // <<< Pressing Ctrl+Space here
)
another screenshot after the v1.0.0 update:
UPDATE: after trying for 6 hours, i figured out a workaround and knew the cause of the problem.
you have to download the latest version of Flutter SDK.
and the dart SDK version 2.1.1 from (https://dart.dev/tools/sdk/archive)
and only take two files:
First file: dart-sdk\bin\dart.exe and copy it to Flutter\bin\cache\dart-sdk\bin
Second file: dart-sdk\bin\snapshots\analysis_server.dart.snapshot and copy it to Flutter\bin\cache\dart-sdk\bin\snapshots
it's not a great solution but at least it works for now, you will lose all the features that were introduced after the 2.1.1 update.

Related

Flutter broken after gitlab commit // Help needed

I'm using the source controle feature in Visual Code to have my Flutter project backed up via Gitlab. About two days ago, suddenly I had Flutter in the list of projects that can be committed/synchronised. I made the mistakte of pressing the button. It did something and then told me there are conflicts merging files.
Now everything is broken, If I try running my project I get a really long list of errors I do not understand (see below). Flutter in source control has loads of red exclamation marks. I'm a beginner and completely out of my depth here. So I dont wan't to touch more things I don't fully understand.
Can anyone give me a hint whow to fix this mess without breakting more things?
Erorr messages:
Blockquote
And a lot more like this below.

getting module not found after importing packages in swift

I've done a bit of swift, but I've never tried to use a third party package before. I created a brand new swift app, with Mac/iOS version and tests from the wizard. I went to xcode, right clicked on the sidebar, and chose add packages, and put in a package by url:
https://github.com/witekbobrowski/EPUBKit.git
It goes away for a little bit - and three package dependencies appear on my screen:
and when I look at my project settings, I can see them there:
(I actually added the zip package separately after the first one didn't work, just to test it, wondering whether something was wrong with the package)
Anyway - I can now see the packages, browse into them, see code or whatever - and the package found its own dependencies, so everything looks like it's working fine. But if I go into my swift app main, and add
import EPUBKit
or
import Zip
it just says "No such module ...".
I've obviously missed a step - what am I doing wrong - how do I fix it? I don't even know how to investigate it, because everything I look at just looks completely fine and I don't get any errors. I tried cleaning builds, restarting Xcode, using the real version of Xcode 13.2.1, using Xcode 13.3 beta - and nothing works.
NEW LEARNINGS
so - I tried changing how I'm running it to produce an IOS app - and it's working fine - but when I produce a Mac app, it's like the package isn't even there? Why would that be, and how do I make it work for Mac as well as IOS?
Author of EPUBKit here, thanks for taking interest in my library!
The issue is reproducible in a new project which kinda makes sense but don't at the same time. I am glad Xcode is not adding a package to every single target in my project but at the same time why does it assume that I want it in the iOS target? Anyway, I know that this question was already answered in the comment and the problem is solved but I might as well just drop more detailed instructions. Maybe it will help someone.
1. Select Project from Project Navigator
Select te target that is not working for you, in this case it's the macOS target. In the General tab you will see the Frameworks, Libraries, and Embedded Content section. If the package is missing from the list, tap the plus button at the bottom.
2. Add Missing Library
Look for the one you are missing, in this case its of course EPUBKit and tap the Add button.
3. Success
Now the library is successfully added to your target. Go ahead and build the project to run and enjoy your app :)

Automatic Hot Restart and Reload Stopped Occurring - Flutter/VS Code

I've been learning Dart/Flutter on VS Code and the Hot Restart/Reload was always automatic (if I changed a color in the code, it automatically showed up on screen). I have to manually trigger the action now. I have no idea what changed.
I'm using VS Code and iOS emulator. I can't run SDK on Android Studio right because I'm on the new mac M1 processor.
Solutions I've tried:
Opened other Flutter projects and verified the hot restart isn’t
working on any of them (its not an import error like other posts have suggested)
I ensured that I can manually hot restart from VSCode and terminal to see changes
Flutter Doctor shows no errors
I ran Flutter Upgrade from the terminal anyway
I uninstalled and reinstalled Dart and Flutter from VS Code
I ensured VS Code’s autosave feature was on
I ensured VS Code’s “Dart: Flutter Hot Reload on Save” (and Restart) were both checked
I tried running with and without debugging
I restarted my computer and VS Code
Edit: I just installed Android Studio and cannot get an automatic hot reload here either. I connected it to iOS emulator, turned on automatic saving after 2 seconds of being idle, and still have to manually reload. Alternatively, I can go to the menu and click "Save All" and it will reload to update the UI (without me having to click a hot reload or restart icon). But, it's still manual.
Edit: 2/25/21: A "fix" has been introduced in the v3.20.0 beta.
https://dartcode.org/releases/v3-20/
Ok, I was finally pointed in the right direction for an answer.
Apparently, the automatic hot reload after an IDE autosave was a bug that some users found to be a useful feature. The intended functionality was to only trigger a hot reload on a manual activation. Thus, the bug (feature) was "fixed" taking this functionality away.
Feedback shown a light on the fact that some people found the bug useful and there is now an indication that this functionality will be returned in the future.
https://github.com/Dart-Code/Dart-Code/issues/3110
Edit: 2/25/21: A "fix" has been introduced in the v3.20.0 beta.
https://dartcode.org/releases/v3-20/
VSCode can be buggy sometimes and this problem is arguably the most annoying. I had this happen to me last week when I decided to use a barrel file with flutter web.
Meaning, I had a folder with all the components exported and then would import only that one file, like this
And then wherever I wanted all those files to be, I would add
import barrell.dart
Now this worked perfectly fine when I was working with flutter on mobile, and the second I went to flutter web my app would not hot reload.
I share this with you to say that I found out about this by a process of elimination. Took me a little bit, but I created a new project from the bottom up, added in each part one by one, and then I found that it was this barrell file that was messing the hot-reload up..
So my best advice is to do the same - start fresh with a new project, add back the pieces one-by-one and if you do find out what is causing the hang-up, I implore you to share it here:
https://github.com/flutter/flutter/issues

Flutter VS Code Quick Fix not suggesting import

Everything worked fine until a couple of days ago. Whenever I create new widgets or create some files and want to use them, I don't manually type import package:... but start typing the name of that class and press ctrl + . which provided a list of Quick fixes and always suggested import package:... until recently. No changes to Windows / Flutter / Dart / VS Code have been made except I installed svg-explorer-extension after following this advice (which I would highly doubt affected anything, yet it still updated some x64 c++ distribution something).
Right now, as I try to use existing files (all of them are in */lib folder) in the new files I create, the Quick fix menu provides all except import package:... options which makes the development process slow enough to ask a question here.
The only way to 'recover' that functionality is to run Developer: Reload Window in VS Code which stops the debug session, restarts Dart Analyzer, and everything seems to be okay for the next couple of minutes until it simply disappears.
How to not 'lose' that importing functionality? My project is rather big (22k lines) with 30+ dependencies. I tried reinstalling flutter SDK, flutter, and dart extensions from VS Code and that didn't help.
What suggestions do you have? Is this issue worth filing an issue for Flutter / Dart / Flutter Extension on GitHub?
Happening with recently and was fixed with the restart to update option.
It was so annoying and wasted my 1 hour searching over google and StackOverflow.
I was also stucked in this issue and the real answer to this question according to my analysis is : always create new widgets or dart classes within lib folder. You can create different folders such as widgets, screens, models but always create them in lib folder dont create them at the root level. Your problem of import will be solved. Infact VSCode will auto-import them
You can refer to this image below and see how I organized my lib folder
[1]: https://i.stack.imgur.com/Yau5i.png

Unity3D 2020 - VSCode - What happened to intellisense?

Overnight, any help I had for Unity3D in VSCode, i.e. intellisense, disappeared. And I get the sense, no pun intended, that I'm not the only one who's afflicted.
I've tried updating and reinstalling what I assumed VSCode needed to make Unity3D intellisense work. And have checked and re-checked settings, reinstalled VSCode package, in Unity3D.
I've worked through a few tutorials that claimed to address the issue.
What else does VSCode depend on to make this relationship work?
Thanks! Here's to hoping you've fixed this and your life has gotten easier!
Try going to Edit > Preferences > External Tools > Regenerate Project Files (This is because of a bug where the VS Code extension doesn't generate the project files correctly the first time, you can check it out here).
You'll need to be using the VS Code Editor Extension 1.2.0 (you can check which version you're using in the package manager) or later for that option to appear. Also if for whatever reason there are 2 .sln files in your project folder (I've had that happen before, though it's less likely), that also causes problems.
Ok. First, thanks to Lightning_A and Charleh!
The resolution to my specific circumstance was to install the VSCode extension "Unity Snippets Modified" https://github.com/with-heart/vscode-unity-snippets
I had been using https://github.com/kleber-swf/vscode-unity-code-snippets.
Perhaps it's just a matter of Kleber's extension, which is/was great, was broken upon updating Unity to 2020? I dunno and don't have the time to look into it, unfortunately.
Hopefully, my question, the answers I received, and my subsequent resolution saves others from the rabbit-hole I went down.
Again, thanks everyone!