Flutter android studio dart file is showing some weird resource data - flutter

Hi guys, I am getting this weird data inside the dart file. I had coded the screen but now it is not showing. Thanks in advance.

The data which you have shown in the file is not related to dart .Its looks like some xml lines .
You mentioned that you have created the screen before so may be there been a chance that your file beign overwritten by plugin or something .
The way which you can get your original data is that if youre using git then check the previous commit where you have the succesfully executed your dart file from there you can copy the code and you can continue with your developement .
if your not using git then the only way is re-write the code

Ok. I figured out that it was problem regarding android studio. I tried to open the same code in VS code and notepad and it was opening. The only way to get the original file back is open the file in note pad and then copy the code and paste it back in android studio file. The code will work even if you leave the file like that. So I will file an issue in the android studio page if possible.

Related

Dart File Association Messed Up In Android Studio Arctic Fox 2010.3.1

I have a Flutter project open in Android Studio Arctic Fox 2021.3.1 on a Mac.
Flutter is configured properly.
Somehow, I've have achieved the situation where a certain file, static_utils.dart, is not being treated as a dart file by Android Studio.
That is, it has the wrong icon next to it... which looks like a text file icon... and also the syntax checking is not working (that's the important part).
Already tried:
File > Invalidate caches/restart
Interesting facts:
If I delete this file a re-create a new "dart file" of the same name, it still treats it as text(?)/not dart... but if I use a new name for the file, it works correctly.
Even files of the same problematic name in other projects are also losing their Dart association unless a new file is created with an unused name and the code is cut and pasted over.
So, it appears that there is dictionary somewhere in Android Studio that is establishing file association rules based on filename... and retaining the rules even when the file is deleted.
I can't find a way to fix this. I have tried this answer but it didn't work for me -- the file in question did not show up anywhere under any of the file types.
I finally solved it!
I've countered the same problem by creating a new file without its extension and accidentally registering the file type pattern. img1
Therefore, I just removed the wrong type's pattern away. img2
Go to File > Settings\Preferences > Editor > File Types > Find your file type (If you didn't remember, just find all of them from the beginning e.g .gitignore in the below image, and I found at Auto-detect the file by content) and then remove it!

How to open a Flutter .hive file from Hive in Android Studio

Can someone please explain how to open the .hive files generated by Flutter Hive when you create a Box and add to it?
Within my application, the files are stored as name.hive files.
I have tried opening them as JSON/XML/plain text but nothing seems to work, the contents are showing incorrectly
I am using Android Studio on Ubuntu
Just want to know how I can open the file and view the contents properly?
An issue was opened for this and the answer is:
Hive uses a custom binary format for storing data which isn't supported by any existing editors or tools.
so you cannot actually open a box .hive file like you could do with JSON, XML...
The easier way would be to copy .hive file to your computer and drag it into Hive Studio window.
I wrote an app and a tutorial using Hive DB, where I describe this.

Visual Studio Code Copy working but not properly

Hi my visual studio code does this weird single line paste whenever I copy a code from a pdf or any other sources.
this picture below is what I copied from
this is what happens when I paste my code
Not really sure what made it this way but I have tried reinstalling, deleting the cache, all the files related to visual studio code but it doesn't work.
The reason why I am asking this because it used to work and my friends that use vscode doesn't have this problem.
Your help is very much appreciated.

vscode invalid syntax error for dart and flutter after pressing the Ctrl+Shift+I short to format the code in readable form

I am using vscode in ubuntu for developing flutter application. I installed the flutter and dart extension for vscode. when I write code and keep it the same dirty format it doesn't take any syntax error -although it shouldn't- but after I reformat the code in a readable shape using Ctrl+Shift+i short-key vscode takes syntax error. However, when I close the file (here the .dart file) and re-open it, all errors is gone. You can see it more in the picture.
I don't know how to handle this kinda error.
I would guess you have the Laravel Blade Spacer extension installed. This extension accidentally reverses the order of edits when handling a document edit event. VS Code then passes that mutated set of changes to other extensions (like Dart) which end up making incorrect edits (in this case, that are sent to the language server, so it gets an incorrect picture of what the file looks like).
This was fixed in VS Code (by preventing mutations to the array) in https://github.com/microsoft/vscode/issues/88310, but has yet to be released.
For now, you'll need to either disable that extension or use VS Code Insiders. Once the next stable version of VS Code is out, the issue should disappear.

How to invoke a VS code extension by clicking on file?

I have the vscode-pdf extension installed which let's me directly view pdf files in VS code. Is there any possibility to open pdf files directly with the said extension by just clicking on the file?
The current behaviour when clicking on a pdf file is the following message:
The file is not displayed in the editor because it is either binary or uses an unsupported text encoding. Do you want to open it anyway?
Edit: I use VS Code version 1.40.2 1.60.0
Edit2: The feature mentioned in the answer to this question now seems to be integrated. Any update on this?
Not as of VS Code 1.41
However this is a good potential use case for the proposed custom editor api