Flutter: Error when trying to add data into a Map List2019 Community Moderator ElectionImplementing PreferredSizeWidget For Use As AppbarFlutter: Failed assertion while using navigator.dartHow to offset a scaffold widget in Flutter?ListView.builder not workingHow to display json data in flutter chartsFlutter : Bad state: Stream has already been listened toHow to use Drawer without Scaffold.drawer?preload assets images before buildMediaQuery.of() error when trying to set Background Image in FlutterHow I can put Widget above Widget using List<Widget> widget in Flutter?

Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit?

Could you please stop shuffling the deck and play already?

Single word request: Harming the benefactor

Marriage green card at end of current visa with 2 Year residency requirement waiver in-process, question

PTIJ: Should I kill my computer after installing software?

Why would one plane in this picture not have gear down yet?

When a wind turbine does not produce enough electricity how does the power company compensate for the loss?

What problems would a superhuman have whose skin is constantly hot?

Is "conspicuously missing" or "conspicuously" the subject of this sentence?

Reverse string, can I make it faster?

What is the cause of the Apocalypse in The Umbrella Academy?

School performs periodic password audits. Is my password compromised?

cat shows nothing

Plausibility of Mushroom Buildings

What are the practical Opportunty Attack values for a bugbear, holding a reach weapon, with Polearm Mastery?

Vocabulary for giving just numbers, not a full answer

What wound would be of little consequence to a biped but terrible for a quadruped?

How to draw cubes in a 3 dimensional plane

Child Theme Path Being Ignored With wp_enqueue_scripts

Motivation for Zeta Function of an Algebraic Variety

What was the implant device Captain Marvel was using?

How to secure an aircraft at a transient parking space?

Do I really need to have a scientific explanation for my premise?

Are all players supposed to be able to see each others' character sheets?



Flutter: Error when trying to add data into a Map List



2019 Community Moderator ElectionImplementing PreferredSizeWidget For Use As AppbarFlutter: Failed assertion while using navigator.dartHow to offset a scaffold widget in Flutter?ListView.builder not workingHow to display json data in flutter chartsFlutter : Bad state: Stream has already been listened toHow to use Drawer without Scaffold.drawer?preload assets images before buildMediaQuery.of() error when trying to set Background Image in FlutterHow I can put Widget above Widget using List<Widget> widget in Flutter?










3















I am very much new to Flutter. I am developing a testing app and blow is my code.



main.dart



import 'package:flutter/material.dart';

import './pages/homepage.dart';

void main()
runApp(MyApp());


class MyApp extends StatelessWidget
@override
Widget build(BuildContext context)
// TODO: implement build
return MaterialApp(
theme: ThemeData(primaryColor: Colors.green),
home: Homepage(),
);




homepage.dart



import 'package:flutter/material.dart';

class Homepage extends StatelessWidget
List<Map<String, String>> productMap;

Homepage()
productMap.add("title": "Chocolate", "imageUrl": "");


@override
Widget build(BuildContext context)
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: Text("Choco Factory"),
),
body: HomepageUI(),
);



class HomepageUI extends StatefulWidget
HomepageUI()

@override
State<StatefulWidget> createState()
// TODO: implement createState
return _HomepageUIBuilder();



class _HomepageUIBuilder extends State<HomepageUI>
@override
Widget build(BuildContext context)
// TODO: implement build
return Expanded(
child: Column(
children: <Widget>[
ListView.builder(
itemBuilder: _listBuilder,
)
],
),
);


Widget _listBuilder(BuildContext context, int index)
return Card(
child: Column(
children: <Widget>[
Image.asset("name"),
Text("data"),
RaisedButton(
onPressed: () ,
child: Text("Details"),
color: ThemeData().primaryColor,
)
],
),
);




I get the following error and I can't figure out why. I am from Java background and the code seems OK to me. Also I have another question, in Java Map we can add many key-value pairs to the Map but in Flutter it seems only one key-value pair is possible?



