kechankrisna / flutter_responsive_table

BSD 2-Clause "Simplified" License
60 stars 25 forks source link

Unexpected null value #22

Open akhalid opened 2 years ago

akhalid commented 2 years ago

Hello,

Am new to Flutter Web and Dart. I am trying to use this package in a test web app. I have followed the example but I keep getting the Unexpected null value error.

I am using: responsive_table: ^0.2.0+2 Flutter (Channel stable, 2.10.4, on Microsoft Windows [Version 10.0.17763.2746], locale en-US)

The terminal output is:

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ The following TypeErrorImpl was thrown building ResponsiveDatatable(dirty, dependencies: [MediaQuery], state: _ResponsiveDatatableState#cb79a): Unexpected null value.

The relevant error-causing widget was: ResponsiveDatatable ResponsiveDatatable:file:///C:/TPR-Flutter-Sources/E-Commerce_Sample/flutter-web-admin-dashboard-ecommerce-main/lib/pages/orders/orders_page.dart:264:34

When the exception was thrown, this was the stack: C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddcruntime/errors.dart 251:49 throw C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 528:63 nullCheck packages/responsive_table/src/responsive_datatable.dart 378:31 packages/responsive_table/src/responsive_datatable.dart 380:39 desktopList packages/responsive_table/src/responsive_datatable.dart 476:54 packages/responsive_table/src/responsive_datatable.dart 482:40 build packages/flutter/src/widgets/framework.dart 4870:27 build packages/flutter/src/widgets/framework.dart 4754:15 performRebuild packages/flutter/src/widgets/framework.dart 4928:11 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4960:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 5108:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4928:11 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4960:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4834:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4834:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4928:11 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4960:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4928:11 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4960:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4834:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4834:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4834:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 5787:32 updateChildren packages/flutter/src/widgets/framework.dart 6445:17 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4928:11 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4960:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 5108:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4834:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4928:11 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4960:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4928:11 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4960:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 6291:14 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4834:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4834:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4928:11 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4960:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4834:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4928:11 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4960:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 5108:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 4834:5 update packages/flutter/src/widgets/framework.dart 3501:14 updateChild packages/flutter/src/widgets/framework.dart 4780:16 performRebuild packages/flutter/src/widgets/framework.dart 4928:11 performRebuild packages/flutter/src/widgets/framework.dart 4477:5 rebuild packages/flutter/src/widgets/framework.dart 2659:18 buildScope packages/flutter/src/widgets/binding.dart 882:9 drawFrame packages/flutter/src/scheduler/binding.dart 1081:9 handleDrawFrame packages/flutter/src/scheduler/binding.dart 995:5 [_handleDrawFrame] C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platform_dispatcher.dart 1011:13 invoke C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platform_dispatcher.dart 159:5 invokeOnDrawFrame C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/initialization.dart 128:45

════════════════════════════════════════════════════════════════════════════════════════════════════

Is there any other information I can provide to help debug this issue? Thanks!

dzero1 commented 2 years ago

I just had the same problem and it's happen because of the "selecteds" property. So just pass it like this and It'll solve your problem.

selecteds: []
danhdevelop commented 2 years ago

I just had the same problem and it's happen because of the "selecteds" property. So just pass it like this and It'll solve your problem.

selecteds: []

This code only work with mobile UI which is rendered by mobileList at responsive_datatable.dart:156. it will crash when it render with desktopList at responsive_datatable.dart:312. The logic is not right and the parameters requirement is not match with the logic inside.

iMiguel10 commented 1 year ago

Some parameters aren't check if they are null when widget render with desktopList at responsive_datatable.dart:312 @danhdevelop.

So "expanded" property make "Unexpected null value" like "selecteds" too. So if you want to use this widget you must, create an array with same number of values that source. I used this to solve it.

expanded: List.filled(_sublist.length, false)