Repository navigation
Closed
Description
im using syncfusion_flutter_pdf: ^18.3.35-beta
plz help me to fix this... I want to add DataRows from my getBIlls.bill list. Help me to fix this...
my code
DataTable dataTable = DataTable(
columns: const <DataColumn>[
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>[
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())),
]),
));
DataTable invoiceDetails = dataTable;
getting error
Error: Expected a value of type 'List<DataRow>', but got one of type 'MappedListIterable<Bill, DataRow>'
at Object.throw_ [as throw] (http://localhost:62775/dart_sdk.js:4328:11)
at Object.castError (http://localhost:62775/dart_sdk.js:4299:15)
at Object.cast [as as] (http://localhost:62775/dart_sdk.js:4615:17)
at dart.LegacyType.new.as (http://localhost:62775/dart_sdk.js:6159:60)
at GenerateBill.ShowBill.new.<anonymous> (http://localhost:62775/packages/lotto_pos/GenerateBill.dart.lib.js:3060:121)
at Generator.next (<anonymous>)
at runBody (http://localhost:62775/dart_sdk.js:37613:34)
at Object._async [as async] (http://localhost:62775/dart_sdk.js:37644:7)
at ink_well._InkResponseStateWidget.new.<anonymous> (http://localhost:62775/packages/lotto_pos/GenerateBill.dart.lib.js:3032:7173)
at ink_well._InkResponseState.new.[_handleTap] (http://localhost:62775/packages/flutter/src/material/icon_button.dart.lib.js:47433:21)
at http://localhost:62775/packages/flutter/src/material/icon_button.dart.lib.js:47535:668
at tap.TapGestureRecognizer.new.invokeCallback (http://localhost:62775/packages/flutter/src/gestures/recognizer.dart.lib.js:189:18)
at tap.TapGestureRecognizer.new.handleTapUp (http://localhost:62775/packages/flutter/src/gestures/tap.dart.lib.js:395:40)
at tap.TapGestureRecognizer.new.[_checkUp] (http://localhost:62775/packages/flutter/src/gestures/tap.dart.lib.js:201:12)
at tap.TapGestureRecognizer.new.handlePrimaryPointer (http://localhost:62775/packages/flutter/src/gestures/tap.dart.lib.js:148:23)
at tap.TapGestureRecognizer.new.handleEvent (http://localhost:62775/packages/flutter/src/gestures/recognizer.dart.lib.js:448:16)
at pointer_router.PointerRouter.new.[_dispatch] (http://localhost:62775/packages/flutter/src/gestures/pointer_router.dart.lib.js:74:9)
at http://localhost:62775/packages/flutter/src/gestures/pointer_router.dart.lib.js:109:26
at LinkedMap.new.forEach (http://localhost:62775/dart_sdk.js:24743:11)
at pointer_router.PointerRouter.new.[_dispatchEventToRoutes] (http://localhost:62775/packages/flutter/src/gestures/pointer_router.dart.lib.js:106:29)
at pointer_router.PointerRouter.new.route (http://localhost:62775/packages/flutter/src/gestures/pointer_router.dart.lib.js:98:37)
at binding$5.WidgetsFlutterBinding.new.handleEvent (http://localhost:62775/packages/flutter/src/gestures/binding.dart.lib.js:303:26)
at binding$5.WidgetsFlutterBinding.new.dispatchEvent (http://localhost:62775/packages/flutter/src/gestures/binding.dart.lib.js:286:24)
at binding$5.WidgetsFlutterBinding.new.dispatchEvent (http://localhost:62775/packages/flutter/src/rendering/layer.dart.lib.js:5949:13)
at binding$5.WidgetsFlutterBinding.new.[_handlePointerEvent] (http://localhost:62775/packages/flutter/src/gestures/binding.dart.lib.js:257:14)
at binding$5.WidgetsFlutterBinding.new.[_flushPointerEventQueue] (http://localhost:62775/packages/flutter/src/gestures/binding.dart.lib.js:229:35)
at binding$5.WidgetsFlutterBinding.new.[_handlePointerDataPacket] (http://localhost:62775/packages/flutter/src/gestures/binding.dart.lib.js:213:65)
at Object._invoke1 (http://localhost:62775/dart_sdk.js:175453:7)
at _engine.EngineWindow.new.invokeOnPointerDataPacket (http://localhost:62775/dart_sdk.js:171307:15)
at _engine.PointerBinding.__.[_onPointerData] (http://localhost:62775/dart_sdk.js:158211:24)
at http://localhost:62775/dart_sdk.js:158598:26
at http://localhost:62775/dart_sdk.js:158557:16
at http://localhost:62775/dart_sdk.js:158310:11
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]I want to add rows dynamically from database(in Web)[/-][+]I want to add rows dynamically from database(in PDF Web)[/+]Anand3595 commentedon Oct 7, 2020
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
Solution 2: Create List by iterating the bill entries by using forEach() function.
With Regards,
Anand Panchamoorthi