adv_async_widget

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

adv async widget

adv_async_widget #





Utility widgets for standard future and stream uses.
New advanced async builders #
This package contains 2 utility classes:

AdvFutureBuilder
AdvStreamBuilder

AdvFutureBuilder #
This class replace the standard FutureBuilder allowing you to have multiple build methods based on the connectionState.
Usage example:

case with standard FutureBuilder

FutureBuilder<String>(
future: exampleFuture,
//old standard builder with one method for everything
builder: (context, snapshot) {
if(snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
}
if(snapshot.hasError) {
return Text("Error: ${snapshot.error}");
}
return Text(snapshot.data ?? "No data");
}
)
copied to clipboard

case with AdvFutureBuilder

AdvFutureBuilder<String>(
future: exampleFuture,
//three different methods, one for each case
onWait: (context) => CircularProgressIndicator(),
onError: (context, error) => Text("Error: $error"),
onData: (context, data) => Text(data ?? "No data"),
)
copied to clipboard
AdvStreamBuilder #
This class replace the standard StreamBuilder allowing you to have multiple build methods based on the connectionState.
(yeah, they're the same, but this one is for stream instead of future)
Usage example:

case with standard StreamBuilder

StreamBuilder<String>(
stream: exampleStream,
//old standard builder with one method for everything
builder: (context, snapshot) {
if(snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
}
if(snapshot.hasError) {
return Text("Error: ${snapshot.error}");
}
return Text(snapshot.data ?? "No data");
}
)
copied to clipboard

case with AdvStreamBuilder

AdvStreamBuilder<String>(
stream: exampleStream,
//three different methods, one for each case
onWait: (context) => CircularProgressIndicator(),
onError: (context, error) => Text("Error: $error"),
onData: (context, data) => Text(data ?? "No data"),
)
copied to clipboard
Full example #
You can find a full flutter example on pub example tab or inside GitHub example

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.