Add a new widget upon receiving API result












0















I am trying to build an entirely new widget tree after selecting an option in the DropdownButton menu, upon receiving data from a REST API after that selection.



Unfortunately, I keep getting the following error:




The following assertion was thrown building
MediaQuery(MediaQueryData(size: Size(411.4, 683.4), devicePixelRatio: 2.6, textScaleFactor: 1.0, padding: EdgeInsets.zero,
viewInsets: EdgeInsets.zero, alwaysUse24HourFormat:
false, accessibleNavigation: falsedisableAnimations:
falseinvertColors: falseboldText: false)):
'package:flutter/src/widgets/sliver.dart': Failed
assertion: line 551 pos 12: 'child != null': is not
true.




What my code does is essentially to check whether the data is present, which it won't be until the dropdown menu option is selected. Initially when there is no data, the ListView in the Scaffold holds simply an empty container below the dropdown menu but when the item is selected, data should be retrieved and the whole widget tree rebuilt, resulting in a ListView.separated within the enclosing ListView instead of the empty container.



The issue seems to lie in the setState() method of onChanged in DropdownButton after some preliminary debugging but I can't seem to figure out what the issue is. Do note also that the items in the dropdown menu is populated from the API but that is separate from the issue.



Any help would be greatly appreciated!



The relevant code is as follows:



class _TodosByTagsHomePageState extends State<TodosByTagsHomePage> {
Tag selectedTag;

Future<List<Tag>> _tagsList;
List _todoList = new List<Todo>();

@override
void initState() {
_tagsList = fetchTags();
super.initState();
}

final Logger log = new Logger('TodosByTags');

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Second Screen"),
),
body: ListView(
children: <Widget>[
FutureBuilder<List<Tag>>(
future: _tagsList,
builder: (context, snapshot) {
if (snapshot.hasData) {
return DropdownButton<Tag>(
value: selectedTag,
items: snapshot.data.map((value) {
return new DropdownMenuItem<Tag>(
value: value,
child: Text(value.tagName),
);
}).toList(),
hint: Text("Select tag"),
onChanged: (Tag chosenTag) {
setState(() {
log.info("In set state");
selectedTag = chosenTag;
Scaffold.of(context).showSnackBar(new SnackBar(
content: Text(selectedTag.tagName)));
});
},
);
} else if (snapshot.hasError) {
return Text("${snapshot.error}");
}

return Container(width: 0.0, height: 0.0);
}),
createSimpleWidget(),
])
);
}

Widget createSimpleWidget() {
if (selectedTag == null) {
return Container();
} else {
retrieveSelectedTodoAndCreateList(selectedTag.tagName);
}
}

FutureBuilder<List<Todo>> retrieveSelectedTodoAndCreateList(String tagName) {
return new FutureBuilder<List<Todo>>(
future: fetchSelectedTodos(tagName),
builder: (context, snapshot) {
if (snapshot.hasData) {
print(snapshot.hasData);
_todoList = snapshot.data;
return createSelectedTodoListViewWidget(_todoList);
} else if (snapshot.hasError) {
return Text("${snapshot.error}");
}

return Container(width: 0.0, height: 0.0);
});
}

createSelectedTodoListViewWidget(List<Todo> todoList) {
final _BIGGER_FONT = const TextStyle(fontSize: 18.0);

Widget _buildTodoList() {
return ListView.separated(
physics: const ScrollPhysics(),
itemCount: todoList == null ? 0 : todoList.length,
separatorBuilder: (BuildContext context, int index) => Divider(),
shrinkWrap: true,
padding: const EdgeInsets.fromLTRB(32.0, 32.0, 32.0, 0.0),
itemBuilder: (context, i) {
return ListTile(
title: Text(todoList[i].getTaskName(), style: _BIGGER_FONT),
);
});
}

return _buildTodoList();
}


}









