Visual Studio Code - Target of URI doesn't exist 'package:flutter/material.dart'

后端 未结 29 886
Happy的楠姐
Happy的楠姐 2020-12-07 21:33

I\'ve just setup my Macbook for flutter development,

So I downloaded flutter sdk, and placed it in my Documents. After, I setup my path variable to

相关标签:
29条回答
  • 2020-12-07 22:15

    Go to pubsec.yaml file and add this directly after cupertino_icons:

    webview_flutter:
    

    Then press Packages get on the top right corner and it will work fine with you.

    0 讨论(0)
  • 2020-12-07 22:16

    flutter clean

    flutter packages get

    flutter packages upgrade ( Optional - use if you want to upgrade packages )

    Restart Android Studio or Visual Studio

    0 讨论(0)
  • 2020-12-07 22:16

    Do not forget:

    export PATH="$PATH:/home/[xxxxx]/flutter/bin
    

    For me, it works:

    flutter upgrade
    
    flutter packages get
    

    You can check with

    flutter doctor
    
    flutter --version
    
    0 讨论(0)
  • 2020-12-07 22:17

    Restarting Visual Studio Code after

    flutter pub get
    

    resolved the error messages for me.

    source: https://flutter.dev/docs/development/packages-and-plugins/using-packages

    0 讨论(0)
  • 2020-12-07 22:18

    I was facing with the same issue and tried everything restarting, packages get, repair everything, But none of these solution worked. The only thing which worked was to set the encoding of the packages file giving error to UTF-8.

    PS: I faced this on Android studio

    Hope this would help someone.

    0 讨论(0)
  • 2020-12-07 22:23

    Also happened to me while trying to run the project inside of another directory.

    Worked by using the root directory of the main project

    0 讨论(0)
提交回复
热议问题