Undefined name 'Lottie' - Error in flutter - flutter

How can i solve bellow mentioned errors in a simple flutter program
Errors :
Target of URI doesn't exist: 'package:lottie/lottie.dart'.
Try creating the file referenced by the URI, or Try using a URI for a file that does exist.
Undefined name 'Lottie'.
Try correcting the name to one that is defined, or defining the name.

Check first your pubspec.yaml file if you have lottie under dependencies. If you do, press this button at top right corner if you are using Visual Studio Code
Ohterwise type flutter pub get at your cmd to get the dependencies you are missing.

Related

Why is an error coming in my untouched build.gradle file?

I was receiving this error in my build.gradle file (under android > app [This is for flutter in Android Studio]). The error is on 'Properties' and 'Gradle Exception'.
How do I fix this error, and is it necessary to fix it?
I haven't tried to change anything, and it was like this by default when I first opened the file.
It's not an error.
If you want to remove the warning in GradleExeption, just remove it and replace it with RuntimeException.

Facing a problem to set up the emulator in flutter

I have the following problem.....
Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
int _counter = 0;dsggfsgfh;
^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
I'm a beginner with Flutter. How can I solve this problem?
Your code has junk words or sentences, check your line ended with dsggfsgfh; which might be added unfortunately. Just remove it this will work.
It's possible that it's a compatibility issue between flutter framework and engine. You can try and:
Upgrade flutter to the latest version
Create a new project
Copy the code from the old project in steps
If you have plugins from the old project, add them one by one as you run the emulator
(It's possible that a certain version of a plugin has a compatibility issue with flutter)

Flutter: CMake Error at flutter/CMakeLists.txt:75 (add_custom_command): This character is not allowed

I created a flutter project recently but when I try to run it shows me the error below, how to solve it? Thanks in advance!
**CMake Error at flutter/CMakeLists.txt:75 (add_custom_command): add_custom_command called with OUTPUT containing a "#". This character is not allowed. Exception: Unable to generate build files**
Make sure that there's no # character in any of the directories in your path to where the Flutter project is located. For example, if you have path like this;
C:\#projects#flutter\your_project
You need to remove all hashtags # present, you will have something like this
C:\projects\flutter\your_project
Hope it helped you out ^_^

Couldn't Import a dart file in a new dart file (Target of URI doesn't exist)

My flutter project has a separate dart file for each functionality, So, I tried to import a dart file in a new dart file to access the functionality in that file, but I got this error "Target of URI doesn't exist: 'package:filename.dart'. Try creating the file referenced by the URI, or Try using a URI for a file that does exist"
I tried solutions like restarting the Ide, flutter clean command and pub get, Most of the solutions for the same error have to deal with packages, it can be solved by adding package name in dependencies. But this is a dart file, how do I solve it.
When using the import function and going to the root folder with 'package:*', you need to first write the flutter project folder name, and then after that the file or subfolders.
All this but skipping the 'lib' folder.
As an example:
import 'package:flutterProject/subFolderInLib/filename.dart'
Hope this was understandable and worked! :)

Init grpc in flutter project

I create flutter project with grpc, but I get error, when try to generate file dart from proto. I put proto files in lib/protos (rewards.proto), then in terminal put command
'protoc --dart_out=grpc:lib/src -Iprotos protos/rewards.proto'
and I receiver error like this --dart_out: protoc-gen-dart: ═х єфрхЄё  эрщЄш єърчрээ√щ Їрщы.
What I do wrong ? (Sorry for my English):)
Follow this official installation docs : grpc-dart
I hope you downloaded the protoc-plugin. You can do it using
$ dart pub global activate protoc_plugin
If you had already done this, add dart to path, You can do this
export PATH="/path/to/.pub-cache/bin:$PATH"
export PATH="/path/to/dart-sdk/bin:${PATH}"
ps : The error you got is due to path related issues. The above two commands might help