Skip to content
This repository was archived by the owner on Sep 14, 2021. It is now read-only.

hoc081098/distinct_value_connectable_stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6dfbe2d · Sep 13, 2021
Sep 13, 2021
Dec 7, 2020
Dec 13, 2019
Sep 13, 2021
Sep 13, 2021
Sep 13, 2021
Oct 17, 2020
Mar 23, 2021
Sep 13, 2021
Sep 13, 2021
Jan 8, 2021
Sep 13, 2021
Jan 8, 2021
Apr 27, 2020
Apr 27, 2020
Oct 17, 2020
Sep 13, 2021
Jun 1, 2021

Repository files navigation

distinct_value_connectable_stream

DEPRECATED. This package is now merged into rxdart_ext package. Please use rxdart_ext package for the same purpose, thanks.

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

Build Status Pub codecov


  • Distinct: distinct until changed.
  • Value: can synchronous access to the last emitted item.
  • NotReplay: not replay the latest value.
  • 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$.value,
  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