skip to Main Content

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?

2

Answers


  1. It’s possible that it’s a compatibility issue between flutter framework and engine. You can try and:

    1. Upgrade flutter to the latest version
    2. Create a new project
    3. Copy the code from the old project in steps
    4. 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)

    Login or Signup to reply.
  2. Your code has junk words or sentences, check your line ended with dsggfsgfh; which might be added unfortunately. Just remove it this will work.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search