share|improve this question



























    0















    I am trying to build an entirely new widget tree after selecting an option in the DropdownButton menu, upon receiving data from a REST API after that selection.



    Unfortunately, I keep getting the following error:




    The following assertion was thrown building
    MediaQuery(MediaQueryData(size: Size(411.4, 683.4), devicePixelRatio: 2.6, textScaleFactor: 1.0, padding: EdgeInsets.zero,
    viewInsets: EdgeInsets.zero, alwaysUse24HourFormat:
    false, accessibleNavigation: falsedisableAnimations:
    falseinvertColors: falseboldText: false)):
    'package:flutter/src/widgets/sliver.dart': Failed
    assertion: line 551 pos 12: 'child != null': is not
    true.




    What my code does is essentially to check whether the data is present, which it won't be until the dropdown menu option is selected. Initially when there is no data, the ListView in the Scaffold holds simply an empty container below the dropdown menu but when the item is selected, data should be retrieved and the whole widget tree rebuilt, resulting in a ListView.separated within the enclosing ListView instead of the empty container.



    The issue seems to lie in the setState() method of onChanged in DropdownButton after some preliminary debugging but I can't seem to figure out what the issue is. Do note also that the items in the dropdown menu is populated from the API but that is separate from the issue.



    Any help would be greatly appreciated!



    The relevant code is as follows:



    class _TodosByTagsHomePageState extends State<TodosByTagsHomePage> {
    Tag selectedTag;

    Future<List<Tag>> _tagsList;
    List _todoList = new List<Todo>();

    @override
    void initState() {
    _tagsList = fetchTags();
    super.initState();
    }

    final Logger log = new Logger('TodosByTags');

    @override
    Widget build(BuildContext context) {
    return Scaffold(
    appBar: AppBar(
    title: Text("Second Screen"),
    ),
    body: ListView(
    children: <Widget>[
    FutureBuilder<List<Tag>>(
    future: _tagsList,
    builder: (context, snapshot) {
    if (snapshot.hasData) {
    return DropdownButton<Tag>(
    value: selectedTag,
    items: snapshot.data.map((value) {
    return new DropdownMenuItem<Tag>(
    value: value,
    child: Text(value.tagName),
    );
    }).toList(),
    hint: Text("Select tag"),
    onChanged: (Tag chosenTag) {
    setState(() {
    log.info("In set state");
    selectedTag = chosenTag;
    Scaffold.of(context).showSnackBar(new SnackBar(
    content: Text(selectedTag.tagName)));
    });
    },
    );
    } else if (snapshot.hasError) {
    return Text("${snapshot.error}");
    }

    return Container(width: 0.0, height: 0.0);
    }),
    createSimpleWidget(),
    ])
    );
    }

    Widget createSimpleWidget() {
    if (selectedTag == null) {
    return Container();
    } else {
    retrieveSelectedTodoAndCreateList(selectedTag.tagName);
    }
    }

    FutureBuilder<List<Todo>> retrieveSelectedTodoAndCreateList(String tagName) {
    return new FutureBuilder<List<Todo>>(
    future: fetchSelectedTodos(tagName),
    builder: (context, snapshot) {
    if (snapshot.hasData) {
    print(snapshot.hasData);
    _todoList = snapshot.data;
    return createSelectedTodoListViewWidget(_todoList);
    } else if (snapshot.hasError) {
    return Text("${snapshot.error}");
    }

    return Container(width: 0.0, height: 0.0);
    });
    }

    createSelectedTodoListViewWidget(List<Todo> todoList) {
    final _BIGGER_FONT = const TextStyle(fontSize: 18.0);

    Widget _buildTodoList() {
    return ListView.separated(
    physics: const ScrollPhysics(),
    itemCount: todoList == null ? 0 : todoList.length,
    separatorBuilder: (BuildContext context, int index) => Divider(),
    shrinkWrap: true,
    padding: const EdgeInsets.fromLTRB(32.0, 32.0, 32.0, 0.0),
    itemBuilder: (context, i) {
    return ListTile(
    title: Text(todoList[i].getTaskName(), style: _BIGGER_FONT),
    );
    });
    }

    return _buildTodoList();
    }


    }









    share|improve this question

























      0












      0








      0








      I am trying to build an entirely new widget tree after selecting an option in the DropdownButton menu, upon receiving data from a REST API after that selection.



      Unfortunately, I keep getting the following error:




      The following assertion was thrown building
      MediaQuery(MediaQueryData(size: Size(411.4, 683.4), devicePixelRatio: 2.6, textScaleFactor: 1.0, padding: EdgeInsets.zero,
      viewInsets: EdgeInsets.zero, alwaysUse24HourFormat:
      false, accessibleNavigation: falsedisableAnimations:
      falseinvertColors: falseboldText: false)):
      'package:flutter/src/widgets/sliver.dart': Failed
      assertion: line 551 pos 12: 'child != null': is not
      true.




      What my code does is essentially to check whether the data is present, which it won't be until the dropdown menu option is selected. Initially when there is no data, the ListView in the Scaffold holds simply an empty container below the dropdown menu but when the item is selected, data should be retrieved and the whole widget tree rebuilt, resulting in a ListView.separated within the enclosing ListView instead of the empty container.



      The issue seems to lie in the setState() method of onChanged in DropdownButton after some preliminary debugging but I can't seem to figure out what the issue is. Do note also that the items in the dropdown menu is populated from the API but that is separate from the issue.



      Any help would be greatly appreciated!



      The relevant code is as follows:



      class _TodosByTagsHomePageState extends State<TodosByTagsHomePage> {
      Tag selectedTag;

      Future<List<Tag>> _tagsList;
      List _todoList = new List<Todo>();

      @override
      void initState() {
      _tagsList = fetchTags();
      super.initState();
      }

      final Logger log = new Logger('TodosByTags');

      @override
      Widget build(BuildContext context) {
      return Scaffold(
      appBar: AppBar(
      title: Text("Second Screen"),
      ),
      body: ListView(
      children: <Widget>[
      FutureBuilder<List<Tag>>(
      future: _tagsList,
      builder: (context, snapshot) {
      if (snapshot.hasData) {
      return DropdownButton<Tag>(
      value: selectedTag,
      items: snapshot.data.map((value) {
      return new DropdownMenuItem<Tag>(
      value: value,
      child: Text(value.tagName),
      );
      }).toList(),
      hint: Text("Select tag"),
      onChanged: (Tag chosenTag) {
      setState(() {
      log.info("In set state");
      selectedTag = chosenTag;
      Scaffold.of(context).showSnackBar(new SnackBar(
      content: Text(selectedTag.tagName)));
      });
      },
      );
      } else if (snapshot.hasError) {
      return Text("${snapshot.error}");
      }

      return Container(width: 0.0, height: 0.0);
      }),
      createSimpleWidget(),
      ])
      );
      }

      Widget createSimpleWidget() {
      if (selectedTag == null) {
      return Container();
      } else {
      retrieveSelectedTodoAndCreateList(selectedTag.tagName);
      }
      }

      FutureBuilder<List<Todo>> retrieveSelectedTodoAndCreateList(String tagName) {
      return new FutureBuilder<List<Todo>>(
      future: fetchSelectedTodos(tagName),
      builder: (context, snapshot) {
      if (snapshot.hasData) {
      print(snapshot.hasData);
      _todoList = snapshot.data;
      return createSelectedTodoListViewWidget(_todoList);
      } else if (snapshot.hasError) {
      return Text("${snapshot.error}");
      }

      return Container(width: 0.0, height: 0.0);
      });
      }

      createSelectedTodoListViewWidget(List<Todo> todoList) {
      final _BIGGER_FONT = const TextStyle(fontSize: 18.0);

      Widget _buildTodoList() {
      return ListView.separated(
      physics: const ScrollPhysics(),
      itemCount: todoList == null ? 0 : todoList.length,
      separatorBuilder: (BuildContext context, int index) => Divider(),
      shrinkWrap: true,
      padding: const EdgeInsets.fromLTRB(32.0, 32.0, 32.0, 0.0),
      itemBuilder: (context, i) {
      return ListTile(
      title: Text(todoList[i].getTaskName(), style: _BIGGER_FONT),
      );
      });
      }

      return _buildTodoList();
      }


      }









      share|improve this question














      I am trying to build an entirely new widget tree after selecting an option in the DropdownButton menu, upon receiving data from a REST API after that selection.



      Unfortunately, I keep getting the following error:




      The following assertion was thrown building
      MediaQuery(MediaQueryData(size: Size(411.4, 683.4), devicePixelRatio: 2.6, textScaleFactor: 1.0, padding: EdgeInsets.zero,
      viewInsets: EdgeInsets.zero, alwaysUse24HourFormat:
      false, accessibleNavigation: falsedisableAnimations:
      falseinvertColors: falseboldText: false)):
      'package:flutter/src/widgets/sliver.dart': Failed
      assertion: line 551 pos 12: 'child != null': is not
      true.




      What my code does is essentially to check whether the data is present, which it won't be until the dropdown menu option is selected. Initially when there is no data, the ListView in the Scaffold holds simply an empty container below the dropdown menu but when the item is selected, data should be retrieved and the whole widget tree rebuilt, resulting in a ListView.separated within the enclosing ListView instead of the empty container.



      The issue seems to lie in the setState() method of onChanged in DropdownButton after some preliminary debugging but I can't seem to figure out what the issue is. Do note also that the items in the dropdown menu is populated from the API but that is separate from the issue.



      Any help would be greatly appreciated!



      The relevant code is as follows:



      class _TodosByTagsHomePageState extends State<TodosByTagsHomePage> {
      Tag selectedTag;

      Future<List<Tag>> _tagsList;
      List _todoList = new List<Todo>();

      @override
      void initState() {
      _tagsList = fetchTags();
      super.initState();
      }

      final Logger log = new Logger('TodosByTags');

      @override
      Widget build(BuildContext context) {
      return Scaffold(
      appBar: AppBar(
      title: Text("Second Screen"),
      ),
      body: ListView(
      children: <Widget>[
      FutureBuilder<List<Tag>>(
      future: _tagsList,
      builder: (context, snapshot) {
      if (snapshot.hasData) {
      return DropdownButton<Tag>(
      value: selectedTag,
      items: snapshot.data.map((value) {
      return new DropdownMenuItem<Tag>(
      value: value,
      child: Text(value.tagName),
      );
      }).toList(),
      hint: Text("Select tag"),
      onChanged: (Tag chosenTag) {
      setState(() {
      log.info("In set state");
      selectedTag = chosenTag;
      Scaffold.of(context).showSnackBar(new SnackBar(
      content: Text(selectedTag.tagName)));
      });
      },
      );
      } else if (snapshot.hasError) {
      return Text("${snapshot.error}");
      }

      return Container(width: 0.0, height: 0.0);
      }),
      createSimpleWidget(),
      ])
      );
      }

      Widget createSimpleWidget() {
      if (selectedTag == null) {
      return Container();
      } else {
      retrieveSelectedTodoAndCreateList(selectedTag.tagName);
      }
      }

      FutureBuilder<List<Todo>> retrieveSelectedTodoAndCreateList(String tagName) {
      return new FutureBuilder<List<Todo>>(
      future: fetchSelectedTodos(tagName),
      builder: (context, snapshot) {
      if (snapshot.hasData) {
      print(snapshot.hasData);
      _todoList = snapshot.data;
      return createSelectedTodoListViewWidget(_todoList);
      } else if (snapshot.hasError) {
      return Text("${snapshot.error}");
      }

      return Container(width: 0.0, height: 0.0);
      });
      }

      createSelectedTodoListViewWidget(List<Todo> todoList) {
      final _BIGGER_FONT = const TextStyle(fontSize: 18.0);

      Widget _buildTodoList() {
      return ListView.separated(
      physics: const ScrollPhysics(),
      itemCount: todoList == null ? 0 : todoList.length,
      separatorBuilder: (BuildContext context, int index) => Divider(),
      shrinkWrap: true,
      padding: const EdgeInsets.fromLTRB(32.0, 32.0, 32.0, 0.0),
      itemBuilder: (context, i) {
      return ListTile(
      title: Text(todoList[i].getTaskName(), style: _BIGGER_FONT),
      );
      });
      }

      return _buildTodoList();
      }


      }






      dart flutter






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 3 at 18:14









      prattypratty

      133




      133
























          1 Answer
          1






          active

          oldest

          votes


















          0














          At first, I'll start by saying something I noticed about your code:

          You're using ListView somewhat incorrectly. While It's true that ListView can contain whatever number and types of elements and arrange them in a linear way, it should contain only widgets of the same type like Contacts or Todos.

          As list view is still a list, like in many programming language, it will take only one type within it, by design, like string or int.

          I'd recommend trying the Column widget with a combination of the Flexible and Expanded widgets.



          Regarding your problem, I think it lies in the createSimpleWidget function. When selectedTag is not null, you're not returning the retrieveSelectedTodoAndCreateList function's return value, so nothing will be returned at all, thus, asserting the child to null. To avoid these things in the future (and also to keep only one return statement in a function), I recommend doing this:



          Widget createSimpleWidget() {
          return (selectedTag == null)
          ? Container()
          : retrieveSelectedTodoAndCreateList(selectedTag.tagName);
          }


          Hope this helps!






          share|improve this answer
























          • This worked for me! Thank you too on the advice on ListView. Just a question, which might be rather rudimentary, but since I am already returning inside retrieveSelectedTodoAndCreateList() method, why do I have to state an additional return in createSimpleWidget()?

            – pratty
            Jan 4 at 2:45











          • retrieveSelectedTodoAndCreateList returns a value to createSimpleWidget, but createSimpleWidget doesn't return the value to the original function that called it, the builder.

            – Amit Toren
            Jan 4 at 17:12














          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%2f54027647%2fadd-a-new-widget-upon-receiving-api-result%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          At first, I'll start by saying something I noticed about your code:

          You're using ListView somewhat incorrectly. While It's true that ListView can contain whatever number and types of elements and arrange them in a linear way, it should contain only widgets of the same type like Contacts or Todos.

          As list view is still a list, like in many programming language, it will take only one type within it, by design, like string or int.

          I'd recommend trying the Column widget with a combination of the Flexible and Expanded widgets.



          Regarding your problem, I think it lies in the createSimpleWidget function. When selectedTag is not null, you're not returning the retrieveSelectedTodoAndCreateList function's return value, so nothing will be returned at all, thus, asserting the child to null. To avoid these things in the future (and also to keep only one return statement in a function), I recommend doing this:



          Widget createSimpleWidget() {
          return (selectedTag == null)
          ? Container()
          : retrieveSelectedTodoAndCreateList(selectedTag.tagName);
          }


          Hope this helps!






          share|improve this answer
























          • This worked for me! Thank you too on the advice on ListView. Just a question, which might be rather rudimentary, but since I am already returning inside retrieveSelectedTodoAndCreateList() method, why do I have to state an additional return in createSimpleWidget()?

            – pratty
            Jan 4 at 2:45











          • retrieveSelectedTodoAndCreateList returns a value to createSimpleWidget, but createSimpleWidget doesn't return the value to the original function that called it, the builder.

            – Amit Toren
            Jan 4 at 17:12


















          0














          At first, I'll start by saying something I noticed about your code:

          You're using ListView somewhat incorrectly. While It's true that ListView can contain whatever number and types of elements and arrange them in a linear way, it should contain only widgets of the same type like Contacts or Todos.

          As list view is still a list, like in many programming language, it will take only one type within it, by design, like string or int.

          I'd recommend trying the Column widget with a combination of the Flexible and Expanded widgets.



          Regarding your problem, I think it lies in the createSimpleWidget function. When selectedTag is not null, you're not returning the retrieveSelectedTodoAndCreateList function's return value, so nothing will be returned at all, thus, asserting the child to null. To avoid these things in the future (and also to keep only one return statement in a function), I recommend doing this:



          Widget createSimpleWidget() {
          return (selectedTag == null)
          ? Container()
          : retrieveSelectedTodoAndCreateList(selectedTag.tagName);
          }


          Hope this helps!






          share|improve this answer
























          • This worked for me! Thank you too on the advice on ListView. Just a question, which might be rather rudimentary, but since I am already returning inside retrieveSelectedTodoAndCreateList() method, why do I have to state an additional return in createSimpleWidget()?

            – pratty
            Jan 4 at 2:45











          • retrieveSelectedTodoAndCreateList returns a value to createSimpleWidget, but createSimpleWidget doesn't return the value to the original function that called it, the builder.

            – Amit Toren
            Jan 4 at 17:12
















          0












          0








          0







          At first, I'll start by saying something I noticed about your code:

          You're using ListView somewhat incorrectly. While It's true that ListView can contain whatever number and types of elements and arrange them in a linear way, it should contain only widgets of the same type like Contacts or Todos.

          As list view is still a list, like in many programming language, it will take only one type within it, by design, like string or int.

          I'd recommend trying the Column widget with a combination of the Flexible and Expanded widgets.



          Regarding your problem, I think it lies in the createSimpleWidget function. When selectedTag is not null, you're not returning the retrieveSelectedTodoAndCreateList function's return value, so nothing will be returned at all, thus, asserting the child to null. To avoid these things in the future (and also to keep only one return statement in a function), I recommend doing this:



          Widget createSimpleWidget() {
          return (selectedTag == null)
          ? Container()
          : retrieveSelectedTodoAndCreateList(selectedTag.tagName);
          }


          Hope this helps!






          share|improve this answer













          At first, I'll start by saying something I noticed about your code:

          You're using ListView somewhat incorrectly. While It's true that ListView can contain whatever number and types of elements and arrange them in a linear way, it should contain only widgets of the same type like Contacts or Todos.

          As list view is still a list, like in many programming language, it will take only one type within it, by design, like string or int.

          I'd recommend trying the Column widget with a combination of the Flexible and Expanded widgets.



          Regarding your problem, I think it lies in the createSimpleWidget function. When selectedTag is not null, you're not returning the retrieveSelectedTodoAndCreateList function's return value, so nothing will be returned at all, thus, asserting the child to null. To avoid these things in the future (and also to keep only one return statement in a function), I recommend doing this:



          Widget createSimpleWidget() {
          return (selectedTag == null)
          ? Container()
          : retrieveSelectedTodoAndCreateList(selectedTag.tagName);
          }


          Hope this helps!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 19:47









          Amit TorenAmit Toren

          6717




          6717













          • This worked for me! Thank you too on the advice on ListView. Just a question, which might be rather rudimentary, but since I am already returning inside retrieveSelectedTodoAndCreateList() method, why do I have to state an additional return in createSimpleWidget()?

            – pratty
            Jan 4 at 2:45











          • retrieveSelectedTodoAndCreateList returns a value to createSimpleWidget, but createSimpleWidget doesn't return the value to the original function that called it, the builder.

            – Amit Toren
            Jan 4 at 17:12





















          • This worked for me! Thank you too on the advice on ListView. Just a question, which might be rather rudimentary, but since I am already returning inside retrieveSelectedTodoAndCreateList() method, why do I have to state an additional return in createSimpleWidget()?

            – pratty
            Jan 4 at 2:45











          • retrieveSelectedTodoAndCreateList returns a value to createSimpleWidget, but createSimpleWidget doesn't return the value to the original function that called it, the builder.

            – Amit Toren
            Jan 4 at 17:12



















          This worked for me! Thank you too on the advice on ListView. Just a question, which might be rather rudimentary, but since I am already returning inside retrieveSelectedTodoAndCreateList() method, why do I have to state an additional return in createSimpleWidget()?

          – pratty
          Jan 4 at 2:45





          This worked for me! Thank you too on the advice on ListView. Just a question, which might be rather rudimentary, but since I am already returning inside retrieveSelectedTodoAndCreateList() method, why do I have to state an additional return in createSimpleWidget()?

          – pratty
          Jan 4 at 2:45













          retrieveSelectedTodoAndCreateList returns a value to createSimpleWidget, but createSimpleWidget doesn't return the value to the original function that called it, the builder.

          – Amit Toren
          Jan 4 at 17:12







          retrieveSelectedTodoAndCreateList returns a value to createSimpleWidget, but createSimpleWidget doesn't return the value to the original function that called it, the builder.

          – Amit Toren
          Jan 4 at 17:12






















          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%2f54027647%2fadd-a-new-widget-upon-receiving-api-result%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

          Mossoró

          Error while reading .h5 file using the rhdf5 package in R

          Pushsharp Apns notification error: 'InvalidToken'