Flutter: How to resolve Error importing package:http/http.dart





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







11















I am very new to Flutter, and stuck at the following error:
package:http/http.dart That library is in a package that is not known. Maybe you forgot to mention it in your pubspec.yaml file?



Please help in resolving this error.










share|improve this question

























  • that package is part of flutter and should not show an error if you import it. To help you, you should post your relevant parts of the pubspec.yaml and .dart-File

    – Christian
    Nov 24 '18 at 22:37











  • The package is not a part of flutter but it is distributed via pub.

    – Jonah Williams
    Nov 25 '18 at 0:02











  • please google this before putting it up here, just search http/http.dart, you will get dartlang packages page(pub.dartlang.org/packages/http). the documentation and usage is pretty detailed.

    – sudesh
    Mar 16 at 14:25


















11















I am very new to Flutter, and stuck at the following error:
package:http/http.dart That library is in a package that is not known. Maybe you forgot to mention it in your pubspec.yaml file?



Please help in resolving this error.










share|improve this question

























  • that package is part of flutter and should not show an error if you import it. To help you, you should post your relevant parts of the pubspec.yaml and .dart-File

    – Christian
    Nov 24 '18 at 22:37











  • The package is not a part of flutter but it is distributed via pub.

    – Jonah Williams
    Nov 25 '18 at 0:02











  • please google this before putting it up here, just search http/http.dart, you will get dartlang packages page(pub.dartlang.org/packages/http). the documentation and usage is pretty detailed.

    – sudesh
    Mar 16 at 14:25














11












11








11








I am very new to Flutter, and stuck at the following error:
package:http/http.dart That library is in a package that is not known. Maybe you forgot to mention it in your pubspec.yaml file?



Please help in resolving this error.










share|improve this question
















I am very new to Flutter, and stuck at the following error:
package:http/http.dart That library is in a package that is not known. Maybe you forgot to mention it in your pubspec.yaml file?



Please help in resolving this error.







dart flutter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 21:48







Athar Ansari

















asked Nov 24 '18 at 21:24









Athar AnsariAthar Ansari

5914




5914













  • that package is part of flutter and should not show an error if you import it. To help you, you should post your relevant parts of the pubspec.yaml and .dart-File

    – Christian
    Nov 24 '18 at 22:37











  • The package is not a part of flutter but it is distributed via pub.

    – Jonah Williams
    Nov 25 '18 at 0:02











  • please google this before putting it up here, just search http/http.dart, you will get dartlang packages page(pub.dartlang.org/packages/http). the documentation and usage is pretty detailed.

    – sudesh
    Mar 16 at 14:25



















  • that package is part of flutter and should not show an error if you import it. To help you, you should post your relevant parts of the pubspec.yaml and .dart-File

    – Christian
    Nov 24 '18 at 22:37











  • The package is not a part of flutter but it is distributed via pub.

    – Jonah Williams
    Nov 25 '18 at 0:02











  • please google this before putting it up here, just search http/http.dart, you will get dartlang packages page(pub.dartlang.org/packages/http). the documentation and usage is pretty detailed.

    – sudesh
    Mar 16 at 14:25

















that package is part of flutter and should not show an error if you import it. To help you, you should post your relevant parts of the pubspec.yaml and .dart-File

– Christian
Nov 24 '18 at 22:37





that package is part of flutter and should not show an error if you import it. To help you, you should post your relevant parts of the pubspec.yaml and .dart-File

– Christian
Nov 24 '18 at 22:37













The package is not a part of flutter but it is distributed via pub.

– Jonah Williams
Nov 25 '18 at 0:02





The package is not a part of flutter but it is distributed via pub.

– Jonah Williams
Nov 25 '18 at 0:02













please google this before putting it up here, just search http/http.dart, you will get dartlang packages page(pub.dartlang.org/packages/http). the documentation and usage is pretty detailed.

– sudesh
Mar 16 at 14:25





please google this before putting it up here, just search http/http.dart, you will get dartlang packages page(pub.dartlang.org/packages/http). the documentation and usage is pretty detailed.

– sudesh
Mar 16 at 14:25












5 Answers
5






active

oldest

votes


















26














Go to your pubspec.yaml file , and add the http dependency:



    dependencies:
flutter:
sdk: flutter

cupertino_icons: ^0.1.2
http: any


Remember, the indentation must be the same as 'flutter' or 'cupertino_icons'






share|improve this answer



















  • 3





    And don't for get to pub get or flutter packages get after saving.

    – Nate Bosch
    Nov 25 '18 at 4:21



















4














I had the same problem. You just have to add latest http dependencies in pubspec.yaml



Here is the full code,



  dependencies:
flutter:
sdk: flutter

http: ^0.12.0+1

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2


Don't forget to change verson no. of http
To check latest version of http click here



If you are running app directly from command line then you could also do:



with Flutter:



$ flutter packages get


with pub:



$ pub get





