Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create row on table dynamically #5

Closed
sxywalkr opened this issue Nov 15, 2020 · 1 comment
Closed

Create row on table dynamically #5

sxywalkr opened this issue Nov 15, 2020 · 1 comment

Comments

@sxywalkr
Copy link

Many thanks for your great plugins.

i've facing issue when create content within table which is created dynamically

need your suggesstion what i'm missing?

here is my error

I/flutter ( 2617): NoSuchMethodError: The method 'add' was called on null.
I/flutter ( 2617): Receiver: null
I/flutter ( 2617): Tried calling: add(Instance of 'RowContent')

here is my code

List<RowContent> aRow;
      for (int i = 0; i < data3.length; i++) {
        aRow.add(
          RowContent()
            ..add(TextContent("xxNo", i + 1))
            ..add(TextContent("xxJenis", data3[i]['xJenis']))
            ..add(TextContent("xxMerk", "---")),
        );
      }

      c
        ..add(TableContent("table", aRow));
@PavelS0
Copy link
Owner

PavelS0 commented Nov 16, 2020

You are using an uninitialized variable
List<RowContent> aRow
change to
final aRow = <RowContent>[]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants