reactive_widgets 0.6.3 copy "reactive_widgets: ^0.6.3" to clipboard
reactive_widgets: ^0.6.3 copied to clipboard

discontinued

A set of widgets to make it more easier to build reactive interfaces.

Reactive Widgets #

Build Status codecov

A set of widgets to make it more easier to build reactive interfaces.

How To Use #

1º Create a StreamController #

class Bloc {
  // Create a Dart StreamController
  StreamController<String> _controller = StreamController<String>();
  Stream<String> get stream => _controller.stream;

  void dispose() {
    _controller.close();
  }
}

2º Replace StreamBuilder with some ReactiveWidget #

class Example extends StatelessWidget {
  final Bloc bloc;

  Example(this.bloc);

  @override
  Widget build(BuildContext context) {
    
    // Replace this for some ReactiveWidget
    //StreamBuilder(
    //  builder: (BuildContext context, AsyncSnapshot snapshot) {
    //    if (snapshot.hasError) return Text("Error");
    //    if (snapshot.hasData) return Text(snapshot.data);
    //    return Center(
    //      child: CircularProgressIndicator(),
    //    );
    // },
    //);
   
    return ReactiveBuilder(
      stream: bloc.stream,
      builder: (BuildContext context, data) {
        return Text(data);
      },
    );
  }
}

0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A set of widgets to make it more easier to build reactive interfaces.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on reactive_widgets