-
Notifications
You must be signed in to change notification settings - Fork 22
ValueBuilder
Francesco Mineo edited this page Mar 15, 2019
·
1 revision
The ValueBuilder
extends the StreamBuilder
widget providing some callbacks to handle the state of the stream and returning an empty Container
if noDataChild
is not provided, in order to avoid checking snapshot.hasData
.
It takes as a stream
parameter an object implementing the StreamedObject
interface and triggers the rebuild of the widget whenever the stream emits a new event.
N.B. To use when there is no need to receive a null value.
ValueBuilder<String>(
stream: streamedValue,
builder: (context, snasphot) => Text(snasphot.data),
noDataChild: // Widget to show when the stream has no data
onNoData: () => // or Callback
errorChild: // Widget to show on error
onError: (error) => // or Callback
)
If no noDataChild
widget or no onNoData
callback is provided then an empty Container
is returned.
If no errorChild
widget or no onError
callback is provided then an empty Container
is returned.
N.B. The callbacks are executed only if their respective child is not provided.