share|improve this answer


























  • (upvoted) and thanks for the link too!

    – NightSkyDev
    Feb 6 at 13:28



















2














just got to pubspec.yaml file and tweak some changes in file



dependencies:
flutter:
sdk: flutter

cupertino_icons: ^0.1.2

http:



under dependencies section just add http like in code description .



flutter will automatically resolve it and will add updated version of http .






share|improve this answer































    1














    this worked for me:



    dependencies:
    flutter:
    sdk: flutter

    cupertino_icons: ^0.1.2
    http: any


    then:



    flutter doctor -v


    Finally:



    flutter packages get





    share|improve this answer































      1














      add below to pubspec.ymel file



      dependencies:
      flutter:
      sdk: flutter

      cupertino_icons: ^0.1.2
      http: ^0.12.0+1


      use flutter pub to find the latest version



      call



      flutter packages get





      share|improve this answer
























        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53462488%2fflutter-how-to-resolve-error-importing-packagehttp-http-dart%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        26














        Go to your pubspec.yaml file , and add the http dependency:



            dependencies:
        flutter:
        sdk: flutter

        cupertino_icons: ^0.1.2
        http: any


        Remember, the indentation must be the same as 'flutter' or 'cupertino_icons'






        share|improve this answer



















        • 3





          And don't for get to pub get or flutter packages get after saving.

          – Nate Bosch
          Nov 25 '18 at 4:21
















        26














        Go to your pubspec.yaml file , and add the http dependency:



            dependencies:
        flutter:
        sdk: flutter

        cupertino_icons: ^0.1.2
        http: any


        Remember, the indentation must be the same as 'flutter' or 'cupertino_icons'






        share|improve this answer



















        • 3





          And don't for get to pub get or flutter packages get after saving.

          – Nate Bosch
          Nov 25 '18 at 4:21














        26












        26








        26







        Go to your pubspec.yaml file , and add the http dependency:



            dependencies:
        flutter:
        sdk: flutter

        cupertino_icons: ^0.1.2
        http: any


        Remember, the indentation must be the same as 'flutter' or 'cupertino_icons'






        share|improve this answer













        Go to your pubspec.yaml file , and add the http dependency:



            dependencies:
        flutter:
        sdk: flutter

        cupertino_icons: ^0.1.2
        http: any


        Remember, the indentation must be the same as 'flutter' or 'cupertino_icons'







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 25 '18 at 3:35









        diegoveloperdiegoveloper

        15.9k12636




        15.9k12636








        • 3





          And don't for get to pub get or flutter packages get after saving.

          – Nate Bosch
          Nov 25 '18 at 4:21














        • 3





          And don't for get to pub get or flutter packages get after saving.

          – Nate Bosch
          Nov 25 '18 at 4:21








        3




        3





        And don't for get to pub get or flutter packages get after saving.

        – Nate Bosch
        Nov 25 '18 at 4:21





        And don't for get to pub get or flutter packages get after saving.

        – Nate Bosch
        Nov 25 '18 at 4:21













        4














        I had the same problem. You just have to add latest http dependencies in pubspec.yaml



        Here is the full code,



          dependencies:
        flutter:
        sdk: flutter

        http: ^0.12.0+1

        # The following adds the Cupertino Icons font to your application.
        # Use with the CupertinoIcons class for iOS style icons.
        cupertino_icons: ^0.1.2


        Don't forget to change verson no. of http
        To check latest version of http click here



        If you are running app directly from command line then you could also do:



        with Flutter:



        $ flutter packages get


        with pub:



        $ pub get





        share|improve this answer


























        • (upvoted) and thanks for the link too!

          – NightSkyDev
          Feb 6 at 13:28
















        4














        I had the same problem. You just have to add latest http dependencies in pubspec.yaml



        Here is the full code,



          dependencies:
        flutter:
        sdk: flutter

        http: ^0.12.0+1

        # The following adds the Cupertino Icons font to your application.
        # Use with the CupertinoIcons class for iOS style icons.
        cupertino_icons: ^0.1.2


        Don't forget to change verson no. of http
        To check latest version of http click here



        If you are running app directly from command line then you could also do:



        with Flutter:



        $ flutter packages get


        with pub:



        $ pub get





        share|improve this answer


























        • (upvoted) and thanks for the link too!

          – NightSkyDev
          Feb 6 at 13:28














        4












        4








        4







        I had the same problem. You just have to add latest http dependencies in pubspec.yaml



        Here is the full code,



          dependencies:
        flutter:
        sdk: flutter

        http: ^0.12.0+1

        # The following adds the Cupertino Icons font to your application.
        # Use with the CupertinoIcons class for iOS style icons.
        cupertino_icons: ^0.1.2


        Don't forget to change verson no. of http
        To check latest version of http click here



        If you are running app directly from command line then you could also do:



        with Flutter:



        $ flutter packages get


        with pub:



        $ pub get





        share|improve this answer















        I had the same problem. You just have to add latest http dependencies in pubspec.yaml



        Here is the full code,



          dependencies:
        flutter:
        sdk: flutter

        http: ^0.12.0+1

        # The following adds the Cupertino Icons font to your application.
        # Use with the CupertinoIcons class for iOS style icons.
        cupertino_icons: ^0.1.2


        Don't forget to change verson no. of http
        To check latest version of http click here



        If you are running app directly from command line then you could also do:



        with Flutter:



        $ flutter packages get


        with pub:



        $ pub get






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 28 at 6:15









        ray

        3,3731829




        3,3731829










        answered Jan 28 at 5:51









        Akshat TamrakarAkshat Tamrakar

        773




        773













        • (upvoted) and thanks for the link too!

          – NightSkyDev
          Feb 6 at 13:28



















        • (upvoted) and thanks for the link too!

          – NightSkyDev
          Feb 6 at 13:28

















        (upvoted) and thanks for the link too!

        – NightSkyDev
        Feb 6 at 13:28





        (upvoted) and thanks for the link too!

        – NightSkyDev
        Feb 6 at 13:28











        2














        just got to pubspec.yaml file and tweak some changes in file



        dependencies:
        flutter:
        sdk: flutter

        cupertino_icons: ^0.1.2

        http:



        under dependencies section just add http like in code description .



        flutter will automatically resolve it and will add updated version of http .






        share|improve this answer




























          2














          just got to pubspec.yaml file and tweak some changes in file



          dependencies:
          flutter:
          sdk: flutter

          cupertino_icons: ^0.1.2

          http:



          under dependencies section just add http like in code description .



          flutter will automatically resolve it and will add updated version of http .






          share|improve this answer


























            2












            2








            2







            just got to pubspec.yaml file and tweak some changes in file



            dependencies:
            flutter:
            sdk: flutter

            cupertino_icons: ^0.1.2

            http:



            under dependencies section just add http like in code description .



            flutter will automatically resolve it and will add updated version of http .






            share|improve this answer













            just got to pubspec.yaml file and tweak some changes in file



            dependencies:
            flutter:
            sdk: flutter

            cupertino_icons: ^0.1.2

            http:



            under dependencies section just add http like in code description .



            flutter will automatically resolve it and will add updated version of http .







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 28 at 7:01









            Ali BabaAli Baba

            257




            257























                1














                this worked for me:



                dependencies:
                flutter:
                sdk: flutter

                cupertino_icons: ^0.1.2
                http: any


                then:



                flutter doctor -v


                Finally:



                flutter packages get





                share|improve this answer




























                  1














                  this worked for me:



                  dependencies:
                  flutter:
                  sdk: flutter

                  cupertino_icons: ^0.1.2
                  http: any


                  then:



                  flutter doctor -v


                  Finally:



                  flutter packages get





                  share|improve this answer


























                    1












                    1








                    1







                    this worked for me:



                    dependencies:
                    flutter:
                    sdk: flutter

                    cupertino_icons: ^0.1.2
                    http: any


                    then:



                    flutter doctor -v


                    Finally:



                    flutter packages get





                    share|improve this answer













                    this worked for me:



                    dependencies:
                    flutter:
                    sdk: flutter

                    cupertino_icons: ^0.1.2
                    http: any


                    then:



                    flutter doctor -v


                    Finally:



                    flutter packages get






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 3 at 5:40









                    Diego Santa Cruz MendezúDiego Santa Cruz Mendezú

                    1,122911




                    1,122911























                        1














                        add below to pubspec.ymel file



                        dependencies:
                        flutter:
                        sdk: flutter

                        cupertino_icons: ^0.1.2
                        http: ^0.12.0+1


                        use flutter pub to find the latest version



                        call



                        flutter packages get





                        share|improve this answer




























                          1














                          add below to pubspec.ymel file



                          dependencies:
                          flutter:
                          sdk: flutter

                          cupertino_icons: ^0.1.2
                          http: ^0.12.0+1


                          use flutter pub to find the latest version



                          call



                          flutter packages get





                          share|improve this answer


























                            1












                            1








                            1







                            add below to pubspec.ymel file



                            dependencies:
                            flutter:
                            sdk: flutter

                            cupertino_icons: ^0.1.2
                            http: ^0.12.0+1


                            use flutter pub to find the latest version



                            call



                            flutter packages get





                            share|improve this answer













                            add below to pubspec.ymel file



                            dependencies:
                            flutter:
                            sdk: flutter

                            cupertino_icons: ^0.1.2
                            http: ^0.12.0+1


                            use flutter pub to find the latest version



                            call



                            flutter packages get






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Mar 16 at 1:54









                            SamSam

                            3,07675073




                            3,07675073






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53462488%2fflutter-how-to-resolve-error-importing-packagehttp-http-dart%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                這個網誌中的熱門文章

                                Post-Redirect-Get with Spring WebFlux and Thymeleaf

                                Xamarin.form Move up view when keyboard appear

                                JBPM : POST request for execute process go wrong