Lucas Buchalla Sesti
Lucas Buchalla Sesti

Reputation: 488

Is there way to get a callback after StreamBuilder completely load?

I'm trying get a callback after my context build, i already tried with "WidgetsBinding.instance!.addPostFrameCallback", but not works because i have a StreamBuilder and the first load of snapshot data it is null.

I expected exists a callback of StreamBuilder after data completely load and build loaded, here is my code:

StreamBuilder(
  stream: this.paymentInfoFormPresenter.key,
  builder: (context, snapshot) {
    final _formKey = snapshot.data;

    if (_formKey == null) {
      return Container();
    }

    return Text('example');
  }
);

And i don't find anything about on internet... i hope someone can help me.

Upvotes: 2

Views: 478

Answers (1)

Lucas Buchalla Sesti
Lucas Buchalla Sesti

Reputation: 488

To resolve this issue, i needed change the "Text('example')" to an external widget, and added "WidgetsBinding.instance!.addPostFrameCallback" inside of this external widget

Upvotes: 2

Related Questions