adding listview.builder inside row giving an exceptions

Viewed 2232

when I try to add an listview.builder inside a row an exception appears

my code:

return new Scaffold(
  appBar: new AppBar(
    // Here we take the value from the MyHomePage object that was created by
    // the App.build method, and use it to set our appbar title.
    title: new Text(widget.title),
  ),
  body: Row(children: <Widget>[
      ListView.builder(
        shrinkWrap: true,

        scrollDirection: Axis.vertical,
        itemCount: 3,
        itemBuilder: (BuildContext context, int index) {
          return Text('data');
        },
      )
     // This trailing comma makes auto-formatting nicer for build methods.
  ],)
);

the exception:

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter ( 5949): The following assertion was thrown during performLayout():
I/flutter ( 5949): 'package:flutter/src/rendering/viewport.dart': Failed assertion: line 1597 pos 16:
I/flutter ( 5949): 'constraints.hasBoundedWidth': is not true.
I/flutter ( 5949): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter ( 5949): more information in this error message to help you determine and fix the underlying cause.
1 Answers

Wrap Expanded and then add to list.builder > physics: const NeverScrollableScrollPhysics(),

Related