Comments (1)
Hi rockstarvibu,
The DataTable allows only the type of List as a rows collection, but the provided code returns the MappedListIterable<Bill, DataRow>, due to this the exception occurs. So we have converted the map collection to list to overcome this issue.
Try the following solution in your side and let us know the details.
Solution 1: Convert the inerrable to list by using map().toList() method
//Create data table by using dynamic data from web.
DataTable dataTable = DataTable(
columns: const [
DataColumn(label: Text('Series From')),
DataColumn(label: Text('Series To')),
DataColumn(label: Text('No From')),
DataColumn(label: Text('No To')),
DataColumn(label: Text('QTY')),
DataColumn(label: Text('Price')),
],
rows: getBill.bill.map(
(value) => DataRow(cells: [
DataCell(Text(value.series_from.toString())),
DataCell(Text(value.series_to.toString())),
DataCell(Text(value.no_from.toString())),
DataCell(Text(value.no_to.toString())),
DataCell(Text(value.qty.toString())),
DataCell(Text(value.mrp.toString()))])).toList());
Note: MappedListIterable<K, V>.toList() used to get the List
Solution 2: Create List by iterating the bill entries by using forEach() function.
//Iterating bill object and adding the DataRow into List.
List rowCollection = [];
getBill.bill.forEach((value) => rowCollection.add(DataRow(cells: [
DataCell(Text(value.series_from.toString())),
DataCell(Text(value.series_to.toString())),
DataCell(Text(value.no_from.toString())),
DataCell(Text(value.no_to.toString())),
DataCell(Text(value.qty.toString())),
DataCell(Text(value.mrp.toString()))])));
//Create data table by using the list created.
DataTable dataTable = DataTable(
columns: const [
DataColumn(label: Text('Series From')),
DataColumn(label: Text('Series To')),
DataColumn(label: Text('No From')),
DataColumn(label: Text('No To')),
DataColumn(label: Text('QTY')),
DataColumn(label: Text('Price')),
], rows: rowCollection);
DataTable invoiceDetails = dataTable;
With Regards,
Anand Panchamoorthi
from flutter-widgets.
Related Issues (20)
- [syncfusion_flutter_charts] Color LineSeries depending on Plotbands HOT 2
- [SfCartesianChart] [Flutter] How to jump programmatically to desired position? HOT 2
- [SfCartesianChart] [Flutter] How to get real pointIndex on tapped dataSource on FastLineSeries HOT 1
- Chart data not visible after updating from v23.1.43 to v26.1.35 HOT 3
- grid cell height calculation error for multi line text HOT 1
- Range cannot be wider than RangeController's initial value HOT 2
- generateRRule is error when locale setting to zh-CN HOT 1
- Adding dataLabels will throw an exception when using ChartSeriesController to update the chart HOT 1
- Customization line chart
- x Axis dupblicate
- x Axis dupblicate based on width increase (SfCartesianChart) #1932 HOT 1
- Customization Line chart (SfCartesianChart) HOT 1
- [syncfusion_flutter_charts] LegendItemOverflowMode.wrap Line wrapping exceeds container HOT 1
- syncfusion_flutter_pdfviewer error when setState. HOT 2
- [syncfusion_flutter_datepicker] Enable customization on "_getActionsButton" HOT 1
- [syncfusion_flutter_pdfviewer] SfPdfViewer.memory crashes to exception "getImage() has not been implemented" HOT 1
- Unable to change month's cell default hover decoration. HOT 1
- [syncfusion_flutter_charts] Unable to Control Two Charts with a Single Range Slider
- SfCalendar change color month HOT 2
- [datagrid] Incomplete async feature HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter-widgets.