safety_stream_builder 0.0.1 copy "safety_stream_builder: ^0.0.1" to clipboard
safety_stream_builder: ^0.0.1 copied to clipboard

A new flutter package project.

Safety StreamBuilder for Flutter #

For lazy, SafetyStreamBuilder can use with just a little confidence.

Usage #

In StreamBuilder, it is necessary to finely implement whether AsyncSnapshot contains data or an error has occurred. SafetyStreamBuilder provides default blank widget and error display widget and direct data. (hiding AsyncSnapshot)

Before: Using Dart standard StreamBuilder #

StreamBuilder<String>(
  stream: stream,
  builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
    if (!snapshot.hasData) {
      return Container();
    }
    if (snapshot.hasError) {
      return Icon(Icons.error_outline);
    }
    return Text(snapshot.data);
  },
)

After: Using SafetyStreamBuilder #

SafetyStreamBuilder<String>(
  stream: stream,
  builder: (BuildContext context, String message) => Text(message),
);
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

A new flutter package project.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on safety_stream_builder