Launching libmain.dart on A37f in debug mode...
Built buildappoutputsapkdebugapp-debug.apk.
I/Choreographer(11935): Skipped 87 frames! The application may be doing too much work on its main thread.
I/flutter (11935): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (11935): The following NoSuchMethodError was thrown building MyApp(dirty):
I/flutter (11935): The method 'add' was called on null.
I/flutter (11935): Receiver: null
I/flutter (11935): Tried calling: add(_LinkedHashMap len:2)
I/flutter (11935): When the exception was thrown, this was the stack:
I/flutter (11935): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
I/flutter (11935): #1 new Homepage
I/flutter (11935): #2 MyApp.build
I/flutter (11935): #3 StatelessElement.build
I/flutter (11935): #4 ComponentElement.performRebuild
I/flutter (11935): #5 Element.rebuild
I/flutter (11935): #6 ComponentElement._firstBuild
I/flutter (11935): #7 ComponentElement.mount
I/flutter (11935): #8 Element.inflateWidget
I/flutter (11935): #9 Element.updateChild
I/flutter (11935): #10 RenderObjectToWidgetElement._rebuild
I/flutter (11935): #11 RenderObjectToWidgetElement.mount
I/flutter (11935): #12 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
I/flutter (11935): #13 BuildOwner.buildScope
I/flutter (11935): #14 RenderObjectToWidgetAdapter.attachToRenderTree
I/flutter (11935): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.attachRootWidget
I/flutter (11935): #16 runApp
I/flutter (11935): #17 main
I/flutter (11935): #18 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:189:25)
I/flutter (11935): #23 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:180:5)
I/flutter (11935): #24 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:300:19)
I/flutter (11935): #25 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
I/flutter (11935): (elided 4 frames from package dart:async)
I/flutter (11935): ════════════════════════════════════════════════════════════════════════════════════════════════════









