how to get last value in a Stream<String> using rxdart? how to get last value in a Stream<String> using rxdart? dart dart

how to get last value in a Stream<String> using rxdart?


Get the rxDart package from here https://pub.dartlang.org/packages/rxdart.

import 'package:rxdart/rxdart.dart'; // 1. Import rxDart package.final _searchController = BehaviorSubject<String>();  // 2. Initiate _searchController as BehaviorSubject in stead of StreamController.String _lastValue = _searchController.value; // 3. Get the last value in the Stream.

BehaviorSubject is an Object rxDart package.It works like a StreamController, by default the broadcast() is on and BehaviorSubject has more function than StreamController.