distinct_value_connectable_stream 1.3.0
distinct_value_connectable_stream: ^1.3.0 copied to clipboard

Distinct value connectable stream for RxDart, useful for BLoC pattern

distinct_value_connectable_stream #

  • Distinct & Connectable & ValueStream RxDart Stream.
  • Useful for flutter BLoC pattern - StreamBuilder.

Author: Petrus Nguyễn Thái Học #

Build Status Pub codecov


  • [x] Distinct: distinct until changed.
  • [x] Value: can synchronous access to the last emitted item.
  • [x] NotReplay: not replay the latest value.
  • [x] Connectable: broadcast stream - can be listened to multiple time.
                                Stream (dart:core)
                                   ^
                                   |
                                   |
            |--------------------------------------------|
            |                                            |
            |                                            |
        ValueStream (rxdart)                             |
            ^                                            |
            |                                            |
            |                                            |
    NotReplayValueStream (rxdart_ext)                    |
            ^                                    ConnectableStream (rxdart)
            |                                            ^
            |                                            |
    DistinctValueStream (this package)                   |
            ^                                            |
            |                                            |
            |------------                     -----------|
                        |                     |
                        |                     |
                     DistinctValueConnectableStream (this package)

API #

Usage #

import 'package:distinct_value_connectable_stream/distinct_value_connectable_stream.dart';
class UiState { ... }

final Stream<UiState> state$ = ...;

final distinctState$ = state$.publishValueDistinct(UiState.initial());
distinctState$.connect();

StreamBuilder<UiState>(
  initialData: distinctState$.requireValue,
  stream: distinctState$,
  builder: (context, snapshot) {
    final UiState state = snapshot.requireData;
    return ...;
  },
);

Features and bugs #

Please file feature requests and bugs at the issue tracker.

License #

MIT License

Copyright (c) 2020 Petrus Nguyễn Thái Học
5
likes
130
pub points
75%
popularity

Distinct value connectable stream for RxDart, useful for BLoC pattern

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

hoc081098@gmail.com

License

MIT (LICENSE)

Dependencies

meta, rxdart_ext

More

Packages that depend on distinct_value_connectable_stream