share|improve this question




























    3















    I am very much new to Flutter. I am developing a testing app and blow is my code.



    main.dart



    import 'package:flutter/material.dart';

    import './pages/homepage.dart';

    void main()
    runApp(MyApp());


    class MyApp extends StatelessWidget
    @override
    Widget build(BuildContext context)
    // TODO: implement build
    return MaterialApp(
    theme: ThemeData(primaryColor: Colors.green),
    home: Homepage(),
    );




    homepage.dart



    import 'package:flutter/material.dart';

    class Homepage extends StatelessWidget
    List<Map<String, String>> productMap;

    Homepage()
    productMap.add("title": "Chocolate", "imageUrl": "");


    @override
    Widget build(BuildContext context)
    // TODO: implement build
    return Scaffold(
    appBar: AppBar(
    title: Text("Choco Factory"),
    ),
    body: HomepageUI(),
    );



    class HomepageUI extends StatefulWidget
    HomepageUI()

    @override
    State<StatefulWidget> createState()
    // TODO: implement createState
    return _HomepageUIBuilder();



    class _HomepageUIBuilder extends State<HomepageUI>
    @override
    Widget build(BuildContext context)
    // TODO: implement build
    return Expanded(
    child: Column(
    children: <Widget>[
    ListView.builder(
    itemBuilder: _listBuilder,
    )
    ],
    ),
    );


    Widget _listBuilder(BuildContext context, int index)
    return Card(
    child: Column(
    children: <Widget>[
    Image.asset("name"),
    Text("data"),
    RaisedButton(
    onPressed: () ,
    child: Text("Details"),
    color: ThemeData().primaryColor,
    )
    ],
    ),
    );




    I get the following error and I can't figure out why. I am from Java background and the code seems OK to me. Also I have another question, in Java Map we can add many key-value pairs to the Map but in Flutter it seems only one key-value pair is possible?



    Launching libmain.dart on A37f in debug mode...
    Built buildappoutputsapkdebugapp-debug.apk.
    I/Choreographer(11935): Skipped 87 frames! The application may be doing too much work on its main thread.
    I/flutter (11935): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
    I/flutter (11935): The following NoSuchMethodError was thrown building MyApp(dirty):
    I/flutter (11935): The method 'add' was called on null.
    I/flutter (11935): Receiver: null
    I/flutter (11935): Tried calling: add(_LinkedHashMap len:2)
    I/flutter (11935): When the exception was thrown, this was the stack:
    I/flutter (11935): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
    I/flutter (11935): #1 new Homepage
    I/flutter (11935): #2 MyApp.build
    I/flutter (11935): #3 StatelessElement.build
    I/flutter (11935): #4 ComponentElement.performRebuild
    I/flutter (11935): #5 Element.rebuild
    I/flutter (11935): #6 ComponentElement._firstBuild
    I/flutter (11935): #7 ComponentElement.mount
    I/flutter (11935): #8 Element.inflateWidget
    I/flutter (11935): #9 Element.updateChild
    I/flutter (11935): #10 RenderObjectToWidgetElement._rebuild
    I/flutter (11935): #11 RenderObjectToWidgetElement.mount
    I/flutter (11935): #12 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
    I/flutter (11935): #13 BuildOwner.buildScope
    I/flutter (11935): #14 RenderObjectToWidgetAdapter.attachToRenderTree
    I/flutter (11935): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.attachRootWidget
    I/flutter (11935): #16 runApp
    I/flutter (11935): #17 main
    I/flutter (11935): #18 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:189:25)
    I/flutter (11935): #23 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:180:5)
    I/flutter (11935): #24 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:300:19)
    I/flutter (11935): #25 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
    I/flutter (11935): (elided 4 frames from package dart:async)
    I/flutter (11935): ════════════════════════════════════════════════════════════════════════════════════════════════════









    share|improve this question


























      3












      3








      3


      1






      I am very much new to Flutter. I am developing a testing app and blow is my code.



      main.dart



      import 'package:flutter/material.dart';

      import './pages/homepage.dart';

      void main()
      runApp(MyApp());


      class MyApp extends StatelessWidget
      @override
      Widget build(BuildContext context)
      // TODO: implement build
      return MaterialApp(
      theme: ThemeData(primaryColor: Colors.green),
      home: Homepage(),
      );




      homepage.dart



      import 'package:flutter/material.dart';

      class Homepage extends StatelessWidget
      List<Map<String, String>> productMap;

      Homepage()
      productMap.add("title": "Chocolate", "imageUrl": "");


      @override
      Widget build(BuildContext context)
      // TODO: implement build
      return Scaffold(
      appBar: AppBar(
      title: Text("Choco Factory"),
      ),
      body: HomepageUI(),
      );



      class HomepageUI extends StatefulWidget
      HomepageUI()

      @override
      State<StatefulWidget> createState()
      // TODO: implement createState
      return _HomepageUIBuilder();



      class _HomepageUIBuilder extends State<HomepageUI>
      @override
      Widget build(BuildContext context)
      // TODO: implement build
      return Expanded(
      child: Column(
      children: <Widget>[
      ListView.builder(
      itemBuilder: _listBuilder,
      )
      ],
      ),
      );


      Widget _listBuilder(BuildContext context, int index)
      return Card(
      child: Column(
      children: <Widget>[
      Image.asset("name"),
      Text("data"),
      RaisedButton(
      onPressed: () ,
      child: Text("Details"),
      color: ThemeData().primaryColor,
      )
      ],
      ),
      );




      I get the following error and I can't figure out why. I am from Java background and the code seems OK to me. Also I have another question, in Java Map we can add many key-value pairs to the Map but in Flutter it seems only one key-value pair is possible?



      Launching libmain.dart on A37f in debug mode...
      Built buildappoutputsapkdebugapp-debug.apk.
      I/Choreographer(11935): Skipped 87 frames! The application may be doing too much work on its main thread.
      I/flutter (11935): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
      I/flutter (11935): The following NoSuchMethodError was thrown building MyApp(dirty):
      I/flutter (11935): The method 'add' was called on null.
      I/flutter (11935): Receiver: null
      I/flutter (11935): Tried calling: add(_LinkedHashMap len:2)
      I/flutter (11935): When the exception was thrown, this was the stack:
      I/flutter (11935): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
      I/flutter (11935): #1 new Homepage
      I/flutter (11935): #2 MyApp.build
      I/flutter (11935): #3 StatelessElement.build
      I/flutter (11935): #4 ComponentElement.performRebuild
      I/flutter (11935): #5 Element.rebuild
      I/flutter (11935): #6 ComponentElement._firstBuild
      I/flutter (11935): #7 ComponentElement.mount
      I/flutter (11935): #8 Element.inflateWidget
      I/flutter (11935): #9 Element.updateChild
      I/flutter (11935): #10 RenderObjectToWidgetElement._rebuild
      I/flutter (11935): #11 RenderObjectToWidgetElement.mount
      I/flutter (11935): #12 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
      I/flutter (11935): #13 BuildOwner.buildScope
      I/flutter (11935): #14 RenderObjectToWidgetAdapter.attachToRenderTree
      I/flutter (11935): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.attachRootWidget
      I/flutter (11935): #16 runApp
      I/flutter (11935): #17 main
      I/flutter (11935): #18 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:189:25)
      I/flutter (11935): #23 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:180:5)
      I/flutter (11935): #24 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:300:19)
      I/flutter (11935): #25 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
      I/flutter (11935): (elided 4 frames from package dart:async)
      I/flutter (11935): ════════════════════════════════════════════════════════════════════════════════════════════════════









      share|improve this question
















      I am very much new to Flutter. I am developing a testing app and blow is my code.



      main.dart



      import 'package:flutter/material.dart';

      import './pages/homepage.dart';

      void main()
      runApp(MyApp());


      class MyApp extends StatelessWidget
      @override
      Widget build(BuildContext context)
      // TODO: implement build
      return MaterialApp(
      theme: ThemeData(primaryColor: Colors.green),
      home: Homepage(),
      );




      homepage.dart



      import 'package:flutter/material.dart';

      class Homepage extends StatelessWidget
      List<Map<String, String>> productMap;

      Homepage()
      productMap.add("title": "Chocolate", "imageUrl": "");


      @override
      Widget build(BuildContext context)
      // TODO: implement build
      return Scaffold(
      appBar: AppBar(
      title: Text("Choco Factory"),
      ),
      body: HomepageUI(),
      );



      class HomepageUI extends StatefulWidget
      HomepageUI()

      @override
      State<StatefulWidget> createState()
      // TODO: implement createState
      return _HomepageUIBuilder();



      class _HomepageUIBuilder extends State<HomepageUI>
      @override
      Widget build(BuildContext context)
      // TODO: implement build
      return Expanded(
      child: Column(
      children: <Widget>[
      ListView.builder(
      itemBuilder: _listBuilder,
      )
      ],
      ),
      );


      Widget _listBuilder(BuildContext context, int index)
      return Card(
      child: Column(
      children: <Widget>[
      Image.asset("name"),
      Text("data"),
      RaisedButton(
      onPressed: () ,
      child: Text("Details"),
      color: ThemeData().primaryColor,
      )
      ],
      ),
      );




      I get the following error and I can't figure out why. I am from Java background and the code seems OK to me. Also I have another question, in Java Map we can add many key-value pairs to the Map but in Flutter it seems only one key-value pair is possible?



      Launching libmain.dart on A37f in debug mode...
      Built buildappoutputsapkdebugapp-debug.apk.
      I/Choreographer(11935): Skipped 87 frames! The application may be doing too much work on its main thread.
      I/flutter (11935): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
      I/flutter (11935): The following NoSuchMethodError was thrown building MyApp(dirty):
      I/flutter (11935): The method 'add' was called on null.
      I/flutter (11935): Receiver: null
      I/flutter (11935): Tried calling: add(_LinkedHashMap len:2)
      I/flutter (11935): When the exception was thrown, this was the stack:
      I/flutter (11935): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
      I/flutter (11935): #1 new Homepage
      I/flutter (11935): #2 MyApp.build
      I/flutter (11935): #3 StatelessElement.build
      I/flutter (11935): #4 ComponentElement.performRebuild
      I/flutter (11935): #5 Element.rebuild
      I/flutter (11935): #6 ComponentElement._firstBuild
      I/flutter (11935): #7 ComponentElement.mount
      I/flutter (11935): #8 Element.inflateWidget
      I/flutter (11935): #9 Element.updateChild
      I/flutter (11935): #10 RenderObjectToWidgetElement._rebuild
      I/flutter (11935): #11 RenderObjectToWidgetElement.mount
      I/flutter (11935): #12 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
      I/flutter (11935): #13 BuildOwner.buildScope
      I/flutter (11935): #14 RenderObjectToWidgetAdapter.attachToRenderTree
      I/flutter (11935): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.attachRootWidget
      I/flutter (11935): #16 runApp
      I/flutter (11935): #17 main
      I/flutter (11935): #18 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:189:25)
      I/flutter (11935): #23 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:180:5)
      I/flutter (11935): #24 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:300:19)
      I/flutter (11935): #25 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
      I/flutter (11935): (elided 4 frames from package dart:async)
      I/flutter (11935): ════════════════════════════════════════════════════════════════════════════════════════════════════






      android dart null flutter






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 7 at 6:35







      PeakGen

















      asked Mar 7 at 6:25









      PeakGenPeakGen

      8,22849158298




      8,22849158298






















          2 Answers
          2






          active

          oldest

          votes


















          2














          List<Map<String, String>> productMap;


          should be



          List<Map<String, String>> productMap = [];


          otherwise productMap is only declared, but not initialized (null)






          share|improve this answer






























            2














            You have not initialised the List.



            Please change



            List<Map<String, String>> productMap;


            to



            List<Map<String, String>> productMap = <Map<String, String>>[];


            Hope this helped!






            share|improve this answer


















            • 1





              <Map<String, String>> on the right side is redundant. It's inferred from the left side.

              – Günter Zöchbauer
              Mar 7 at 6:40











            • Of course, I usually follow specifying types :)

              – Hemanth Raj
              Mar 7 at 6:42










            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%2f55037319%2fflutter-error-when-trying-to-add-data-into-a-map-list%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            List<Map<String, String>> productMap;


            should be



            List<Map<String, String>> productMap = [];


            otherwise productMap is only declared, but not initialized (null)






            share|improve this answer



























              2














              List<Map<String, String>> productMap;


              should be



              List<Map<String, String>> productMap = [];


              otherwise productMap is only declared, but not initialized (null)






              share|improve this answer

























                2












                2








                2







                List<Map<String, String>> productMap;


                should be



                List<Map<String, String>> productMap = [];


                otherwise productMap is only declared, but not initialized (null)






                share|improve this answer













                List<Map<String, String>> productMap;


                should be



                List<Map<String, String>> productMap = [];


                otherwise productMap is only declared, but not initialized (null)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 7 at 6:36









                Günter ZöchbauerGünter Zöchbauer

                330k69994933




                330k69994933























                    2














                    You have not initialised the List.



                    Please change



                    List<Map<String, String>> productMap;


                    to



                    List<Map<String, String>> productMap = <Map<String, String>>[];


                    Hope this helped!






                    share|improve this answer


















                    • 1





                      <Map<String, String>> on the right side is redundant. It's inferred from the left side.

                      – Günter Zöchbauer
                      Mar 7 at 6:40











                    • Of course, I usually follow specifying types :)

                      – Hemanth Raj
                      Mar 7 at 6:42















                    2














                    You have not initialised the List.



                    Please change



                    List<Map<String, String>> productMap;


                    to



                    List<Map<String, String>> productMap = <Map<String, String>>[];


                    Hope this helped!






                    share|improve this answer


















                    • 1





                      <Map<String, String>> on the right side is redundant. It's inferred from the left side.

                      – Günter Zöchbauer
                      Mar 7 at 6:40











                    • Of course, I usually follow specifying types :)

                      – Hemanth Raj
                      Mar 7 at 6:42













                    2












                    2








                    2







                    You have not initialised the List.



                    Please change



                    List<Map<String, String>> productMap;


                    to



                    List<Map<String, String>> productMap = <Map<String, String>>[];


                    Hope this helped!






                    share|improve this answer













                    You have not initialised the List.



                    Please change



                    List<Map<String, String>> productMap;


                    to



                    List<Map<String, String>> productMap = <Map<String, String>>[];


                    Hope this helped!







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 7 at 6:36









                    Hemanth RajHemanth Raj

                    5,3801731




                    5,3801731







                    • 1





                      <Map<String, String>> on the right side is redundant. It's inferred from the left side.

                      – Günter Zöchbauer
                      Mar 7 at 6:40











                    • Of course, I usually follow specifying types :)

                      – Hemanth Raj
                      Mar 7 at 6:42












                    • 1





                      <Map<String, String>> on the right side is redundant. It's inferred from the left side.

                      – Günter Zöchbauer
                      Mar 7 at 6:40











                    • Of course, I usually follow specifying types :)

                      – Hemanth Raj
                      Mar 7 at 6:42







                    1




                    1





                    <Map<String, String>> on the right side is redundant. It's inferred from the left side.

                    – Günter Zöchbauer
                    Mar 7 at 6:40





                    <Map<String, String>> on the right side is redundant. It's inferred from the left side.

                    – Günter Zöchbauer
                    Mar 7 at 6:40













                    Of course, I usually follow specifying types :)

                    – Hemanth Raj
                    Mar 7 at 6:42





                    Of course, I usually follow specifying types :)

                    – Hemanth Raj
                    Mar 7 at 6:42

















                    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%2f55037319%2fflutter-error-when-trying-to-add-data-into-a-map-list%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







                    Popular posts from this blog

                    How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

                    Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

                    List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229